Browse Source

ui action harvest process

master
daivph 5 years ago
parent
commit
ffe0333e7e
5 changed files with 446 additions and 387 deletions
  1. +6
    -7
      lib/presentation/screens/actions/dung/widget_dung_supply.dart
  2. +201
    -163
      lib/presentation/screens/actions/harvest_process/sc_edit_action_harvest_process.dart
  3. +224
    -209
      lib/presentation/screens/actions/harvest_process/widget_harvest_process_supply.dart
  4. +9
    -2
      lib/presentation/screens/actions/plant/widget_plant_supply.dart
  5. +6
    -6
      lib/presentation/screens/actions/spraying/widget_spraying_supply.dart

+ 6
- 7
lib/presentation/screens/actions/dung/widget_dung_supply.dart View File

@@ -586,18 +586,17 @@ class _WidgetDungSupplyState extends State<WidgetDungSupply> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Phân bón',
style: TextStyle(color: Colors.black54, fontSize: 14),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'Phân bón',
style: TextStyle(color: Colors.black54, fontSize: 14),
),
),
),
SizedBox(
height: 8.0,
),
_buildListSupply(),
SizedBox(
height: 8.0,

+ 201
- 163
lib/presentation/screens/actions/harvest_process/sc_edit_action_harvest_process.dart View File

@@ -5,9 +5,12 @@ import 'package:farm_tpf/custom_model/HarvestProcess.dart';
import 'package:farm_tpf/custom_model/SuppliesUsing.dart';
import 'package:farm_tpf/data/api/app_exception.dart';
import 'package:farm_tpf/data/repository/repository.dart';
import 'package:farm_tpf/presentation/custom_widgets/app_bar_widget.dart';
import 'package:farm_tpf/presentation/custom_widgets/bloc/media_helper_bloc.dart';
import 'package:farm_tpf/presentation/custom_widgets/button_widget.dart';
import 'package:farm_tpf/presentation/custom_widgets/widget_loading.dart';
import 'package:farm_tpf/presentation/custom_widgets/widget_media_picker.dart';
import 'package:farm_tpf/presentation/custom_widgets/widget_text_field_description.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';
@@ -219,7 +222,7 @@ class _EditActionHarvestProcessScreenState
)),
Icon(
Icons.date_range,
color: Colors.blue,
color: Colors.grey,
),
],
)));
@@ -266,14 +269,11 @@ class _EditActionHarvestProcessScreenState
}

Widget _descriptionField() {
return TextFormField(
keyboardType: TextInputType.text,
decoration: InputDecoration(labelText: "Ghi chú"),
controller: _descriptionController,
onSaved: (newValue) {
_harvestProcess.description = newValue;
},
);
return TextFieldDescriptionWidget(
controller: _descriptionController,
onSaved: (newValue) {
_harvestProcess.description = newValue;
});
}

Widget _executeByField() {
@@ -286,34 +286,6 @@ class _EditActionHarvestProcessScreenState
);
}

_actionAppBar() {
IconButton iconButton;
if (1 == 1) {
iconButton = IconButton(
icon: Icon(
Icons.done,
color: Colors.black,
),
onPressed: () {
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
if (Get.find<ChangeFieldFormSupply>().isChanged) {
Utils.showDialogConfirmSupply(onConfirm: () {
Get.back();
_validateInputs();
});
} else {
_validateInputs();
}
},
);
return <Widget>[iconButton];
}
return <Widget>[Container()];
}

@override
Widget build(BuildContext context) => KeyboardDismisser(
gestures: [
@@ -321,11 +293,22 @@ class _EditActionHarvestProcessScreenState
GestureType.onPanUpdateDownDirection,
],
child: Scaffold(
backgroundColor: Colors.white,
key: _scaffoldKey,
appBar: AppBar(
centerTitle: true,
title: Text(plot_action_harvest_process),
actions: _actionAppBar()),
appBar: AppBarWidget(
isBack: true,
action: InkWell(
child: Text(
'Huỷ',
style: TextStyle(
color: Colors.red, fontWeight: FontWeight.normal),
),
onTap: () {
if (Get.isSnackbarOpen) Get.back();
Get.back();
},
),
),
body: KeyboardDismisser(
child: MultiBlocProvider(
providers: [
@@ -345,133 +328,188 @@ class _EditActionHarvestProcessScreenState
child: Form(
key: _formKey,
autovalidate: _autoValidate,
child: SingleChildScrollView(
padding: EdgeInsets.all(8.0),
child: BlocConsumer<ActionDetailBloc, ActionDetailState>(
listener: (context, state) async {
if (state is ActionDetailFailure) {
LoadingDialog.hideLoadingDialog(context);
} else if (state is ActionDetailSuccess) {
LoadingDialog.hideLoadingDialog(context);
print(state.item);
_harvestProcess =
HarvestProcess.fromJson(state.item);
_harvestProcess.activityId = widget.activityId;
_l1Controller.text = _harvestProcess.quantityLv1
.formatNumtoStringDecimal();
_l2Controller.text = _harvestProcess.quantityLv2
.formatNumtoStringDecimal();
_l3Controller.text = _harvestProcess.quantityLv3
.formatNumtoStringDecimal();
_removedQuantityController.text = _harvestProcess
.removedQuantity
.formatNumtoStringDecimal();
_descriptionController.text =
_harvestProcess.description ?? "";
_executeByController.text =
_harvestProcess.executeBy;
child: SafeArea(
child: SingleChildScrollView(
child:
BlocConsumer<ActionDetailBloc, ActionDetailState>(
listener: (context, state) async {
if (state is ActionDetailFailure) {
LoadingDialog.hideLoadingDialog(context);
} else if (state is ActionDetailSuccess) {
LoadingDialog.hideLoadingDialog(context);
print(state.item);
_harvestProcess =
HarvestProcess.fromJson(state.item);
_harvestProcess.activityId = widget.activityId;
_l1Controller.text = _harvestProcess.quantityLv1
.formatNumtoStringDecimal();
_l2Controller.text = _harvestProcess.quantityLv2
.formatNumtoStringDecimal();
_l3Controller.text = _harvestProcess.quantityLv3
.formatNumtoStringDecimal();
_removedQuantityController.text = _harvestProcess
.removedQuantity
.formatNumtoStringDecimal();
_descriptionController.text =
_harvestProcess.description ?? "";
_executeByController.text =
_harvestProcess.executeBy;

//select harvest
getHarvestBloc.getHarvests((data) {
_harvests = data;
for (var item in _harvests) {
if (item.id == _harvestProcess.harvestId) {
harvestValue = item;
break;
//select harvest
getHarvestBloc.getHarvests((data) {
_harvests = data;
for (var item in _harvests) {
if (item.id == _harvestProcess.harvestId) {
harvestValue = item;
break;
}
}
}
}, (err) {});
}, (err) {});

executeTime = _harvestProcess.executeDate
.convertStringServerDateTimeToLocalDateTime();
executeTimeView =
executeTime.displayDateTime_DDMMYYYY_HHmm();
//Show media
if (Validators.stringNotNullOrEmpty(
_harvestProcess.media)) {
BlocProvider.of<MediaHelperBloc>(context).add(
ChangeListMedia(
items: UtilAction.convertFilePathToMedia(
_harvestProcess.media)));
executeTime = _harvestProcess.executeDate
.convertStringServerDateTimeToLocalDateTime();
executeTimeView =
executeTime.displayDateTime_DDMMYYYY_HHmm();
//Show media
if (Validators.stringNotNullOrEmpty(
_harvestProcess.media)) {
BlocProvider.of<MediaHelperBloc>(context).add(
ChangeListMedia(
items:
UtilAction.convertFilePathToMedia(
_harvestProcess.media)));
}
//list supply
suppliesUsing = _harvestProcess.suppliesUsing;
Get.find<ChangeSupplyUsing>()
.changeInitList(suppliesUsing);
} else if (state is ActionDetailInitial) {
} else if (state is ActionDetailLoading) {
LoadingDialog.showLoadingDialog(context);
}
//list supply
suppliesUsing = _harvestProcess.suppliesUsing;
Get.find<ChangeSupplyUsing>()
.changeInitList(suppliesUsing);
} else if (state is ActionDetailInitial) {
} else if (state is ActionDetailLoading) {
LoadingDialog.showLoadingDialog(context);
}
},
builder: (context, state) {
return Column(
children: <Widget>[
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54, fontSize: 13.0),
},
builder: (context, state) {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Text(
plot_action_harvest_process,
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 22),
),
SizedBox(
height: 8.0,
),
Container(
width: double.infinity,
child: Text(
"Ngày thực hiện *",
style: TextStyle(
color: Colors.black54,
fontSize: 13.0),
),
),
_btnExecuteTimePicker(),
SizedBox(
height: 8.0,
),
_dropdownHarvest(),
SizedBox(
height: 8.0,
),
_l1Field(),
SizedBox(
height: 8.0,
),
_l2Field(),
SizedBox(
height: 8.0,
),
_l3Field(),
SizedBox(
height: 8.0,
),
_removedQuantityField(),
SizedBox(
height: 8.0,
),
_descriptionField(),
SizedBox(
height: 8.0,
),
_executeByField(),
SizedBox(
height: 8.0,
),
],
),
),
),
_btnExecuteTimePicker(),
SizedBox(
height: 8.0,
),
_dropdownHarvest(),
SizedBox(
height: 8.0,
),
_l1Field(),
SizedBox(
height: 8.0,
),
_l2Field(),
SizedBox(
height: 8.0,
),
_l3Field(),
SizedBox(
height: 8.0,
),
_removedQuantityField(),
SizedBox(
height: 8.0,
),
_descriptionField(),
SizedBox(
height: 8.0,
),
_executeByField(),
SizedBox(
height: 8.0,
),
WidgetHarvestProcessSupply(
currentItems: [],
onChangeSupplies: (value) {
suppliesUsing = value;
}),
SizedBox(
height: 8.0,
),
BlocBuilder<MediaHelperBloc, MediaHelperState>(
builder: (context, state) {
if (state is MediaHelperSuccess) {
return WidgetMediaPicker(
currentItems: state.items,
onChangeFiles: (newPathFiles,
deletePathFiles) async {
Get.find<ChangeFileController>().change(
newPathFiles, deletePathFiles);
});
} else {
return Center(
child: CircularProgressIndicator());
}
}),
],
);
},
Container(
width: double.infinity,
height: 16,
color: Colors.grey[200],
),
WidgetHarvestProcessSupply(
currentItems: [],
onChangeSupplies: (value) {
suppliesUsing = value;
}),
SizedBox(
height: 8.0,
),
Container(
width: double.infinity,
height: 16,
color: Colors.grey[200],
),
BlocBuilder<MediaHelperBloc, MediaHelperState>(
builder: (context, state) {
if (state is MediaHelperSuccess) {
return WidgetMediaPicker(
currentItems: state.items,
onChangeFiles: (newPathFiles,
deletePathFiles) async {
Get.find<ChangeFileController>()
.change(newPathFiles,
deletePathFiles);
});
} else {
return Center(
child: CircularProgressIndicator());
}
}),
Padding(
padding: const EdgeInsets.all(8.0),
child: ButtonWidget(
title: 'CẬP NHẬT',
onPressed: () {
FocusScopeNode currentFocus =
FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
if (Get.find<ChangeFieldFormSupply>()
.isChanged) {
Utils.showDialogConfirmSupply(
onConfirm: () {
Get.back();
_validateInputs();
});
} else {
_validateInputs();
}
}),
),
],
);
},
),
),
)),
))));

+ 224
- 209
lib/presentation/screens/actions/harvest_process/widget_harvest_process_supply.dart View File

@@ -333,231 +333,236 @@ class _WidgetHarvestProcessSupplyState

_buttonInForm() {
return GetBuilder<ChangeButtonInForm>(builder: (_) {
return Align(
alignment: Alignment.centerRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_.isEdit
? OutlineButton(
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(8.0)),
child: Text("Huỷ"),
onPressed: () {
changeButton.resetValue();
_resetForm();
_hidenKeyboard(context);
})
: SizedBox(),
_.isEdit
? FlatButton(
color: AppColors.DEFAULT,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(8.0)),
onPressed: () {
if (_formSupplyKey.currentState.validate()) {
_formSupplyKey.currentState.save();
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_.isEdit
? OutlineButton(
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(8.0)),
child: Text("Huỷ"),
onPressed: () {
changeButton.resetValue();
_resetForm();
_hidenKeyboard(context);
})
: SizedBox(),
_.isEdit
? Expanded(
child: FlatButton(
onPressed: () {
if (_formSupplyKey.currentState.validate()) {
_formSupplyKey.currentState.save();
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
} else {
changeSelectedSupply.changeValid(true);
}
var currentSupply =
changeSelectedSupply.currentSupply;
var currentDevice =
changeSelectedDevice.currentDevice;
var currentQuantity =
_quantityController.text.parseDoubleThousand();
if (currentSupply.id != null &&
(currentQuantity ?? 0) > 0) {
var quantityWithCurrentSupplyUnit =
UtilAction.convertUnit(
inputValue: currentQuantity,
oldUnit: changeUnit.selectedUnit,
newUnit: changeSelectedSupply
.currentSupply.unit);
SuppliesUsing newSup = SuppliesUsing()
..dosage = _dosageController.text
..howToUse = _howToUseController.text
..quantity = quantityWithCurrentSupplyUnit
..tbSuppliesInWarehouseId = currentSupply.id
..suppliesInWarehouseId = currentSupply.id
..supplyName = currentSupply.tbSuppliesName
..tbEquipmentOfCustomerId = currentDevice.id
..equipmentOfCustomerId = currentDevice.id
..equipmentName = currentDevice.name
..supplyUnit = currentSupply.unit
..unit = currentSupply.unit;
changeSupplyUsing.editSupply(
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");
}
} else {
changeSelectedSupply.changeValid(true);
}
var currentSupply = changeSelectedSupply.currentSupply;
var currentDevice = changeSelectedDevice.currentDevice;
var currentQuantity =
_quantityController.text.parseDoubleThousand();
if (currentSupply.id != null &&
(currentQuantity ?? 0) > 0) {
var quantityWithCurrentSupplyUnit =
UtilAction.convertUnit(
inputValue: currentQuantity,
oldUnit: changeUnit.selectedUnit,
newUnit:
changeSelectedSupply.currentSupply.unit);
SuppliesUsing newSup = SuppliesUsing()
..dosage = _dosageController.text
..howToUse = _howToUseController.text
..quantity = quantityWithCurrentSupplyUnit
..tbSuppliesInWarehouseId = currentSupply.id
..suppliesInWarehouseId = currentSupply.id
..supplyName = currentSupply.tbSuppliesName
..tbEquipmentOfCustomerId = currentDevice.id
..equipmentOfCustomerId = currentDevice.id
..equipmentName = currentDevice.name
..supplyUnit = currentSupply.unit
..unit = currentSupply.unit;
changeSupplyUsing.editSupply(
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");
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
} else {
changeSelectedSupply.changeValid(true);
}
}
} else {
Utils.showSnackBarWarning(
message: "Vui lòng nhập vật tư và số lượng");
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
} else {
changeSelectedSupply.changeValid(true);
}
}
},
child: Text(
"Sửa",
style: TextStyle(color: Colors.white),
))
: FlatButton(
color: AppColors.DEFAULT,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(8.0)),
onPressed: () {
if (_formSupplyKey.currentState.validate()) {
_formSupplyKey.currentState.save();
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
},
child: Text(
"Sửa hoá chất xử lý",
style: TextStyle(color: Colors.blue),
)),
)
: Expanded(
child: FlatButton(
onPressed: () {
if (_formSupplyKey.currentState.validate()) {
_formSupplyKey.currentState.save();
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
} else {
changeSelectedSupply.changeValid(true);
}
var currentSupply =
changeSelectedSupply.currentSupply;
var currentDevice =
changeSelectedDevice.currentDevice;
var currentQuantity =
_quantityController.text.parseDoubleThousand();
if (currentSupply.id != null &&
(currentQuantity ?? 0) > 0) {
var quantityWithCurrentSupplyUnit =
UtilAction.convertUnit(
inputValue: currentQuantity,
oldUnit: changeUnit.selectedUnit,
newUnit: changeSelectedSupply
.currentSupply.unit);
SuppliesUsing newSup = SuppliesUsing()
..dosage = _dosageController.text
..howToUse = _howToUseController.text
..quantity = quantityWithCurrentSupplyUnit
..tbSuppliesInWarehouseId = currentSupply.id
..suppliesInWarehouseId = currentSupply.id
..supplyName = currentSupply.tbSuppliesName
..supplyUnit = currentSupply.unit
..tbEquipmentOfCustomerId = currentDevice.id
..equipmentOfCustomerId = currentDevice.id
..equipmentName = currentDevice.name
..unit = currentSupply.unit;
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");
}
} else {
changeSelectedSupply.changeValid(true);
}
var currentSupply = changeSelectedSupply.currentSupply;
var currentDevice = changeSelectedDevice.currentDevice;
var currentQuantity =
_quantityController.text.parseDoubleThousand();
if (currentSupply.id != null &&
(currentQuantity ?? 0) > 0) {
var quantityWithCurrentSupplyUnit =
UtilAction.convertUnit(
inputValue: currentQuantity,
oldUnit: changeUnit.selectedUnit,
newUnit:
changeSelectedSupply.currentSupply.unit);
SuppliesUsing newSup = SuppliesUsing()
..dosage = _dosageController.text
..howToUse = _howToUseController.text
..quantity = quantityWithCurrentSupplyUnit
..tbSuppliesInWarehouseId = currentSupply.id
..suppliesInWarehouseId = currentSupply.id
..supplyName = currentSupply.tbSuppliesName
..supplyUnit = currentSupply.unit
..tbEquipmentOfCustomerId = currentDevice.id
..equipmentOfCustomerId = currentDevice.id
..equipmentName = currentDevice.name
..unit = currentSupply.unit;
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");
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
} else {
changeSelectedSupply.changeValid(true);
}
}
} else {
Utils.showSnackBarWarning(
message: "Vui lòng nhập vật tư và số lượng");
if (changeSelectedSupply.selectedSupplyId <= 0) {
changeSelectedSupply.changeValid(false);
} else {
changeSelectedSupply.changeValid(true);
}
}
},
child: Text(
"Thêm",
style: TextStyle(color: Colors.white),
))
],
),
},
child: Text(
"+ Thêm hoá chất xử lý",
style: TextStyle(color: Colors.blue),
)),
)
],
);
});
}

Widget _formEdit() {
return Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10),
color: Colors.white,
border: Border.all(color: AppColors.DEFAULT)),
child: Form(
key: _formSupplyKey,
child: Column(
children: [
_btnSelectSubstrates(),
TextFormField(
keyboardType: TextInputType.text,
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,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 2,
child: Container(
height: 70,
child: _quantityField(),
return Form(
key: _formSupplyKey,
child: Column(
children: [
Container(
padding: EdgeInsets.all(8.0),
margin: EdgeInsets.all(8.0),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10),
color: Colors.white,
border: Border.all(color: Colors.grey[300])),
child: Column(
children: [
_btnSelectSubstrates(),
TextFormField(
keyboardType: TextInputType.text,
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,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 2,
child: Container(
height: 82,
child: _quantityField(),
),
),
),
SizedBox(
width: 16.0,
),
Expanded(
flex: 1,
child: Align(
alignment: Alignment.bottomCenter,
child: _dropdownUnitTypes(),
)),
]),
Container(
width: double.infinity,
child: Text(
"Thiết bị",
style: TextStyle(color: Colors.black54, fontSize: 13.0),
SizedBox(
width: 16.0,
),
Expanded(
flex: 1,
child: Align(
alignment: Alignment.bottomCenter,
child: _dropdownUnitTypes(),
)),
]),
Container(
width: double.infinity,
child: Text(
"Thiết bị",
style: TextStyle(color: Colors.black54, fontSize: 13.0),
),
),
),
_btnSelectDevice(),
TextFormField(
keyboardType: TextInputType.text,
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()
],
_btnSelectDevice(),
TextFormField(
keyboardType: TextInputType.text,
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()
],
),
);
}

_resetForm() {
@@ -583,6 +588,16 @@ class _WidgetHarvestProcessSupplyState
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'Hóa chất xử lý',
style: TextStyle(color: Colors.black54, fontSize: 14),
),
),
),
_buildListSupply(),
SizedBox(
height: 8.0,

+ 9
- 2
lib/presentation/screens/actions/plant/widget_plant_supply.dart View File

@@ -401,8 +401,15 @@ class _WidgetPlantSupplyState extends State<WidgetPlantSupply> {
Widget build(BuildContext context) {
return Column(
children: [
SizedBox(
height: 8.0,
Padding(
padding: const EdgeInsets.all(8.0),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'Hoá chất xử lý',
style: TextStyle(color: Colors.black54, fontSize: 14),
),
),
),
_buildListSupply(),
SizedBox(

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

@@ -589,14 +589,14 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> {
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Thuốc BVTV',
style: TextStyle(color: Colors.black54, fontSize: 14),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'Thuốc BVTV',
style: TextStyle(color: Colors.black54, fontSize: 14),
),
),
),
SizedBox(
height: 8.0,
),
_buildListSupply(),
SizedBox(
height: 8.0,

Loading…
Cancel
Save