|
|
|
@ -16,8 +16,8 @@ class PartNoButton extends StatefulWidget {
|
|
|
|
final List<SparePart> spareParts;
|
|
|
|
final List<SparePart> spareParts;
|
|
|
|
final List<SparePartsWorkOrders> initialList;
|
|
|
|
final List<SparePartsWorkOrders> initialList;
|
|
|
|
final TextEditingController controller;
|
|
|
|
final TextEditingController controller;
|
|
|
|
final Function(List<SparePartsWorkOrders> sparePart) onAdd;
|
|
|
|
final Function(List<SparePartsWorkOrders> sparePart) onChange;
|
|
|
|
const PartNoButton({@required this.spareParts, @required this.controller, this.initialList, this.onAdd, Key key}) : super(key: key);
|
|
|
|
const PartNoButton({@required this.spareParts, @required this.controller, this.initialList, this.onChange, Key key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
State<PartNoButton> createState() => _PartNoButtonState();
|
|
|
|
State<PartNoButton> createState() => _PartNoButtonState();
|
|
|
|
@ -95,7 +95,7 @@ class _PartNoButtonState extends State<PartNoButton> {
|
|
|
|
if (current != null && _formKey.currentState.validate()) {
|
|
|
|
if (current != null && _formKey.currentState.validate()) {
|
|
|
|
_formKey.currentState.save();
|
|
|
|
_formKey.currentState.save();
|
|
|
|
list.add(current);
|
|
|
|
list.add(current);
|
|
|
|
if (widget.onAdd != null) widget.onAdd(list);
|
|
|
|
if (widget.onChange != null) widget.onChange(list);
|
|
|
|
current = SparePartsWorkOrders();
|
|
|
|
current = SparePartsWorkOrders();
|
|
|
|
widget.controller.text = "";
|
|
|
|
widget.controller.text = "";
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
@ -119,7 +119,7 @@ class _PartNoButtonState extends State<PartNoButton> {
|
|
|
|
32.width,
|
|
|
|
32.width,
|
|
|
|
"trash".toSvgAsset().onPress(() {
|
|
|
|
"trash".toSvgAsset().onPress(() {
|
|
|
|
list.remove(list[index]);
|
|
|
|
list.remove(list[index]);
|
|
|
|
if (widget.onAdd != null) widget.onAdd(list);
|
|
|
|
if (widget.onChange != null) widget.onChange(list);
|
|
|
|
setState(() {});
|
|
|
|
setState(() {});
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|