|
- import 'package:farm_tpf/models/Plot.dart';
- import 'package:farm_tpf/presentation/custom_widgets/widget_media_helper.dart';
- import 'package:farm_tpf/utils/const_color.dart';
- import 'package:flutter/material.dart';
- import 'package:keyboard_dismisser/keyboard_dismisser.dart';
-
- class PlotInformationScreen extends StatefulWidget {
- final Plot plot;
- PlotInformationScreen({this.plot});
- @override
- _PlotInformationScreenState createState() => _PlotInformationScreenState();
- }
-
- class _PlotInformationScreenState extends State<PlotInformationScreen> {
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
- GlobalKey<FormState> _formKey = GlobalKey();
- bool _autoValidate = false;
- Plot _plot = Plot();
-
- _validateInputs() async {
- if (_formKey.currentState.validate()) {
- _formKey.currentState.save();
- } else {
- _autoValidate = true;
- }
- }
-
- Widget _statusField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Trạng thái"),
- );
- }
-
- Widget _houseNameField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Nhà màng"),
- );
- }
-
- Widget _codeField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Mã lô"),
- );
- }
-
- Widget _supplyNameField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Giống"),
- );
- }
-
- Widget _seedingDateField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Ngày gieo trồng"),
- );
- }
-
- Widget _timeSoakSeedField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Thời gian ngâm hạt"),
- );
- }
-
- Widget _timeNurserySeedField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Thời gian vô khây ươm"),
- );
- }
-
- Widget _quantityPlantField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Số lượng cây trồng"),
- );
- }
-
- Widget _currentPlantField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Số lượng cây hiện tại"),
- );
- }
-
- Widget _timeEndGrowField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Ngày kết thúc canh tác"),
- );
- }
-
- Widget _mainTechnicianField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Kỹ sư trực tiếp"),
- );
- }
-
- Widget _areaField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Diện tích (m\u00B2)"),
- );
- }
-
- Widget _descriptionField() {
- return TextFormField(
- decoration: InputDecoration(labelText: "Ghi chú"),
- );
- }
-
- _actionAppBar() {
- IconButton iconButton;
- iconButton = IconButton(
- icon: Icon(
- Icons.done,
- ),
- onPressed: () {},
- );
- return <Widget>[iconButton];
- }
-
- @override
- Widget build(BuildContext context) => KeyboardDismisser(
- gestures: [
- GestureType.onTap,
- GestureType.onPanUpdateDownDirection,
- ],
- child: Container(
- color: COLOR_CONST.ITEM_BG,
- child: SafeArea(
- top: false,
- bottom: true,
- child: Scaffold(
- key: _scaffoldKey,
- appBar: AppBar(
- centerTitle: true,
- title: Text("Thông tin lô"),
- actions: _actionAppBar()),
- body: KeyboardDismisser(
- child: Form(
- key: _formKey,
- autovalidate: _autoValidate,
- child: SingleChildScrollView(
- padding: EdgeInsets.all(8.0),
- child: Column(
- children: <Widget>[
- _statusField(),
- SizedBox(
- height: 4.0,
- ),
- _houseNameField(),
- SizedBox(
- height: 4.0,
- ),
- _codeField(),
- SizedBox(
- height: 4.0,
- ),
- _supplyNameField(),
- SizedBox(
- height: 4.0,
- ),
- _seedingDateField(),
- SizedBox(
- height: 4.0,
- ),
- _timeSoakSeedField(),
- SizedBox(
- height: 4.0,
- ),
- _timeNurserySeedField(),
- SizedBox(
- height: 4.0,
- ),
- _quantityPlantField(),
- SizedBox(
- height: 4.0,
- ),
- _currentPlantField(),
- SizedBox(
- height: 4.0,
- ),
- _timeEndGrowField(),
- SizedBox(
- height: 4.0,
- ),
- _mainTechnicianField(),
- SizedBox(
- height: 4.0,
- ),
- _areaField(),
- SizedBox(
- height: 4.0,
- ),
- _descriptionField()
- ],
- ),
- )))))));
- }
|