| @@ -1 +1 @@ | |||
| 5729eb498eaeb9c64784fcfc80bbb33b | |||
| 440505e9ea1eee7043d2cbfeb318f6bc | |||
| @@ -391,7 +391,7 @@ | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| MARKETING_VERSION = 0.11.0; | |||
| MARKETING_VERSION = 0.12.0; | |||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | |||
| PRODUCT_NAME = Runner; | |||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | |||
| @@ -533,7 +533,7 @@ | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| MARKETING_VERSION = 0.11.0; | |||
| MARKETING_VERSION = 0.12.0; | |||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | |||
| PRODUCT_NAME = Runner; | |||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | |||
| @@ -567,7 +567,7 @@ | |||
| "$(inherited)", | |||
| "$(PROJECT_DIR)/Flutter", | |||
| ); | |||
| MARKETING_VERSION = 0.11.0; | |||
| MARKETING_VERSION = 0.12.0; | |||
| PRODUCT_BUNDLE_IDENTIFIER = vn.azteam.tpfarm; | |||
| PRODUCT_NAME = Runner; | |||
| SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | |||
| @@ -10,12 +10,14 @@ class WidgetTextFormFieldNumber extends StatelessWidget { | |||
| final TextEditingController textController; | |||
| final void Function(String) onSaved; | |||
| final void Function(String) validator; | |||
| final void Function(String) onChanged; | |||
| final String hintValue; | |||
| WidgetTextFormFieldNumber( | |||
| {@required this.textController, | |||
| this.onSaved, | |||
| @required this.hintValue, | |||
| this.validator}); | |||
| this.validator, | |||
| this.onChanged}); | |||
| @override | |||
| Widget build(BuildContext context) { | |||
| return TextFormField( | |||
| @@ -32,6 +34,7 @@ class WidgetTextFormFieldNumber extends StatelessWidget { | |||
| }, | |||
| controller: textController, | |||
| onSaved: onSaved, | |||
| onChanged: onChanged, | |||
| ); | |||
| } | |||
| } | |||
| @@ -49,9 +49,6 @@ class Utils { | |||
| textCancel: textCancel, | |||
| confirmTextColor: Colors.white, | |||
| onConfirm: onConfirm, | |||
| onCancel: () { | |||
| Get.back(); | |||
| }, | |||
| ); | |||
| } | |||
| @@ -0,0 +1,14 @@ | |||
| import 'package:get/get.dart'; | |||
| class ChangeFieldFormSupply extends GetxController { | |||
| bool isChanged; | |||
| void init() { | |||
| isChanged = false; | |||
| update(); | |||
| } | |||
| void change(bool changed) { | |||
| isChanged = changed; | |||
| update(); | |||
| } | |||
| } | |||
| @@ -11,6 +11,7 @@ import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.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/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/dung/widget_dung_supply.dart'; | |||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | |||
| @@ -197,7 +198,7 @@ class _EditActionDungScreenState extends State<EditActionDungScreen> { | |||
| if (!currentFocus.hasPrimaryFocus) { | |||
| currentFocus.unfocus(); | |||
| } | |||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||
| Utils.showDialogConfirmSupply(onConfirm: () { | |||
| Get.back(); | |||
| _validateInputs(); | |||
| @@ -3,6 +3,7 @@ import 'package:farm_tpf/custom_model/SuppliesUsing.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/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/ChangeSupplyUsing.dart'; | |||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | |||
| @@ -38,6 +39,7 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| final changeUnit = Get.put(ChangeUnit()); | |||
| final changeButton = Get.put(ChangeButtonInForm()); | |||
| final changeSelectedDevice = Get.put(ChangeDevice()); | |||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||
| @override | |||
| void initState() { | |||
| @@ -47,6 +49,7 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| changeSupplyUsing.init(widget.currentItems); | |||
| changeUnit.initValue(); | |||
| changeButton.resetValue(); | |||
| changeFormField.init(); | |||
| } | |||
| Widget _buildListSupply() { | |||
| @@ -179,6 +182,7 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| var result = value as Supply; | |||
| changeSelectedSupply.change(result); | |||
| changeUnit.updateListByUnitName(result.unit); | |||
| changeFormField.change(true); | |||
| } | |||
| }); | |||
| }, | |||
| @@ -221,6 +225,7 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| if (value != null) { | |||
| var result = value as Device; | |||
| changeSelectedDevice.change(result); | |||
| changeFormField.change(true); | |||
| } | |||
| }); | |||
| }, | |||
| @@ -281,7 +286,20 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| _quantityField() { | |||
| 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() { | |||
| @@ -407,6 +425,19 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| controller: _dosageController, | |||
| decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | |||
| 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( | |||
| mainAxisSize: MainAxisSize.min, | |||
| @@ -443,6 +474,18 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| controller: _howToUseController, | |||
| decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | |||
| 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() | |||
| ], | |||
| @@ -11,6 +11,7 @@ import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.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/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/harvest_process/widget_harvest_process_supply.dart'; | |||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | |||
| @@ -298,7 +299,7 @@ class _EditActionHarvestProcessScreenState | |||
| if (!currentFocus.hasPrimaryFocus) { | |||
| currentFocus.unfocus(); | |||
| } | |||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||
| Utils.showDialogConfirmSupply(onConfirm: () { | |||
| Get.back(); | |||
| _validateInputs(); | |||
| @@ -3,6 +3,7 @@ import 'package:farm_tpf/custom_model/SuppliesUsing.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/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/ChangeSupplyUsing.dart'; | |||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | |||
| @@ -16,8 +17,6 @@ import 'package:farm_tpf/utils/validators.dart'; | |||
| import 'package:flutter/material.dart'; | |||
| import 'package:get/get.dart'; | |||
| import 'package:farm_tpf/utils/formatter.dart'; | |||
| import 'package:intl/intl.dart'; | |||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||
| import '../util_action.dart'; | |||
| @@ -41,6 +40,7 @@ class _WidgetHarvestProcessSupplyState | |||
| final changeUnit = Get.put(ChangeUnit()); | |||
| final changeButton = Get.put(ChangeButtonInForm()); | |||
| final changeSelectedDevice = Get.put(ChangeDevice()); | |||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||
| @override | |||
| void initState() { | |||
| @@ -50,6 +50,7 @@ class _WidgetHarvestProcessSupplyState | |||
| changeSupplyUsing.init(widget.currentItems); | |||
| changeUnit.initValue(); | |||
| changeButton.resetValue(); | |||
| changeFormField.init(); | |||
| } | |||
| Widget _buildListSupply() { | |||
| @@ -181,6 +182,7 @@ class _WidgetHarvestProcessSupplyState | |||
| var result = value as Supply; | |||
| changeSelectedSupply.change(result); | |||
| changeUnit.updateListByUnitName(result.unit); | |||
| changeFormField.change(true); | |||
| } | |||
| }); | |||
| }, | |||
| @@ -223,6 +225,7 @@ class _WidgetHarvestProcessSupplyState | |||
| if (value != null) { | |||
| var result = value as Device; | |||
| changeSelectedDevice.change(result); | |||
| changeFormField.change(true); | |||
| } | |||
| }); | |||
| }, | |||
| @@ -283,7 +286,20 @@ class _WidgetHarvestProcessSupplyState | |||
| _quantityField() { | |||
| 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() { | |||
| @@ -409,6 +425,19 @@ class _WidgetHarvestProcessSupplyState | |||
| controller: _dosageController, | |||
| decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | |||
| 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( | |||
| mainAxisSize: MainAxisSize.min, | |||
| @@ -445,6 +474,18 @@ class _WidgetHarvestProcessSupplyState | |||
| controller: _howToUseController, | |||
| decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | |||
| 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() | |||
| ], | |||
| @@ -434,7 +434,20 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { | |||
| if (!currentFocus.hasPrimaryFocus) { | |||
| 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]; | |||
| @@ -11,6 +11,7 @@ import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.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/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/plant/widget_plant_supply.dart'; | |||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | |||
| @@ -186,7 +187,7 @@ class _EditActionPlantScreenState extends State<EditActionPlantScreen> { | |||
| if (!currentFocus.hasPrimaryFocus) { | |||
| currentFocus.unfocus(); | |||
| } | |||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||
| Utils.showDialogConfirmSupply(onConfirm: () { | |||
| Get.back(); | |||
| _validateInputs(); | |||
| @@ -1,6 +1,7 @@ | |||
| import 'package:farm_tpf/custom_model/SuppliesUsing.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/screens/actions/controller/ChangeFieldInForm.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/ChangeUnit.dart'; | |||
| @@ -14,8 +15,6 @@ import 'package:farm_tpf/utils/validators.dart'; | |||
| import 'package:flutter/material.dart'; | |||
| import 'package:get/get.dart'; | |||
| import 'package:farm_tpf/utils/formatter.dart'; | |||
| import 'package:intl/intl.dart'; | |||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||
| class WidgetPlantSupply extends StatefulWidget { | |||
| final List<SuppliesUsing> currentItems; | |||
| @@ -32,6 +31,7 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> { | |||
| final changeSupplyUsing = Get.put(ChangeSupplyUsing()); | |||
| final changeUnit = Get.put(ChangeUnit()); | |||
| final changeButton = Get.put(ChangeButtonInForm()); | |||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||
| @override | |||
| void initState() { | |||
| @@ -40,6 +40,7 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> { | |||
| changeSupplyUsing.init(widget.currentItems); | |||
| changeUnit.initValue(); | |||
| changeButton.resetValue(); | |||
| changeFormField.init(); | |||
| } | |||
| Widget _buildListSupply() { | |||
| @@ -152,6 +153,7 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> { | |||
| var result = value as Supply; | |||
| changeSelectedSupply.change(result); | |||
| changeUnit.updateListByUnitName(result.unit); | |||
| changeFormField.change(true); | |||
| } | |||
| }); | |||
| }, | |||
| @@ -212,7 +214,18 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> { | |||
| _quantityField() { | |||
| 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() { | |||
| @@ -326,6 +339,16 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> { | |||
| controller: _dosageController, | |||
| decoration: InputDecoration(labelText: "Liều lượng"), | |||
| 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( | |||
| mainAxisSize: MainAxisSize.min, | |||
| @@ -10,6 +10,7 @@ import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.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/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/spraying/widget_spraying_supply.dart'; | |||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | |||
| @@ -275,7 +276,7 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> { | |||
| if (!currentFocus.hasPrimaryFocus) { | |||
| currentFocus.unfocus(); | |||
| } | |||
| if (Get.find<ChangeSupply>().selectedSupplyId > 0) { | |||
| if (Get.find<ChangeFieldFormSupply>().isChanged) { | |||
| Utils.showDialogConfirmSupply(onConfirm: () { | |||
| Get.back(); | |||
| _validateInputs(); | |||
| @@ -3,6 +3,7 @@ import 'package:farm_tpf/custom_model/SuppliesUsing.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/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/ChangeSupplyUsing.dart'; | |||
| import 'package:farm_tpf/presentation/screens/actions/controller/ChangeUnit.dart'; | |||
| @@ -17,8 +18,6 @@ import 'package:flutter/material.dart'; | |||
| import 'package:get/get.dart'; | |||
| import 'package:farm_tpf/utils/formatter.dart'; | |||
| import 'package:intl/intl.dart'; | |||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||
| import '../util_action.dart'; | |||
| @@ -39,6 +38,7 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| final changeUnit = Get.put(ChangeUnit()); | |||
| final changeButton = Get.put(ChangeButtonInForm()); | |||
| final changeSelectedDevice = Get.put(ChangeDevice()); | |||
| final changeFormField = Get.put(ChangeFieldFormSupply()); | |||
| @override | |||
| void initState() { | |||
| @@ -48,6 +48,7 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| changeSupplyUsing.init(widget.currentItems); | |||
| changeUnit.initValue(); | |||
| changeButton.resetValue(); | |||
| changeFormField.init(); | |||
| } | |||
| Widget _buildListSupply() { | |||
| @@ -179,6 +180,7 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| var result = value as Supply; | |||
| changeSelectedSupply.change(result); | |||
| changeUnit.updateListByUnitName(result.unit); | |||
| changeFormField.change(true); | |||
| } | |||
| }); | |||
| }, | |||
| @@ -221,6 +223,7 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| if (value != null) { | |||
| var result = value as Device; | |||
| changeSelectedDevice.change(result); | |||
| changeFormField.change(true); | |||
| } | |||
| }); | |||
| }, | |||
| @@ -281,7 +284,20 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| _quantityField() { | |||
| 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() { | |||
| @@ -407,6 +423,19 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| controller: _dosageController, | |||
| decoration: InputDecoration(labelText: "Liều lượng sử dụng"), | |||
| 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( | |||
| mainAxisSize: MainAxisSize.min, | |||
| @@ -443,6 +472,18 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| controller: _howToUseController, | |||
| decoration: InputDecoration(labelText: "Phương pháp sử dụng"), | |||
| 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() | |||
| ], | |||
| @@ -77,7 +77,7 @@ class _PlotInformationScreenState extends State<PlotInformationScreen> { | |||
| _timeEndGrowController.text = _crop.endDate.format_DDMMYY_HHmm(); | |||
| _descriptionController.text = | |||
| _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; | |||
| }, (err) {}); | |||
| } | |||
| @@ -2,7 +2,7 @@ name: farm_tpf | |||
| description: A new Flutter project. | |||
| publish_to: 'none' | |||
| version: 0.11.0+1 | |||
| version: 0.12.0+1 | |||
| environment: | |||
| sdk: ">=2.7.0 <3.0.0" | |||