| @@ -1 +1 @@ | |||
| 48197743e3d78b3769f70bac9a76e7e0 | |||
| 440505e9ea1eee7043d2cbfeb318f6bc | |||
| @@ -5,6 +5,7 @@ import 'package:farm_tpf/custom_model/RequestGeneralModel.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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -56,7 +57,6 @@ class _EditActionCropStatusScreenState | |||
| TextEditingController _descriptionController = TextEditingController(); | |||
| final _executeByController = TextEditingController(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -71,10 +71,6 @@ class _EditActionCropStatusScreenState | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _cropStatus.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _cropStatus.cropId = widget.cropId; | |||
| } | |||
| @@ -157,39 +153,12 @@ class _EditActionCropStatusScreenState | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _cropStatus.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _cropStatus.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _cropRateField() { | |||
| @@ -384,13 +353,9 @@ class _EditActionCropStatusScreenState | |||
| _executeByController.text = | |||
| _cropStatus.executeBy ?? ""; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_cropStatus.executeDate); | |||
| } catch (_) {} | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| Get.find<ChangeDateTimePicker>().change(_cropStatus | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _cropStatus.media)) { | |||
| @@ -5,6 +5,7 @@ import 'package:farm_tpf/custom_model/RequestDisease.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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -55,7 +56,6 @@ class _EditActionDiseaseScreenState extends State<EditActionDiseaseScreen> { | |||
| TextEditingController _descriptionController = TextEditingController(); | |||
| final _executeByController = TextEditingController(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -70,10 +70,6 @@ class _EditActionDiseaseScreenState extends State<EditActionDiseaseScreen> { | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _disease.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _disease.cropId = widget.cropId; | |||
| } | |||
| @@ -150,39 +146,12 @@ class _EditActionDiseaseScreenState extends State<EditActionDiseaseScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _disease.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _disease.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _typeOfPestField() { | |||
| @@ -351,13 +320,9 @@ class _EditActionDiseaseScreenState extends State<EditActionDiseaseScreen> { | |||
| _disease.description ?? ""; | |||
| _executeByController.text = _disease.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_disease.executeDate); | |||
| } catch (_) {} | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| Get.find<ChangeDateTimePicker>().change(_disease | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _disease.media)) { | |||
| @@ -5,6 +5,7 @@ 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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -54,7 +55,6 @@ class _EditActionDungScreenState extends State<EditActionDungScreen> { | |||
| final _quarantinePeriodController = TextEditingController(); | |||
| List<SuppliesUsing> suppliesUsing = new List<SuppliesUsing>(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -70,10 +70,6 @@ class _EditActionDungScreenState extends State<EditActionDungScreen> { | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| _dung.suppliesUsing = new List<SuppliesUsing>(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _dung.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _dung.cropId = widget.cropId; | |||
| } | |||
| @@ -127,39 +123,12 @@ class _EditActionDungScreenState extends State<EditActionDungScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _dung.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _dung.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _purposeField() { | |||
| @@ -293,14 +262,9 @@ class _EditActionDungScreenState extends State<EditActionDungScreen> { | |||
| _descriptionController.text = | |||
| _dung.description; | |||
| _executeByController.text = _dung.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_dung.executeDate); | |||
| } catch (_) {} | |||
| executeTimeView = | |||
| DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| Get.find<ChangeDateTimePicker>().change(_dung | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _dung.media)) { | |||
| @@ -4,6 +4,7 @@ import 'package:farm_tpf/custom_model/End.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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_utils.dart'; | |||
| @@ -20,6 +21,7 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; | |||
| import 'package:get/get.dart'; | |||
| import 'package:intl/intl.dart'; | |||
| import 'package:keyboard_dismisser/keyboard_dismisser.dart'; | |||
| import 'package:farm_tpf/utils/formatter.dart'; | |||
| import '../util_action.dart'; | |||
| @@ -43,7 +45,6 @@ class _EditActionEndScreenState extends State<EditActionEndScreen> { | |||
| final _executeByController = TextEditingController(); | |||
| var pref = LocalPref(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -58,10 +59,6 @@ class _EditActionEndScreenState extends State<EditActionEndScreen> { | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _end.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _end.cropId = widget.cropId; | |||
| } | |||
| @@ -112,39 +109,12 @@ class _EditActionEndScreenState extends State<EditActionEndScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _end.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _end.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| _actionAppBar() { | |||
| @@ -233,13 +203,9 @@ class _EditActionEndScreenState extends State<EditActionEndScreen> { | |||
| _end.description ?? ""; | |||
| _executeByController.text = _end.createdByName; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_end.executeDate); | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| Get.find<ChangeDateTimePicker>().change(_end | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty(_end.media)) { | |||
| BlocProvider.of<MediaHelperBloc>(context).add( | |||
| @@ -5,6 +5,7 @@ import 'package:farm_tpf/custom_model/RequestEnvironment.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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -53,7 +54,6 @@ class _EditActionEnvironmentUpdateState | |||
| TextEditingController _llnController = TextEditingController(); | |||
| final _executeByController = TextEditingController(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -68,10 +68,6 @@ class _EditActionEnvironmentUpdateState | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _environment.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _environment.cropId = widget.cropId; | |||
| } | |||
| @@ -149,39 +145,12 @@ class _EditActionEnvironmentUpdateState | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _environment.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _environment.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _ecField() { | |||
| @@ -362,13 +331,9 @@ class _EditActionEnvironmentUpdateState | |||
| _environment.lln.formatStringToStringDecimal(); | |||
| _executeByController.text = _environment.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_environment.executeDate); | |||
| } catch (_) {} | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| Get.find<ChangeDateTimePicker>().change(_environment | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _environment.media)) { | |||
| @@ -4,6 +4,7 @@ import 'package:farm_tpf/custom_model/Harvest.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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -53,7 +54,6 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> { | |||
| final _executeByController = TextEditingController(); | |||
| var pref = LocalPref(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -68,10 +68,6 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> { | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _harvest.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _harvest.cropId = widget.cropId; | |||
| } | |||
| @@ -122,39 +118,12 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _harvest.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _harvest.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _l1Field() { | |||
| @@ -293,13 +262,9 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> { | |||
| _harvest.description ?? ""; | |||
| _executeByController.text = _harvest.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_harvest.executeDate); | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| Get.find<ChangeDateTimePicker>().change(_harvest | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _harvest.media)) { | |||
| @@ -81,10 +81,9 @@ class _EditActionHarvestProcessScreenState | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| _harvestProcess.suppliesUsing = new List<SuppliesUsing>(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _harvestProcess.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _harvestProcess.executeDate = | |||
| executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| _harvestProcess.cropId = widget.cropId; | |||
| if (!widget.isEdit) { | |||
| @@ -196,10 +195,10 @@ class _EditActionHarvestProcessScreenState | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _harvestProcess.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| executeTime = date; | |||
| _harvestProcess.executeDate = | |||
| executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| @@ -382,13 +381,10 @@ class _EditActionHarvestProcessScreenState | |||
| } | |||
| }, (err) {}); | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_harvestProcess.executeDate); | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| executeTime = _harvestProcess.executeDate | |||
| .convertStringServerDateTimeToLocalDateTime(); | |||
| executeTimeView = | |||
| executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _harvestProcess.media)) { | |||
| @@ -7,6 +7,7 @@ import 'package:farm_tpf/custom_model/Supply.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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -62,7 +63,6 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { | |||
| TextEditingController _workerNameController = TextEditingController(); | |||
| TextEditingController _trayNumberController = TextEditingController(); | |||
| final _executeByController = TextEditingController(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<NurseryDetail> currentNurseryDetail = List<NurseryDetail>(); | |||
| int currentIndexUpdate = -1; | |||
| @@ -84,10 +84,6 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { | |||
| changeSupply.initValue(); | |||
| changeFileController.initValue(); | |||
| _nursery.nurseryDetail = new List<NurseryDetail>(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _nursery.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _nursery.cropId = widget.cropId; | |||
| } | |||
| @@ -134,39 +130,12 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _nursery.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _nursery.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _btnSelectSubstrates() { | |||
| @@ -534,14 +503,9 @@ class _EditActionNurseryState extends State<EditActionNurseryScreen> { | |||
| _nursery.description; | |||
| _executeByController.text = | |||
| _nursery.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_nursery.executeDate); | |||
| } catch (_) {} | |||
| executeTimeView = | |||
| DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| Get.find<ChangeDateTimePicker>().change(_nursery | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _nursery.media)) { | |||
| @@ -5,6 +5,7 @@ import 'package:farm_tpf/data/api/app_exception.dart'; | |||
| import 'package:farm_tpf/data/repository/repository.dart'; | |||
| import 'package:farm_tpf/models/index.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_utils.dart'; | |||
| @@ -22,6 +23,7 @@ import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; | |||
| import 'package:get/get.dart'; | |||
| import 'package:intl/intl.dart'; | |||
| import 'package:keyboard_dismisser/keyboard_dismisser.dart'; | |||
| import 'package:farm_tpf/utils/formatter.dart'; | |||
| import '../util_action.dart'; | |||
| @@ -47,7 +49,6 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> { | |||
| List<ActionType> _actionTypes = List<ActionType>(); | |||
| ActionType _actionType; | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -62,10 +63,6 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> { | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _other.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _other.cropId = widget.cropId; | |||
| if (!widget.isEdit) { | |||
| @@ -122,39 +119,12 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _other.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _other.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| List<DropdownMenuItem<ActionType>> _buildDropMenu(List<ActionType> actions) { | |||
| @@ -290,14 +260,10 @@ class _EditActionOtherScreenState extends State<EditActionOtherScreen> { | |||
| } | |||
| } | |||
| }, (err) {}); | |||
| Get.find<ChangeDateTimePicker>().change(_other | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_other.executeDate); | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty(_other.media)) { | |||
| BlocProvider.of<MediaHelperBloc>(context).add( | |||
| @@ -75,10 +75,9 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> { | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _packing.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _packing.executeDate = | |||
| executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| _packing.cropId = widget.cropId; | |||
| if (!widget.isEdit) { | |||
| @@ -181,10 +180,10 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _packing.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| executeTime = date; | |||
| _packing.executeDate = | |||
| executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| @@ -357,13 +356,10 @@ class _EditActionPackingScreenState extends State<EditActionPackingScreen> { | |||
| } | |||
| }, (err) {}); | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_packing.executeDate); | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| executeTime = _packing.executeDate | |||
| .convertStringServerDateTimeToLocalDateTime(); | |||
| executeTimeView = | |||
| executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _packing.media)) { | |||
| @@ -5,6 +5,7 @@ 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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -70,10 +71,6 @@ class _EditActionPlantScreenState extends State<EditActionPlantScreen> { | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| _plant.suppliesUsing = new List<SuppliesUsing>(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _plant.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _plant.cropId = widget.cropId; | |||
| } | |||
| @@ -126,39 +123,12 @@ class _EditActionPlantScreenState extends State<EditActionPlantScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _plant.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _plant.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _quantityField() { | |||
| @@ -278,14 +248,11 @@ class _EditActionPlantScreenState extends State<EditActionPlantScreen> { | |||
| _descriptionController.text = | |||
| _plant.description; | |||
| _executeByController.text = _plant.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_plant.executeDate); | |||
| } catch (_) {} | |||
| executeTimeView = | |||
| DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| Get.find<ChangeDateTimePicker>().change(_plant | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| _plant.media)) { | |||
| @@ -74,10 +74,8 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> { | |||
| super.initState(); | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _sell.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _sell.executeDate = executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| _sell.cropId = widget.cropId; | |||
| if (!widget.isEdit) { | |||
| @@ -180,10 +178,10 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _sell.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| executeTime = date; | |||
| _sell.executeDate = | |||
| executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| @@ -368,13 +366,10 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> { | |||
| } | |||
| }, (err) {}); | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_sell.executeDate); | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| executeTime = _sell.executeDate | |||
| .convertStringServerDateTimeToLocalDateTime(); | |||
| executeTimeView = | |||
| executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty(_sell.media)) { | |||
| BlocProvider.of<MediaHelperBloc>(context).add( | |||
| @@ -73,10 +73,9 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> { | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| _spraying.suppliesUsing = new List<SuppliesUsing>(); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _spraying.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _spraying.executeDate = | |||
| executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| _spraying.cropId = widget.cropId; | |||
| } | |||
| @@ -141,10 +140,9 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> { | |||
| message: label_execute_date_must_after_result_time); | |||
| } else { | |||
| executeTime = date; | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _spraying.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| _spraying.executeDate = | |||
| executeTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| executeTimeView = executeTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| } | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| @@ -183,10 +181,9 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> { | |||
| message: label_execute_date_must_after_result_time); | |||
| } else { | |||
| resultAtTime = date; | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _spraying.resultAt = "$parsedDate"; | |||
| resultAtView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| _spraying.resultAt = | |||
| resultAtTime.convertLocalDateTimeToStringUtcDateTime(); | |||
| resultAtView = resultAtTime.displayDateTime_DDMMYYYY_HHmm(); | |||
| } | |||
| }); | |||
| }, currentTime: resultAtTime, locale: LocaleType.vi); | |||
| @@ -345,23 +342,16 @@ class _EditActionSprayingScreenState extends State<EditActionSprayingScreen> { | |||
| _spraying.description; | |||
| _executeByController.text = | |||
| _spraying.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_spraying.executeDate); | |||
| executeTimeView = | |||
| DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| try { | |||
| resultAtTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_spraying.resultAt); | |||
| resultAtView = | |||
| DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(resultAtTime); | |||
| } catch (_) {} | |||
| executeTime = _spraying.executeDate | |||
| .convertStringServerDateTimeToLocalDateTime(); | |||
| executeTimeView = executeTime | |||
| .displayDateTime_DDMMYYYY_HHmm(); | |||
| resultAtTime = _spraying.resultAt | |||
| .convertStringServerDateTimeToLocalDateTime(); | |||
| resultAtView = resultAtTime | |||
| .displayDateTime_DDMMYYYY_HHmm(); | |||
| //Show media | |||
| if (Validators.stringNotNullOrEmpty( | |||
| @@ -5,6 +5,7 @@ import 'package:farm_tpf/custom_model/WaterType.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/bloc/media_helper_bloc.dart'; | |||
| import 'package:farm_tpf/presentation/custom_widgets/widget_field_time_picker.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_form_field.dart'; | |||
| @@ -13,16 +14,12 @@ import 'package:farm_tpf/presentation/screens/actions/bloc/action_detail_bloc.da | |||
| import 'package:farm_tpf/presentation/screens/actions/state_management_helper/change_file_controller.dart'; | |||
| import 'package:farm_tpf/utils/const_common.dart'; | |||
| import 'package:farm_tpf/utils/const_string.dart'; | |||
| import 'package:farm_tpf/utils/const_style.dart'; | |||
| import 'package:farm_tpf/utils/pref.dart'; | |||
| import 'package:farm_tpf/utils/validators.dart'; | |||
| import 'package:flutter/material.dart'; | |||
| import 'package:flutter_bloc/flutter_bloc.dart'; | |||
| import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; | |||
| import 'package:get/get.dart'; | |||
| import 'package:intl/intl.dart'; | |||
| import 'package:keyboard_dismisser/keyboard_dismisser.dart'; | |||
| import 'package:pattern_formatter/pattern_formatter.dart'; | |||
| import 'package:farm_tpf/utils/formatter.dart'; | |||
| import '../util_action.dart'; | |||
| @@ -49,7 +46,6 @@ class _EditActionUseWaterScreenState extends State<EditActionUseWaterScreen> { | |||
| TextEditingController _descriptionController = TextEditingController(); | |||
| final _executeByController = TextEditingController(); | |||
| String executeTimeView; | |||
| DateTime executeTime = DateTime.now(); | |||
| List<String> filePaths = List<String>(); | |||
| var changeFileController = Get.put(ChangeFileController()); | |||
| @@ -65,10 +61,6 @@ class _EditActionUseWaterScreenState extends State<EditActionUseWaterScreen> { | |||
| getSharedPrefs(); | |||
| changeFileController.initValue(); | |||
| changeRadio.init(widget.isEdit); | |||
| var parsedExecuteDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); | |||
| _useWater.executeDate = "$parsedExecuteDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); | |||
| _useWater.cropId = widget.cropId; | |||
| } | |||
| @@ -121,39 +113,12 @@ class _EditActionUseWaterScreenState extends State<EditActionUseWaterScreen> { | |||
| } | |||
| Widget _btnExecuteTimePicker() { | |||
| return FlatButton( | |||
| padding: EdgeInsets.only(top: 0.0, right: 0.0, bottom: 0.0, left: 0.0), | |||
| onPressed: () { | |||
| DatePicker.showDateTimePicker(context, | |||
| showTitleActions: true, onChanged: (date) {}, onConfirm: (date) { | |||
| setState(() { | |||
| var parsedDate = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date); | |||
| _useWater.executeDate = "$parsedDate"; | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(date); | |||
| }); | |||
| }, currentTime: executeTime, locale: LocaleType.vi); | |||
| }, | |||
| child: Container( | |||
| padding: | |||
| EdgeInsets.only(top: 0.0, right: 0.0, bottom: 10.5, left: 0.0), | |||
| decoration: BoxDecoration( | |||
| border: kBorderTextField, | |||
| ), | |||
| child: Row( | |||
| children: [ | |||
| Expanded( | |||
| child: Text( | |||
| //TODO: check condition | |||
| executeTimeView == null ? "$executeTime" : executeTimeView, | |||
| style: TextStyle(fontSize: 14.0, color: Colors.black87), | |||
| )), | |||
| Icon( | |||
| Icons.date_range, | |||
| color: Colors.blue, | |||
| ), | |||
| ], | |||
| ))); | |||
| return WidgetFieldDateTimePicker( | |||
| initDateTime: executeTime, | |||
| onUpdateDateTime: (selectedDate) { | |||
| _useWater.executeDate = | |||
| selectedDate.convertLocalDateTimeToStringUtcDateTime(); | |||
| }); | |||
| } | |||
| Widget _amountField() { | |||
| @@ -287,13 +252,9 @@ class _EditActionUseWaterScreenState extends State<EditActionUseWaterScreen> { | |||
| _useWater.description ?? ""; | |||
| _executeByController.text = _useWater.executeBy; | |||
| try { | |||
| executeTime = | |||
| DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") | |||
| .parse(_useWater.executeDate); | |||
| executeTimeView = DateFormat("dd/MM/yyyy HH:mm") | |||
| .format(executeTime); | |||
| } catch (_) {} | |||
| Get.find<ChangeDateTimePicker>().change(_useWater | |||
| .executeDate | |||
| .convertStringServerDateTimeToLocalDateTime()); | |||
| changeRadio | |||
| .initWithSelectedByName(_useWater.waterType); | |||
| @@ -2,7 +2,7 @@ name: farm_tpf | |||
| description: A new Flutter project. | |||
| publish_to: 'none' | |||
| version: 0.8.0+1 | |||
| version: 0.9.0+1 | |||
| environment: | |||
| sdk: ">=2.7.0 <3.0.0" | |||