Browse Source

ui action spraying

master
daivph 5 years ago
parent
commit
ed94854499
3 changed files with 430 additions and 368 deletions
  1. +8
    -0
      lib/presentation/screens/actions/dung/widget_dung_supply.dart
  2. +199
    -161
      lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart
  3. +223
    -207
      lib/presentation/screens/actions/spraying/widget_spraying_supply.dart

+ 8
- 0
lib/presentation/screens/actions/dung/widget_dung_supply.dart View File

@@ -586,7 +586,15 @@ 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),
),
),
SizedBox(
height: 8.0,
),

+ 199
- 161
lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart View File

@@ -4,9 +4,12 @@ import 'package:farm_tpf/custom_model/Spraying.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';
@@ -164,7 +167,7 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
)),
Icon(
Icons.date_range,
color: Colors.blue,
color: Colors.grey,
),
],
)));
@@ -204,7 +207,7 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
)),
Icon(
Icons.date_range,
color: Colors.blue,
color: Colors.grey,
),
],
)));
@@ -243,9 +246,7 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
}

Widget _desciptionField() {
return TextFormField(
keyboardType: TextInputType.text,
decoration: InputDecoration(labelText: "Ghi chú"),
return TextFieldDescriptionWidget(
controller: _descriptionController,
onSaved: (newValue) {
_spraying.description = newValue;
@@ -263,34 +264,6 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
);
}

_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: [
@@ -298,11 +271,22 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
GestureType.onPanUpdateDownDirection,
],
child: Scaffold(
backgroundColor: Colors.white,
key: _scaffoldKey,
appBar: AppBar(
centerTitle: true,
title: Text(plot_action_spraying),
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: [
@@ -321,136 +305,190 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> {
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);
_spraying = Spraying.fromJson(state.item);
_spraying.activityId = widget.activityId;
_purposeController.text =
_spraying.purpose ?? "";
_quarantinePeriodController.text = _spraying
.quarantinePeriod
.formatNumtoStringDecimal();
_weatherController.text =
_spraying.weatherConditions ?? "";
_descriptionController.text =
_spraying.description;
_executeByController.text =
_spraying.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);
_spraying = Spraying.fromJson(state.item);
_spraying.activityId = widget.activityId;
_purposeController.text =
_spraying.purpose ?? "";
_quarantinePeriodController.text = _spraying
.quarantinePeriod
.formatNumtoStringDecimal();
_weatherController.text =
_spraying.weatherConditions ?? "";
_descriptionController.text =
_spraying.description;
_executeByController.text =
_spraying.executeBy;

executeTime = _spraying.executeDate
.convertStringServerDateTimeToLocalDateTime();
executeTimeView = executeTime
.displayDateTime_DDMMYYYY_HHmm();
executeTime = _spraying.executeDate
.convertStringServerDateTimeToLocalDateTime();
executeTimeView = executeTime
.displayDateTime_DDMMYYYY_HHmm();

resultAtTime = _spraying.resultAt
.convertStringServerDateTimeToLocalDateTime();
resultAtView = resultAtTime
.displayDateTime_DDMMYYYY_HHmm();
resultAtTime = _spraying.resultAt
.convertStringServerDateTimeToLocalDateTime();
resultAtView = resultAtTime
.displayDateTime_DDMMYYYY_HHmm();

//Show media
if (Validators.stringNotNullOrEmpty(
_spraying.media)) {
BlocProvider.of<MediaHelperBloc>(context)
.add(ChangeListMedia(
items: UtilAction
.convertFilePathToMedia(
_spraying.media)));
//Show media
if (Validators.stringNotNullOrEmpty(
_spraying.media)) {
BlocProvider.of<MediaHelperBloc>(context)
.add(ChangeListMedia(
items: UtilAction
.convertFilePathToMedia(
_spraying.media)));
}
//list supply
suppliesUsing = _spraying.suppliesUsing;
Get.find<ChangeSupplyUsing>()
.changeInitList(suppliesUsing);
} else if (state is ActionDetailInitial) {
print("init");
} else if (state is ActionDetailLoading) {
print("loading");
LoadingDialog.showLoadingDialog(context);
}
//list supply
suppliesUsing = _spraying.suppliesUsing;
Get.find<ChangeSupplyUsing>()
.changeInitList(suppliesUsing);
} else if (state is ActionDetailInitial) {
print("init");
} else if (state is ActionDetailLoading) {
print("loading");
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_spraying,
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,
),
_purposeField(),
SizedBox(
height: 8.0,
),
_quarantinePeriodField(),
SizedBox(
height: 8.0,
),
Container(
width: double.infinity,
child: Text(
"Thời gian ghi nhận kết quả",
style: TextStyle(
color: Colors.black54,
fontSize: 13.0),
),
),
_btnResultAtTimePicker(),
SizedBox(
height: 8.0,
),
_weatherField(),
SizedBox(
height: 8.0,
),
_desciptionField(),
SizedBox(
height: 8.0,
),
_executeByField(),
SizedBox(
height: 8.0,
),
],
),
),
Container(
width: double.infinity,
height: 16,
color: Colors.grey[200],
),
WidgetSprayingSupply(
currentItems: [],
onChangeSupplies: (value) {
suppliesUsing = value;
}),
Container(
width: double.infinity,
height: 16,
color: Colors.grey[200],
),
SizedBox(
height: 8.0,
),
),
_btnExecuteTimePicker(),
SizedBox(
height: 8.0,
),
_purposeField(),
SizedBox(
height: 8.0,
),
_quarantinePeriodField(),
SizedBox(
height: 8.0,
),
Container(
width: double.infinity,
child: Text(
"Thời gian ghi nhận kết quả",
style: TextStyle(
color: Colors.black54,
fontSize: 13.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());
}
}),
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();
}
}),
),
),
_btnResultAtTimePicker(),
SizedBox(
height: 8.0,
),
_weatherField(),
SizedBox(
height: 8.0,
),
_desciptionField(),
SizedBox(
height: 8.0,
),
_executeByField(),
SizedBox(
height: 8.0,
),
WidgetSprayingSupply(
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());
}
}),
],
);
},
],
);
},
),
),
))))));
@override

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

@@ -331,142 +331,141 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> {

_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 thuốc BVTV",
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 thuốc BVTV",
style: TextStyle(color: Colors.blue),
)),
)
],
);
});
}
@@ -474,87 +473,93 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> {
Widget _formEdit() {
return Form(
key: _formSupplyKey,
child: 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: 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(),
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()
],
),
);
}

@@ -580,7 +585,18 @@ class _WidgetSprayingSupplyState extends State<WidgetSprayingSupply> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Thuốc BVTV',
style: TextStyle(color: Colors.black54, fontSize: 14),
),
),
SizedBox(
height: 8.0,
),
_buildListSupply(),
SizedBox(
height: 8.0,

Loading…
Cancel
Save