Browse Source

show executeBy action sell

master
daivph 5 years ago
parent
commit
956382196b
2 changed files with 29 additions and 0 deletions
  1. +4
    -0
      lib/custom_model/Sell.dart
  2. +25
    -0
      lib/presentation/screens/actions/sell/sc_edit_action_sell.dart

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

@@ -5,6 +5,7 @@ class Sell {
int harvestId;
String executeDate;
String description;
String executeBy;
String media;
num quantityLv1;
num quantityLv2;
@@ -19,6 +20,7 @@ class Sell {
this.harvestId,
this.executeDate,
this.description,
this.executeBy,
this.media,
this.quantityLv1,
this.quantityLv2,
@@ -33,6 +35,7 @@ class Sell {
harvestId = json['harvestId'];
executeDate = json['executeDate'];
description = json['description'];
executeBy = json['executeBy'];
media = json['media'];
quantityLv1 = json['quantityLv1'];
quantityLv2 = json['quantityLv2'];
@@ -49,6 +52,7 @@ class Sell {
data['harvestId'] = this.harvestId;
data['executeDate'] = this.executeDate;
data['description'] = this.description;
data['executeBy'] = this.executeBy;
data['media'] = this.media;
data['quantityLv1'] = this.quantityLv1;
data['quantityLv2'] = this.quantityLv2;

+ 25
- 0
lib/presentation/screens/actions/sell/sc_edit_action_sell.dart View File

@@ -12,6 +12,7 @@ import 'package:farm_tpf/presentation/screens/actions/state_management_helper/ch
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';
@@ -51,7 +52,9 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
TextEditingController _removedQuantityController = TextEditingController();
TextEditingController _descriptionController = TextEditingController();
final _buyerController = TextEditingController();
final _executeByController = TextEditingController();

var pref = LocalPref();
List<Harvest> _harvests = List<Harvest>();
Harvest harvestValue;
String executeTimeView;
@@ -59,9 +62,15 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
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);
@@ -317,6 +326,16 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
);
}

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) {
@@ -391,6 +410,7 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
_buyerController.text = _sell.buyer ?? "";
_descriptionController.text =
_sell.description ?? "";
_executeByController.text = _sell.executeBy;

//select harvest
getHarvestBloc.getHarvests((data) {
@@ -468,6 +488,10 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
SizedBox(
height: 8.0,
),
_executeByField(),
SizedBox(
height: 8.0,
),
BlocBuilder<MediaHelperBloc, MediaHelperState>(
builder: (context, state) {
if (state is MediaHelperSuccess) {
@@ -496,6 +520,7 @@ class _EditActionSellScreenState extends State<EditActionSellScreen> {
_removedQuantityController.dispose();
_descriptionController.dispose();
_buyerController.dispose();
_executeByController.dispose();
super.dispose();
}
}

Loading…
Cancel
Save