Browse Source

show executeBy action harvest

master
daivph 5 years ago
parent
commit
746ccdd524
2 changed files with 29 additions and 0 deletions
  1. +4
    -0
      lib/custom_model/Harvest.dart
  2. +25
    -0
      lib/presentation/screens/actions/harvest/sc_edit_action_harvest.dart

+ 4
- 0
lib/custom_model/Harvest.dart View File

@@ -4,6 +4,7 @@ class Harvest {
int activityId;
String executeDate;
String description;
String executeBy;
String media;
num collectedQuantityLv1;
num collectedQuantityLv2;
@@ -16,6 +17,7 @@ class Harvest {
this.activityId,
this.executeDate,
this.description,
this.executeBy,
this.media,
this.collectedQuantityLv1,
this.collectedQuantityLv2,
@@ -28,6 +30,7 @@ class Harvest {
activityId = json['activityId'];
executeDate = json['executeDate'];
description = json['description'];
executeBy = json['executeBy'];
media = json['media'];
collectedQuantityLv1 = json['collectedQuantityLv1'];
collectedQuantityLv2 = json['collectedQuantityLv2'];
@@ -42,6 +45,7 @@ class Harvest {
data['activityId'] = this.activityId;
data['executeDate'] = this.executeDate;
data['description'] = this.description;
data['executeBy'] = this.executeBy;
data['media'] = this.media;
data['collectedQuantityLv1'] = this.collectedQuantityLv1;
data['collectedQuantityLv2'] = this.collectedQuantityLv2;

+ 25
- 0
lib/presentation/screens/actions/harvest/sc_edit_action_harvest.dart View File

@@ -14,6 +14,7 @@ import 'package:farm_tpf/presentation/screens/actions/util_action.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';
@@ -46,15 +47,23 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
TextEditingController _l3Controller = TextEditingController();
TextEditingController _removedQuantityController = TextEditingController();
TextEditingController _descriptionController = TextEditingController();
final _executeByController = TextEditingController();

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

Future<Null> getSharedPrefs() async {
var currentFullName = await pref.getString(DATA_CONST.CURRENT_FULL_NAME);
_executeByController.text = currentFullName ?? "";
}

@override
void initState() {
super.initState();
getSharedPrefs();
changeFileController.initValue();
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
@@ -249,6 +258,16 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
);
}

Widget _executeByField() {
return TextFormField(
keyboardType: TextInputType.text,
decoration: InputDecoration(labelText: "Người thực hiện"),
enabled: false,
controller: _executeByController,
onSaved: (newValue) {},
);
}

_actionAppBar() {
IconButton iconButton;
if (1 == 1) {
@@ -322,6 +341,7 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
.formatNumtoStringDecimal();
_descriptionController.text =
_harvest.description ?? "";
_executeByController.text = _harvest.executeBy;

try {
executeTime =
@@ -380,6 +400,10 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
SizedBox(
height: 8.0,
),
_executeByField(),
SizedBox(
height: 8.0,
),
BlocBuilder<MediaHelperBloc, MediaHelperState>(
builder: (context, state) {
if (state is MediaHelperSuccess) {
@@ -489,6 +513,7 @@ class _EditActionHarvestScreenState extends State<EditActionHarvestScreen> {
_l3Controller.dispose();
_removedQuantityController.dispose();
_descriptionController.dispose();
_executeByController.dispose();
super.dispose();
}
}

Loading…
Cancel
Save