Browse Source

add resultTime action spraying

master
daivph 5 years ago
parent
commit
493cb24e12
2 changed files with 64 additions and 4 deletions
  1. +63
    -3
      lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart
  2. +1
    -1
      lib/presentation/screens/actions/spraying/widget_spraying_supply.dart

+ 63
- 3
lib/presentation/screens/actions/spraying/sc_edit_action_spraying.dart View File



String executeTimeView; String executeTimeView;
DateTime executeTime = DateTime.now(); DateTime executeTime = DateTime.now();
String resultAtView;
DateTime resultAtTime;
List<String> filePaths = List<String>(); List<String> filePaths = List<String>();
var changeFileController = Get.put(ChangeFileController()); var changeFileController = Get.put(ChangeFileController());


))); )));
} }


Widget _btnResultAtTimePicker() {
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);
_spraying.resultAt = "$parsedDate";
resultAtView = DateFormat("dd/MM/yyyy HH:mm").format(date);
});
}, currentTime: resultAtTime, 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(
resultAtView == null ? "" : resultAtView,
style: TextStyle(fontSize: 14.0, color: Colors.black87),
)),
Icon(
Icons.date_range,
color: Colors.blue,
),
],
)));
}

Widget _purposeField() { Widget _purposeField() {
return TextFormField( return TextFormField(
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
executeTime = executeTime =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'") DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
.parse(_spraying.executeDate); .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 (_) {} } catch (_) {}
executeTimeView =
DateFormat("dd/MM/yyyy HH:mm")
.format(executeTime);

//Show media //Show media
if (_spraying.media != null) { if (_spraying.media != null) {
await UtilAction.cacheFiles(_spraying.media) await UtilAction.cacheFiles(_spraying.media)
SizedBox( SizedBox(
height: 8.0, 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(), _weatherField(),
SizedBox( SizedBox(
height: 8.0, height: 8.0,

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

.push(MaterialPageRoute( .push(MaterialPageRoute(
builder: (_) => ResourceHelperScreen( builder: (_) => ResourceHelperScreen(
titleName: "Thuốc BVTV", titleName: "Thuốc BVTV",
type: ConstCommon.supplyTypeAll,
type: ConstCommon.supplyTypeProtectPlant,
selectedId: changeSelectedSupply.selectedSupplyId), selectedId: changeSelectedSupply.selectedSupplyId),
fullscreenDialog: false)) fullscreenDialog: false))
.then((value) { .then((value) {

Loading…
Cancel
Save