mirror of
https://github.com/Iconica-Development/flutter_profile.git
synced 2025-05-19 09:13:44 +02:00
29 lines
648 B
Dart
29 lines
648 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'package:profile/src/widgets/item_builder/item_builder_options.dart';
|
||
|
|
||
|
class ItemBuilder {
|
||
|
ItemBuilder({
|
||
|
required this.options,
|
||
|
});
|
||
|
|
||
|
final ItemBuilderOptions options;
|
||
|
|
||
|
Widget build(dynamic value, Widget? widget, Function(String) updateItem) {
|
||
|
if (widget == null) {
|
||
|
var controller = TextEditingController(
|
||
|
text: '$value',
|
||
|
);
|
||
|
|
||
|
return TextField(
|
||
|
controller: controller,
|
||
|
decoration: options.inputDecoration,
|
||
|
readOnly: options.readOnly,
|
||
|
onSubmitted: (s) {
|
||
|
updateItem(s);
|
||
|
},
|
||
|
);
|
||
|
}
|
||
|
return widget;
|
||
|
}
|
||
|
}
|