|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_statusController.text = statusCrop; |
|
|
_statusController.text = statusCrop; |
|
|
_houseNameController.text = _crop.netHouseName.toString(); |
|
|
|
|
|
_codeController.text = _crop.code.toString(); |
|
|
|
|
|
_supplyNameController.text = _crop.suppliesName.toString(); |
|
|
|
|
|
|
|
|
_houseNameController.text = _crop.netHouseName?.toString(); |
|
|
|
|
|
_codeController.text = _crop.code?.toString(); |
|
|
|
|
|
_supplyNameController.text = _crop.suppliesName?.toString(); |
|
|
_areaController.text = _crop.areaM2.formatNumtoStringDecimal(); |
|
|
_areaController.text = _crop.areaM2.formatNumtoStringDecimal(); |
|
|
|
|
|
_seedingDateController.text = result.sowingDate.format_DDMMYY_HHmm(); |
|
|
|
|
|
_timeSoakSeedController.text = |
|
|
|
|
|
result.soakSeedsTime.formatNumtoStringDecimal(); |
|
|
|
|
|
_timeNurserySeedController.text = |
|
|
|
|
|
result.soakSeedsTime.formatNumtoStringDecimal(); |
|
|
|
|
|
_quantityPlantController.text = |
|
|
|
|
|
result.numberPlants.formatNumtoStringDecimal(); |
|
|
|
|
|
_currentPlantController.text = |
|
|
|
|
|
result.numberCurrentPlants.formatNumtoStringDecimal(); |
|
|
|
|
|
_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(","); |
|
|
|
|
|
_mainTechnicianController.text = technicians; |
|
|
}, (err) {}); |
|
|
}, (err) {}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LoadingDialog.hideLoadingDialog(context); |
|
|
LoadingDialog.hideLoadingDialog(context); |
|
|
flutterToast.showToast( |
|
|
flutterToast.showToast( |
|
|
child: WidgetToast(message: label_update_success)); |
|
|
child: WidgetToast(message: label_update_success)); |
|
|
|
|
|
controller.initValue(); |
|
|
}).catchError((error) { |
|
|
}).catchError((error) { |
|
|
_scaffoldKey.currentState.showSnackBar(SnackBar( |
|
|
_scaffoldKey.currentState.showSnackBar(SnackBar( |
|
|
content: Row( |
|
|
content: Row( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _statusField() { |
|
|
Widget _statusField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _statusController, |
|
|
controller: _statusController, |
|
|
decoration: InputDecoration(labelText: "Trạng thái"), |
|
|
decoration: InputDecoration(labelText: "Trạng thái"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _houseNameField() { |
|
|
Widget _houseNameField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _houseNameController, |
|
|
controller: _houseNameController, |
|
|
decoration: InputDecoration(labelText: "Nhà màng"), |
|
|
decoration: InputDecoration(labelText: "Nhà màng"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _codeField() { |
|
|
Widget _codeField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _codeController, |
|
|
controller: _codeController, |
|
|
decoration: InputDecoration(labelText: "Mã lô"), |
|
|
decoration: InputDecoration(labelText: "Mã lô"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _supplyNameField() { |
|
|
Widget _supplyNameField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _supplyNameController, |
|
|
controller: _supplyNameController, |
|
|
decoration: InputDecoration(labelText: "Giống"), |
|
|
decoration: InputDecoration(labelText: "Giống"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _seedingDateField() { |
|
|
Widget _seedingDateField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _seedingDateController, |
|
|
controller: _seedingDateController, |
|
|
decoration: InputDecoration(labelText: "Ngày gieo trồng"), |
|
|
decoration: InputDecoration(labelText: "Ngày gieo trồng"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _timeSoakSeedField() { |
|
|
Widget _timeSoakSeedField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _timeSoakSeedController, |
|
|
controller: _timeSoakSeedController, |
|
|
decoration: InputDecoration(labelText: "Thời gian ngâm hạt"), |
|
|
decoration: InputDecoration(labelText: "Thời gian ngâm hạt"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _timeNurserySeedField() { |
|
|
Widget _timeNurserySeedField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _timeNurserySeedController, |
|
|
controller: _timeNurserySeedController, |
|
|
decoration: InputDecoration(labelText: "Thời gian vô khây ươm"), |
|
|
decoration: InputDecoration(labelText: "Thời gian vô khây ươm"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _quantityPlantField() { |
|
|
Widget _quantityPlantField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _quantityPlantController, |
|
|
controller: _quantityPlantController, |
|
|
decoration: InputDecoration(labelText: "Số lượng cây trồng"), |
|
|
decoration: InputDecoration(labelText: "Số lượng cây trồng"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _currentPlantField() { |
|
|
Widget _currentPlantField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _currentPlantController, |
|
|
controller: _currentPlantController, |
|
|
decoration: InputDecoration(labelText: "Số lượng cây hiện tại"), |
|
|
decoration: InputDecoration(labelText: "Số lượng cây hiện tại"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _timeEndGrowField() { |
|
|
Widget _timeEndGrowField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _timeEndGrowController, |
|
|
controller: _timeEndGrowController, |
|
|
decoration: InputDecoration(labelText: "Ngày kết thúc canh tác"), |
|
|
decoration: InputDecoration(labelText: "Ngày kết thúc canh tác"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _mainTechnicianField() { |
|
|
Widget _mainTechnicianField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _mainTechnicianController, |
|
|
controller: _mainTechnicianController, |
|
|
decoration: InputDecoration(labelText: "Kỹ sư trực tiếp"), |
|
|
decoration: InputDecoration(labelText: "Kỹ sư trực tiếp"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _areaField() { |
|
|
Widget _areaField() { |
|
|
return TextFormField( |
|
|
return TextFormField( |
|
|
|
|
|
enabled: false, |
|
|
controller: _areaController, |
|
|
controller: _areaController, |
|
|
decoration: InputDecoration(labelText: "Diện tích (m\u00B2)"), |
|
|
decoration: InputDecoration(labelText: "Diện tích (m\u00B2)"), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
return LoadingListPage(); |
|
|
return LoadingListPage(); |
|
|
} |
|
|
} |
|
|
})))))); |
|
|
})))))); |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
void dispose() { |
|
|
|
|
|
_statusController.dispose(); |
|
|
|
|
|
_houseNameController.dispose(); |
|
|
|
|
|
_codeController.dispose(); |
|
|
|
|
|
_supplyNameController.dispose(); |
|
|
|
|
|
_seedingDateController.dispose(); |
|
|
|
|
|
_timeSoakSeedController.dispose(); |
|
|
|
|
|
_timeNurserySeedController.dispose(); |
|
|
|
|
|
_quantityPlantController.dispose(); |
|
|
|
|
|
_currentPlantController.dispose(); |
|
|
|
|
|
_timeEndGrowController.dispose(); |
|
|
|
|
|
_mainTechnicianController.dispose(); |
|
|
|
|
|
_areaController.dispose(); |
|
|
|
|
|
_descriptionController.dispose(); |
|
|
|
|
|
super.dispose(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class DescriptionChangeControler extends GetxController { |
|
|
class DescriptionChangeControler extends GetxController { |
|
|
bool isChanged = false; |
|
|
bool isChanged = false; |
|
|
|
|
|
|
|
|
|
|
|
void initValue() { |
|
|
|
|
|
isChanged = false; |
|
|
|
|
|
update(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void changeValue(String oldValue, String newValue) { |
|
|
void changeValue(String oldValue, String newValue) { |
|
|
if (oldValue != newValue) { |
|
|
if (oldValue != newValue) { |
|
|
isChanged = true; |
|
|
isChanged = true; |
|
|
} else { |
|
|
} else { |
|
|
isChanged = false; |
|
|
isChanged = false; |
|
|
} |
|
|
} |
|
|
|
|
|
if (oldValue.isNullOrBlank && newValue.isEmpty) { |
|
|
|
|
|
isChanged = false; |
|
|
|
|
|
} |
|
|
update(); |
|
|
update(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |