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

int activityId; int activityId;
String executeDate; String executeDate;
String description; String description;
String executeBy;
String media; String media;
num collectedQuantityLv1; num collectedQuantityLv1;
num collectedQuantityLv2; num collectedQuantityLv2;
this.activityId, this.activityId,
this.executeDate, this.executeDate,
this.description, this.description,
this.executeBy,
this.media, this.media,
this.collectedQuantityLv1, this.collectedQuantityLv1,
this.collectedQuantityLv2, this.collectedQuantityLv2,
activityId = json['activityId']; activityId = json['activityId'];
executeDate = json['executeDate']; executeDate = json['executeDate'];
description = json['description']; description = json['description'];
executeBy = json['executeBy'];
media = json['media']; media = json['media'];
collectedQuantityLv1 = json['collectedQuantityLv1']; collectedQuantityLv1 = json['collectedQuantityLv1'];
collectedQuantityLv2 = json['collectedQuantityLv2']; collectedQuantityLv2 = json['collectedQuantityLv2'];
data['activityId'] = this.activityId; data['activityId'] = this.activityId;
data['executeDate'] = this.executeDate; data['executeDate'] = this.executeDate;
data['description'] = this.description; data['description'] = this.description;
data['executeBy'] = this.executeBy;
data['media'] = this.media; data['media'] = this.media;
data['collectedQuantityLv1'] = this.collectedQuantityLv1; data['collectedQuantityLv1'] = this.collectedQuantityLv1;
data['collectedQuantityLv2'] = this.collectedQuantityLv2; data['collectedQuantityLv2'] = this.collectedQuantityLv2;

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

import 'package:farm_tpf/utils/const_common.dart'; import 'package:farm_tpf/utils/const_common.dart';
import 'package:farm_tpf/utils/const_string.dart'; import 'package:farm_tpf/utils/const_string.dart';
import 'package:farm_tpf/utils/const_style.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:farm_tpf/utils/validators.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
TextEditingController _l3Controller = TextEditingController(); TextEditingController _l3Controller = TextEditingController();
TextEditingController _removedQuantityController = TextEditingController(); TextEditingController _removedQuantityController = TextEditingController();
TextEditingController _descriptionController = TextEditingController(); TextEditingController _descriptionController = TextEditingController();
final _executeByController = TextEditingController();


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


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

@override @override
void initState() { void initState() {
super.initState(); super.initState();
getSharedPrefs();
changeFileController.initValue(); changeFileController.initValue();
var parsedExecuteDate = var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime); DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
); );
} }


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

_actionAppBar() { _actionAppBar() {
IconButton iconButton; IconButton iconButton;
if (1 == 1) { if (1 == 1) {
.formatNumtoStringDecimal(); .formatNumtoStringDecimal();
_descriptionController.text = _descriptionController.text =
_harvest.description ?? ""; _harvest.description ?? "";
_executeByController.text = _harvest.executeBy;


try { try {
executeTime = executeTime =
SizedBox( SizedBox(
height: 8.0, height: 8.0,
), ),
_executeByField(),
SizedBox(
height: 8.0,
),
BlocBuilder<MediaHelperBloc, MediaHelperState>( BlocBuilder<MediaHelperBloc, MediaHelperState>(
builder: (context, state) { builder: (context, state) {
if (state is MediaHelperSuccess) { if (state is MediaHelperSuccess) {
_l3Controller.dispose(); _l3Controller.dispose();
_removedQuantityController.dispose(); _removedQuantityController.dispose();
_descriptionController.dispose(); _descriptionController.dispose();
_executeByController.dispose();
super.dispose(); super.dispose();
} }
} }

Loading…
Cancel
Save