Browse Source

fix bug #7797, #7886

master
daivph 5 years ago
parent
commit
ac3df45fdc
16 changed files with 204 additions and 25 deletions
  1. +1
    -1
      ios/Flutter/.last_build_id
  2. +3
    -3
      ios/Runner.xcodeproj/project.pbxproj
  3. +4
    -1
      lib/presentation/custom_widgets/widget_text_form_field.dart
  4. +0
    -3
      lib/presentation/custom_widgets/widget_utils.dart
  5. +14
    -0
      lib/presentation/screens/actions/controller/ChangeFieldInForm.dart
  6. +2
    -1
      lib/presentation/screens/actions/dung/sc_edit_action_dung.dart
  7. +44
    -1
      lib/presentation/screens/actions/dung/widget_dung_supply.dart
  8. +2
    -1
      lib/presentation/screens/actions/harvest_process/sc_edit_action_harvest_process.dart
  9. +44
    -3
      lib/presentation/screens/actions/harvest_process/widget_harvest_process_supply.dart
  10. +14
    -1
      lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart
  11. +2
    -1
      lib/presentation/screens/actions/plant/sc_edit_action_plant.dart
  12. +26
    -3
      lib/presentation/screens/actions/plant/widget_plant_supply.dart
  13. +2
    -1
      lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart
  14. +44
    -3
      lib/presentation/screens/actions/spraying/widget_spraying_supply.dart
  15. +1
    -1
      lib/presentation/screens/plot_detail/sc_plot_information.dart
  16. +1
    -1
      pubspec.yaml

+ 1
- 1
ios/Flutter/.last_build_id View File

5729eb498eaeb9c64784fcfc80bbb33b
440505e9ea1eee7043d2cbfeb318f6bc

+ 3
- 3
ios/Runner.xcodeproj/project.pbxproj View File

"$(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";

+ 4
- 1
lib/presentation/custom_widgets/widget_text_form_field.dart View File

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,
); );
} }
} }

+ 0
- 3
lib/presentation/custom_widgets/widget_utils.dart View File

textCancel: textCancel, textCancel: textCancel,
confirmTextColor: Colors.white, confirmTextColor: Colors.white,
onConfirm: onConfirm, onConfirm: onConfirm,
onCancel: () {
Get.back();
},
); );
} }



+ 14
- 0
lib/presentation/screens/actions/controller/ChangeFieldInForm.dart View File

import 'package:get/get.dart';

class ChangeFieldFormSupply extends GetxController {
bool isChanged;
void init() {
isChanged = false;
update();
}

void change(bool changed) {
isChanged = changed;
update();
}
}

+ 2
- 1
lib/presentation/screens/actions/dung/sc_edit_action_dung.dart View File

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();

+ 44
- 1
lib/presentation/screens/actions/dung/widget_dung_supply.dart View File

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()
], ],

+ 2
- 1
lib/presentation/screens/actions/harvest_process/sc_edit_action_harvest_process.dart View File

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();

+ 44
- 3
lib/presentation/screens/actions/harvest_process/widget_harvest_process_supply.dart View File

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()
], ],

+ 14
- 1
lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart View File

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];

+ 2
- 1
lib/presentation/screens/actions/plant/sc_edit_action_plant.dart View File

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();

+ 26
- 3
lib/presentation/screens/actions/plant/widget_plant_supply.dart View File

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,

+ 2
- 1
lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart View File

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();

+ 44
- 3
lib/presentation/screens/actions/spraying/widget_spraying_supply.dart View File

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()
], ],

+ 1
- 1
lib/presentation/screens/plot_detail/sc_plot_information.dart View File

_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) {});
} }

+ 1
- 1
pubspec.yaml View File

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"

Loading…
Cancel
Save