| @@ -1 +1 @@ | |||
| 5729eb498eaeb9c64784fcfc80bbb33b | |||
| 440505e9ea1eee7043d2cbfeb318f6bc | |||
| @@ -2,6 +2,7 @@ import 'package:farm_tpf/custom_model/Device.dart'; | |||
| 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/custom_widgets/widget_utils.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'; | |||
| @@ -330,7 +331,8 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| var currentDevice = changeSelectedDevice.currentDevice; | |||
| var currentQuantity = | |||
| _quantityController.text.parseDoubleThousand(); | |||
| if (currentSupply.id != null && currentQuantity > 0) { | |||
| if (currentSupply.id != null && | |||
| (currentQuantity ?? 0) > 0) { | |||
| var quantityWithCurrentSupplyUnit = | |||
| UtilAction.convertUnit( | |||
| inputValue: currentQuantity, | |||
| @@ -353,6 +355,10 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| changeSupplyUsing.currentIndex, newSup); | |||
| _resetForm(); | |||
| _hidenKeyboard(context); | |||
| } else if (currentSupply.id == null || | |||
| ((currentQuantity ?? 0) <= 0)) { | |||
| Utils.showSnackBarWarning( | |||
| message: "Vui lòng nhập vật tư và số lượng"); | |||
| } | |||
| }, | |||
| child: Text( | |||
| @@ -368,7 +374,8 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| var currentDevice = changeSelectedDevice.currentDevice; | |||
| var currentQuantity = | |||
| _quantityController.text.parseDoubleThousand(); | |||
| if (currentSupply.id != null && currentQuantity > 0) { | |||
| if (currentSupply.id != null && | |||
| (currentQuantity ?? 0) > 0) { | |||
| var quantityWithCurrentSupplyUnit = | |||
| UtilAction.convertUnit( | |||
| inputValue: currentQuantity, | |||
| @@ -390,6 +397,10 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| changeSupplyUsing.addSupply(newSup); | |||
| _resetForm(); | |||
| _hidenKeyboard(context); | |||
| } else if (currentSupply.id == null || | |||
| ((currentQuantity ?? 0) <= 0)) { | |||
| Utils.showSnackBarWarning( | |||
| message: "Vui lòng nhập vật tư và số lượng"); | |||
| } | |||
| }, | |||
| child: Text( | |||
| @@ -501,6 +512,7 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> { | |||
| changeUnit.initValue(); | |||
| changeSelectedSupply.initValue(); | |||
| changeSelectedDevice.initValue(); | |||
| changeFormField.change(false); | |||
| } | |||
| _hidenKeyboard(BuildContext context) { | |||
| @@ -2,6 +2,7 @@ import 'package:farm_tpf/custom_model/Device.dart'; | |||
| 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/custom_widgets/widget_utils.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'; | |||
| @@ -330,7 +331,8 @@ class _WidgetHarvestProcessSupplyState | |||
| var currentDevice = changeSelectedDevice.currentDevice; | |||
| var currentQuantity = | |||
| _quantityController.text.parseDoubleThousand(); | |||
| if (currentSupply.id != null && currentQuantity > 0) { | |||
| if (currentSupply.id != null && | |||
| (currentQuantity ?? 0) > 0) { | |||
| var quantityWithCurrentSupplyUnit = | |||
| UtilAction.convertUnit( | |||
| inputValue: currentQuantity, | |||
| @@ -353,6 +355,10 @@ class _WidgetHarvestProcessSupplyState | |||
| changeSupplyUsing.currentIndex, newSup); | |||
| _resetForm(); | |||
| _hidenKeyboard(context); | |||
| } else if (currentSupply.id == null || | |||
| ((currentQuantity ?? 0) <= 0)) { | |||
| Utils.showSnackBarWarning( | |||
| message: "Vui lòng nhập vật tư và số lượng"); | |||
| } | |||
| }, | |||
| child: Text( | |||
| @@ -368,7 +374,8 @@ class _WidgetHarvestProcessSupplyState | |||
| var currentDevice = changeSelectedDevice.currentDevice; | |||
| var currentQuantity = | |||
| _quantityController.text.parseDoubleThousand(); | |||
| if (currentSupply.id != null && currentQuantity > 0) { | |||
| if (currentSupply.id != null && | |||
| (currentQuantity ?? 0) > 0) { | |||
| var quantityWithCurrentSupplyUnit = | |||
| UtilAction.convertUnit( | |||
| inputValue: currentQuantity, | |||
| @@ -390,6 +397,10 @@ class _WidgetHarvestProcessSupplyState | |||
| changeSupplyUsing.addSupply(newSup); | |||
| _resetForm(); | |||
| _hidenKeyboard(context); | |||
| } else if (currentSupply.id == null || | |||
| ((currentQuantity ?? 0) <= 0)) { | |||
| Utils.showSnackBarWarning( | |||
| message: "Vui lòng nhập vật tư và số lượng"); | |||
| } | |||
| }, | |||
| child: Text( | |||
| @@ -501,6 +512,7 @@ class _WidgetHarvestProcessSupplyState | |||
| changeUnit.initValue(); | |||
| changeSelectedSupply.initValue(); | |||
| changeSelectedDevice.initValue(); | |||
| changeFormField.change(false); | |||
| } | |||
| _hidenKeyboard(BuildContext context) { | |||
| @@ -384,6 +384,7 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> { | |||
| _quantityController.text = ""; | |||
| changeUnit.initValue(); | |||
| changeSelectedSupply.initValue(); | |||
| changeFormField.change(false); | |||
| } | |||
| _hidenKeyboard(BuildContext context) { | |||
| @@ -2,6 +2,7 @@ import 'package:farm_tpf/custom_model/Device.dart'; | |||
| 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/custom_widgets/widget_utils.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'; | |||
| @@ -328,7 +329,8 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| var currentDevice = changeSelectedDevice.currentDevice; | |||
| var currentQuantity = | |||
| _quantityController.text.parseDoubleThousand(); | |||
| if (currentSupply.id != null && currentQuantity > 0) { | |||
| if (currentSupply.id != null && | |||
| (currentQuantity ?? 0) > 0) { | |||
| var quantityWithCurrentSupplyUnit = | |||
| UtilAction.convertUnit( | |||
| inputValue: currentQuantity, | |||
| @@ -351,6 +353,10 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| changeSupplyUsing.currentIndex, newSup); | |||
| _resetForm(); | |||
| _hidenKeyboard(context); | |||
| } else if (currentSupply.id == null || | |||
| ((currentQuantity ?? 0) <= 0)) { | |||
| Utils.showSnackBarWarning( | |||
| message: "Vui lòng nhập vật tư và số lượng"); | |||
| } | |||
| }, | |||
| child: Text( | |||
| @@ -366,7 +372,8 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| var currentDevice = changeSelectedDevice.currentDevice; | |||
| var currentQuantity = | |||
| _quantityController.text.parseDoubleThousand(); | |||
| if (currentSupply.id != null && currentQuantity > 0) { | |||
| if (currentSupply.id != null && | |||
| (currentQuantity ?? 0) > 0) { | |||
| var quantityWithCurrentSupplyUnit = | |||
| UtilAction.convertUnit( | |||
| inputValue: currentQuantity, | |||
| @@ -388,6 +395,10 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| changeSupplyUsing.addSupply(newSup); | |||
| _resetForm(); | |||
| _hidenKeyboard(context); | |||
| } else if (currentSupply.id == null || | |||
| ((currentQuantity ?? 0) <= 0)) { | |||
| Utils.showSnackBarWarning( | |||
| message: "Vui lòng nhập vật tư và số lượng"); | |||
| } | |||
| }, | |||
| child: Text( | |||
| @@ -499,6 +510,7 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> { | |||
| changeUnit.initValue(); | |||
| changeSelectedSupply.initValue(); | |||
| changeSelectedDevice.initValue(); | |||
| changeFormField.change(false); | |||
| } | |||
| _hidenKeyboard(BuildContext context) { | |||