| 5729eb498eaeb9c64784fcfc80bbb33b | |||||
| 440505e9ea1eee7043d2cbfeb318f6bc |
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 0.11.0; | |||||
| MARKETING_VERSION = 0.12.0; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | ||||
| PRODUCT_NAME = Runner; | PRODUCT_NAME = Runner; | ||||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | ||||
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 0.11.0; | |||||
| MARKETING_VERSION = 0.12.0; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | ||||
| PRODUCT_NAME = Runner; | PRODUCT_NAME = Runner; | ||||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | ||||
| "$(inherited)", | "$(inherited)", | ||||
| "$(PROJECT_DIR)/Flutter", | "$(PROJECT_DIR)/Flutter", | ||||
| ); | ); | ||||
| MARKETING_VERSION = 0.11.0; | |||||
| MARKETING_VERSION = 0.12.0; | |||||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | ||||
| PRODUCT_NAME = Runner; | PRODUCT_NAME = Runner; | ||||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| final TextEditingController textController; | final TextEditingController textController; | ||||
| final void Function(String) onSaved; | final void Function(String) onSaved; | ||||
| final void Function(String) validator; | final void Function(String) validator; | ||||
| final void Function(String) onChanged; | |||||
| final String hintValue; | final String hintValue; | ||||
| WidgetTextFormFieldNumber( | WidgetTextFormFieldNumber( | ||||
| {@required this.textController, | {@required this.textController, | ||||
| this.onSaved, | this.onSaved, | ||||
| @required this.hintValue, | @required this.hintValue, | ||||
| this.validator}); | |||||
| this.validator, | |||||
| this.onChanged}); | |||||
| @override | @override | ||||
| Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
| return TextFormField( | return TextFormField( | ||||
| }, | }, | ||||
| controller: textController, | controller: textController, | ||||
| onSaved: onSaved, | onSaved: onSaved, | ||||
| onChanged: onChanged, | |||||
| ); | ); | ||||
| } | } | ||||
| } | } |
| textCancel: textCancel, | textCancel: textCancel, | ||||
| confirmTextColor: Colors.white, | confirmTextColor: Colors.white, | ||||
| onConfirm: onConfirm, | onConfirm: onConfirm, | ||||
| onCancel: () { | |||||
| Get.back(); | |||||
| }, | |||||
| ); | ); | ||||
| } | } | ||||
| import 'package:get/get.dart'; | |||||
| class ChangeFieldFormSupply extends GetxController { | |||||
| bool isChanged; | |||||
| void init() { | |||||
| isChanged = false; | |||||
| update(); | |||||
| } | |||||
| void change(bool changed) { | |||||
| isChanged = changed; | |||||
| update(); | |||||
| } | |||||
| } |
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/dung/widget_dung_supply.dart'; | import 'package:farm_tpf/presentation/screens/actions/dung/widget_dung_supply.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | ||||
| if (!currentFocus.hasPrimaryFocus) { | if (!currentFocus.hasPrimaryFocus) { | ||||
| currentFocus.unfocus(); | currentFocus.unfocus(); | ||||
| } | } | ||||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||||
| Utils.showDialogConfirmSupply(onConfirm: () { | Utils.showDialogConfirmSupply(onConfirm: () { | ||||
| Get.back(); | Get.back(); | ||||
| _validateInputs(); | _validateInputs(); |
| import 'package:farm_tpf/custom_model/Supply.dart'; | import 'package:farm_tpf/custom_model/Supply.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeDevice.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeDevice.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | ||||
| final changeUnit = Get.put(ChangeUnit()); | final changeUnit = Get.put(ChangeUnit()); | ||||
| final changeButton = Get.put(ChangeButtonInForm()); | final changeButton = Get.put(ChangeButtonInForm()); | ||||
| final changeSelectedDevice = Get.put(ChangeDevice()); | final changeSelectedDevice = Get.put(ChangeDevice()); | ||||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||||
| @override | @override | ||||
| void initState() { | void initState() { | ||||
| changeSupplyUsing.init(widget.currentItems); | changeSupplyUsing.init(widget.currentItems); | ||||
| changeUnit.initValue(); | changeUnit.initValue(); | ||||
| changeButton.resetValue(); | changeButton.resetValue(); | ||||
| changeFormField.init(); | |||||
| } | } | ||||
| Widget _buildListSupply() { | Widget _buildListSupply() { | ||||
| var result = value as Supply; | var result = value as Supply; | ||||
| changeSelectedSupply.change(result); | changeSelectedSupply.change(result); | ||||
| changeUnit.updateListByUnitName(result.unit); | changeUnit.updateListByUnitName(result.unit); | ||||
| changeFormField.change(true); | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| if (value != null) { | if (value != null) { | ||||
| var result = value as Device; | var result = value as Device; | ||||
| changeSelectedDevice.change(result); | changeSelectedDevice.change(result); | ||||
| changeFormField.change(true); | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| _quantityField() { | _quantityField() { | ||||
| return WidgetTextFormFieldNumber( | return WidgetTextFormFieldNumber( | ||||
| hintValue: "Tổng lượng sử dụng *", textController: _quantityController); | |||||
| hintValue: "Tổng lượng sử dụng *", | |||||
| textController: _quantityController, | |||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty(value) && | |||||
| !Validators.stringNotNullOrEmpty(_howToUseController.text) && | |||||
| !Validators.stringNotNullOrEmpty(_dosageController.text) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ); | |||||
| } | } | ||||
| _buttonInForm() { | _buttonInForm() { | ||||
| controller: _dosageController, | controller: _dosageController, | ||||
| decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | ||||
| onSaved: (newValue) {}, | onSaved: (newValue) {}, | ||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty( | |||||
| _quantityController.text) && | |||||
| !Validators.stringNotNullOrEmpty( | |||||
| _howToUseController.text) && | |||||
| !Validators.stringNotNullOrEmpty(value) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ), | ), | ||||
| Row( | Row( | ||||
| mainAxisSize: MainAxisSize.min, | mainAxisSize: MainAxisSize.min, | ||||
| controller: _howToUseController, | controller: _howToUseController, | ||||
| decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | ||||
| onSaved: (newValue) {}, | onSaved: (newValue) {}, | ||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty( | |||||
| _quantityController.text) && | |||||
| !Validators.stringNotNullOrEmpty(value) && | |||||
| !Validators.stringNotNullOrEmpty(_dosageController.text) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ), | ), | ||||
| _buttonInForm() | _buttonInForm() | ||||
| ], | ], |
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/harvest_process/widget_harvest_process_supply.dart'; | import 'package:farm_tpf/presentation/screens/actions/harvest_process/widget_harvest_process_supply.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | ||||
| if (!currentFocus.hasPrimaryFocus) { | if (!currentFocus.hasPrimaryFocus) { | ||||
| currentFocus.unfocus(); | currentFocus.unfocus(); | ||||
| } | } | ||||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||||
| Utils.showDialogConfirmSupply(onConfirm: () { | Utils.showDialogConfirmSupply(onConfirm: () { | ||||
| Get.back(); | Get.back(); | ||||
| _validateInputs(); | _validateInputs(); |
| import 'package:farm_tpf/custom_model/Supply.dart'; | import 'package:farm_tpf/custom_model/Supply.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeDevice.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeDevice.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'package:get/get.dart'; | import 'package:get/get.dart'; | ||||
| import 'package:farm_tpf/utils/formatter.dart'; | import 'package:farm_tpf/utils/formatter.dart'; | ||||
| import 'package:intl/intl.dart'; | |||||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||||
| import '../util_action.dart'; | import '../util_action.dart'; | ||||
| final changeUnit = Get.put(ChangeUnit()); | final changeUnit = Get.put(ChangeUnit()); | ||||
| final changeButton = Get.put(ChangeButtonInForm()); | final changeButton = Get.put(ChangeButtonInForm()); | ||||
| final changeSelectedDevice = Get.put(ChangeDevice()); | final changeSelectedDevice = Get.put(ChangeDevice()); | ||||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||||
| @override | @override | ||||
| void initState() { | void initState() { | ||||
| changeSupplyUsing.init(widget.currentItems); | changeSupplyUsing.init(widget.currentItems); | ||||
| changeUnit.initValue(); | changeUnit.initValue(); | ||||
| changeButton.resetValue(); | changeButton.resetValue(); | ||||
| changeFormField.init(); | |||||
| } | } | ||||
| Widget _buildListSupply() { | Widget _buildListSupply() { | ||||
| var result = value as Supply; | var result = value as Supply; | ||||
| changeSelectedSupply.change(result); | changeSelectedSupply.change(result); | ||||
| changeUnit.updateListByUnitName(result.unit); | changeUnit.updateListByUnitName(result.unit); | ||||
| changeFormField.change(true); | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| if (value != null) { | if (value != null) { | ||||
| var result = value as Device; | var result = value as Device; | ||||
| changeSelectedDevice.change(result); | changeSelectedDevice.change(result); | ||||
| changeFormField.change(true); | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| _quantityField() { | _quantityField() { | ||||
| return WidgetTextFormFieldNumber( | return WidgetTextFormFieldNumber( | ||||
| hintValue: "Tổng lượng sử dụng *", textController: _quantityController); | |||||
| hintValue: "Tổng lượng sử dụng *", | |||||
| textController: _quantityController, | |||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty(value) && | |||||
| !Validators.stringNotNullOrEmpty(_howToUseController.text) && | |||||
| !Validators.stringNotNullOrEmpty(_dosageController.text) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ); | |||||
| } | } | ||||
| _buttonInForm() { | _buttonInForm() { | ||||
| controller: _dosageController, | controller: _dosageController, | ||||
| decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | ||||
| onSaved: (newValue) {}, | onSaved: (newValue) {}, | ||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty( | |||||
| _quantityController.text) && | |||||
| !Validators.stringNotNullOrEmpty( | |||||
| _howToUseController.text) && | |||||
| !Validators.stringNotNullOrEmpty(value) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ), | ), | ||||
| Row( | Row( | ||||
| mainAxisSize: MainAxisSize.min, | mainAxisSize: MainAxisSize.min, | ||||
| controller: _howToUseController, | controller: _howToUseController, | ||||
| decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | ||||
| onSaved: (newValue) {}, | onSaved: (newValue) {}, | ||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty( | |||||
| _quantityController.text) && | |||||
| !Validators.stringNotNullOrEmpty(value) && | |||||
| !Validators.stringNotNullOrEmpty(_dosageController.text) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ), | ), | ||||
| _buttonInForm() | _buttonInForm() | ||||
| ], | ], |
| if (!currentFocus.hasPrimaryFocus) { | if (!currentFocus.hasPrimaryFocus) { | ||||
| currentFocus.unfocus(); | currentFocus.unfocus(); | ||||
| } | } | ||||
| _validateInputs(); | |||||
| if (!Validators.stringNotNullOrEmpty(_workerNameController.text) && | |||||
| !Validators.stringNotNullOrEmpty(_trayNumberController.text)) { | |||||
| _validateInputs(); | |||||
| } else { | |||||
| Utils.showDialog( | |||||
| title: "Tên công nhân hoặc khây trồng đang cập nhật", | |||||
| message: "Bạn có muốn cập nhật?", | |||||
| textConfirm: "Tiếp tục", | |||||
| textCancel: "Xem lại", | |||||
| onConfirm: () { | |||||
| Get.back(); | |||||
| _validateInputs(); | |||||
| }); | |||||
| } | |||||
| }, | }, | ||||
| ); | ); | ||||
| return <Widget>[iconButton]; | return <Widget>[iconButton]; |
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/plant/widget_plant_supply.dart'; | import 'package:farm_tpf/presentation/screens/actions/plant/widget_plant_supply.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | ||||
| if (!currentFocus.hasPrimaryFocus) { | if (!currentFocus.hasPrimaryFocus) { | ||||
| currentFocus.unfocus(); | currentFocus.unfocus(); | ||||
| } | } | ||||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||||
| Utils.showDialogConfirmSupply(onConfirm: () { | Utils.showDialogConfirmSupply(onConfirm: () { | ||||
| Get.back(); | Get.back(); | ||||
| _validateInputs(); | _validateInputs(); |
| import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; | import 'package:farm_tpf/custom_model/SuppliesUsing.dart'; | ||||
| import 'package:farm_tpf/custom_model/Supply.dart'; | import 'package:farm_tpf/custom_model/Supply.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'package:get/get.dart'; | import 'package:get/get.dart'; | ||||
| import 'package:farm_tpf/utils/formatter.dart'; | import 'package:farm_tpf/utils/formatter.dart'; | ||||
| import 'package:intl/intl.dart'; | |||||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||||
| class WidgetPlantSupply extends StatefulWidget { | class WidgetPlantSupply extends StatefulWidget { | ||||
| final List<SuppliesUsing> currentItems; | final List<SuppliesUsing> currentItems; | ||||
| final changeSupplyUsing = Get.put(ChangeSupplyUsing()); | final changeSupplyUsing = Get.put(ChangeSupplyUsing()); | ||||
| final changeUnit = Get.put(ChangeUnit()); | final changeUnit = Get.put(ChangeUnit()); | ||||
| final changeButton = Get.put(ChangeButtonInForm()); | final changeButton = Get.put(ChangeButtonInForm()); | ||||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||||
| @override | @override | ||||
| void initState() { | void initState() { | ||||
| changeSupplyUsing.init(widget.currentItems); | changeSupplyUsing.init(widget.currentItems); | ||||
| changeUnit.initValue(); | changeUnit.initValue(); | ||||
| changeButton.resetValue(); | changeButton.resetValue(); | ||||
| changeFormField.init(); | |||||
| } | } | ||||
| Widget _buildListSupply() { | Widget _buildListSupply() { | ||||
| var result = value as Supply; | var result = value as Supply; | ||||
| changeSelectedSupply.change(result); | changeSelectedSupply.change(result); | ||||
| changeUnit.updateListByUnitName(result.unit); | changeUnit.updateListByUnitName(result.unit); | ||||
| changeFormField.change(true); | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| _quantityField() { | _quantityField() { | ||||
| return WidgetTextFormFieldNumber( | return WidgetTextFormFieldNumber( | ||||
| hintValue: "Tổng lượng sử dụng", textController: _quantityController); | |||||
| hintValue: "Tổng lượng sử dụng", | |||||
| textController: _quantityController, | |||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty(value) && | |||||
| !Validators.stringNotNullOrEmpty(_dosageController.text) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ); | |||||
| } | } | ||||
| _buttonInForm() { | _buttonInForm() { | ||||
| controller: _dosageController, | controller: _dosageController, | ||||
| decoration: InputDecoration(labelText: "Liều lượng"), | decoration: InputDecoration(labelText: "Liều lượng"), | ||||
| onSaved: (newValue) {}, | onSaved: (newValue) {}, | ||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty( | |||||
| _quantityController.text) && | |||||
| !Validators.stringNotNullOrEmpty(value) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ), | ), | ||||
| Row( | Row( | ||||
| mainAxisSize: MainAxisSize.min, | mainAxisSize: MainAxisSize.min, |
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_utils.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/spraying/widget_spraying_supply.dart'; | import 'package:farm_tpf/presentation/screens/actions/spraying/widget_spraying_supply.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | ||||
| if (!currentFocus.hasPrimaryFocus) { | if (!currentFocus.hasPrimaryFocus) { | ||||
| currentFocus.unfocus(); | currentFocus.unfocus(); | ||||
| } | } | ||||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||||
| Utils.showDialogConfirmSupply(onConfirm: () { | Utils.showDialogConfirmSupply(onConfirm: () { | ||||
| Get.back(); | Get.back(); | ||||
| _validateInputs(); | _validateInputs(); |
| import 'package:farm_tpf/custom_model/Supply.dart'; | import 'package:farm_tpf/custom_model/Supply.dart'; | ||||
| import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | import 'package:farm_tpf/presentation/custom_widgets/widget_text_form_field.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeDevice.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeDevice.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFieldInForm.dart'; | |||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeFormButton.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeSupplyUsing.dart'; | ||||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | ||||
| import 'package:get/get.dart'; | import 'package:get/get.dart'; | ||||
| import 'package:farm_tpf/utils/formatter.dart'; | import 'package:farm_tpf/utils/formatter.dart'; | ||||
| import 'package:intl/intl.dart'; | |||||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||||
| import '../util_action.dart'; | import '../util_action.dart'; | ||||
| final changeUnit = Get.put(ChangeUnit()); | final changeUnit = Get.put(ChangeUnit()); | ||||
| final changeButton = Get.put(ChangeButtonInForm()); | final changeButton = Get.put(ChangeButtonInForm()); | ||||
| final changeSelectedDevice = Get.put(ChangeDevice()); | final changeSelectedDevice = Get.put(ChangeDevice()); | ||||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||||
| @override | @override | ||||
| void initState() { | void initState() { | ||||
| changeSupplyUsing.init(widget.currentItems); | changeSupplyUsing.init(widget.currentItems); | ||||
| changeUnit.initValue(); | changeUnit.initValue(); | ||||
| changeButton.resetValue(); | changeButton.resetValue(); | ||||
| changeFormField.init(); | |||||
| } | } | ||||
| Widget _buildListSupply() { | Widget _buildListSupply() { | ||||
| var result = value as Supply; | var result = value as Supply; | ||||
| changeSelectedSupply.change(result); | changeSelectedSupply.change(result); | ||||
| changeUnit.updateListByUnitName(result.unit); | changeUnit.updateListByUnitName(result.unit); | ||||
| changeFormField.change(true); | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| if (value != null) { | if (value != null) { | ||||
| var result = value as Device; | var result = value as Device; | ||||
| changeSelectedDevice.change(result); | changeSelectedDevice.change(result); | ||||
| changeFormField.change(true); | |||||
| } | } | ||||
| }); | }); | ||||
| }, | }, | ||||
| _quantityField() { | _quantityField() { | ||||
| return WidgetTextFormFieldNumber( | return WidgetTextFormFieldNumber( | ||||
| hintValue: "Tổng lượng sử dụng *", textController: _quantityController); | |||||
| hintValue: "Tổng lượng sử dụng *", | |||||
| textController: _quantityController, | |||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty(value) && | |||||
| !Validators.stringNotNullOrEmpty(_howToUseController.text) && | |||||
| !Validators.stringNotNullOrEmpty(_dosageController.text) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ); | |||||
| } | } | ||||
| _buttonInForm() { | _buttonInForm() { | ||||
| controller: _dosageController, | controller: _dosageController, | ||||
| decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | ||||
| onSaved: (newValue) {}, | onSaved: (newValue) {}, | ||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty( | |||||
| _quantityController.text) && | |||||
| !Validators.stringNotNullOrEmpty( | |||||
| _howToUseController.text) && | |||||
| !Validators.stringNotNullOrEmpty(value) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ), | ), | ||||
| Row( | Row( | ||||
| mainAxisSize: MainAxisSize.min, | mainAxisSize: MainAxisSize.min, | ||||
| controller: _howToUseController, | controller: _howToUseController, | ||||
| decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | ||||
| onSaved: (newValue) {}, | onSaved: (newValue) {}, | ||||
| onChanged: (value) { | |||||
| if (!Validators.stringNotNullOrEmpty( | |||||
| _quantityController.text) && | |||||
| !Validators.stringNotNullOrEmpty(value) && | |||||
| !Validators.stringNotNullOrEmpty(_dosageController.text) && | |||||
| Get.find<ChangeSupply>().selectedSupplyId <= 0 && | |||||
| changeSelectedDevice.selectedDeviceId <= 0) { | |||||
| changeFormField.change(false); | |||||
| } else { | |||||
| changeFormField.change(true); | |||||
| } | |||||
| }, | |||||
| ), | ), | ||||
| _buttonInForm() | _buttonInForm() | ||||
| ], | ], |
| _timeEndGrowController.text = _crop.endDate.format_DDMMYY_HHmm(); | _timeEndGrowController.text = _crop.endDate.format_DDMMYY_HHmm(); | ||||
| _descriptionController.text = | _descriptionController.text = | ||||
| _crop.description == null ? "" : _crop.description.toString(); | _crop.description == null ? "" : _crop.description.toString(); | ||||
| var technicians = _crop.tbDetailUsers.map((e) => e.fullName).join(","); | |||||
| var technicians = _crop.tbDetailUsers.map((e) => e.fullName).join(", "); | |||||
| _mainTechnicianController.text = technicians; | _mainTechnicianController.text = technicians; | ||||
| }, (err) {}); | }, (err) {}); | ||||
| } | } |
| description: A new Flutter project. | description: A new Flutter project. | ||||
| publish_to: 'none' | publish_to: 'none' | ||||
| version: 0.11.0+1 | |||||
| version: 0.12.0+1 | |||||
| environment: | environment: | ||||
| sdk: ">=2.7.0 <3.0.0" | sdk: ">=2.7.0 <3.0.0" |