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

int harvestId; int harvestId;
String executeDate; String executeDate;
String description; String description;
String executeBy;
String media; String media;
num quantityLv1; num quantityLv1;
num quantityLv2; num quantityLv2;
this.harvestId, this.harvestId,
this.executeDate, this.executeDate,
this.description, this.description,
this.executeBy,
this.media, this.media,
this.quantityLv1, this.quantityLv1,
this.quantityLv2, this.quantityLv2,
harvestId = json['harvestId']; harvestId = json['harvestId'];
executeDate = json['executeDate']; executeDate = json['executeDate'];
description = json['description']; description = json['description'];
executeBy = json['executeBy'];
media = json['media']; media = json['media'];
quantityLv1 = json['quantityLv1']; quantityLv1 = json['quantityLv1'];
quantityLv2 = json['quantityLv2']; quantityLv2 = json['quantityLv2'];
data['harvestId'] = this.harvestId; data['harvestId'] = this.harvestId;
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['quantityLv1'] = this.quantityLv1; data['quantityLv1'] = this.quantityLv1;
data['quantityLv2'] = this.quantityLv2; data['quantityLv2'] = this.quantityLv2;

+ 25
- 0
lib/presentation/screens/actions/sell/sc_edit_action_sell.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 _removedQuantityController = TextEditingController(); TextEditingController _removedQuantityController = TextEditingController();
TextEditingController _descriptionController = TextEditingController(); TextEditingController _descriptionController = TextEditingController();
final _buyerController = TextEditingController(); final _buyerController = TextEditingController();
final _executeByController = TextEditingController();


var pref = LocalPref();
List<Harvest> _harvests = List<Harvest>(); List<Harvest> _harvests = List<Harvest>();
Harvest harvestValue; Harvest harvestValue;
String executeTimeView; String executeTimeView;
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) {
_buyerController.text = _sell.buyer ?? ""; _buyerController.text = _sell.buyer ?? "";
_descriptionController.text = _descriptionController.text =
_sell.description ?? ""; _sell.description ?? "";
_executeByController.text = _sell.executeBy;


//select harvest //select harvest
getHarvestBloc.getHarvests((data) { getHarvestBloc.getHarvests((data) {
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) {
_removedQuantityController.dispose(); _removedQuantityController.dispose();
_descriptionController.dispose(); _descriptionController.dispose();
_buyerController.dispose(); _buyerController.dispose();
_executeByController.dispose();
super.dispose(); super.dispose();
} }
} }

Loading…
Cancel
Save