Browse Source

plot infomation screen

master
daivph 5 years ago
parent
commit
6c25a5536c
7 changed files with 221 additions and 8 deletions
  1. +2
    -1
      lib/app.dart
  2. +7
    -1
      lib/presentation/screens/plot/sc_plot.dart
  3. +3
    -2
      lib/presentation/screens/plot_detail/sc_plot_detail.dart
  4. +187
    -3
      lib/presentation/screens/plot_detail/sc_plot_information.dart
  5. +13
    -0
      lib/presentation/screens/plot_detail/sc_plot_parameter.dart
  6. +8
    -1
      pubspec.lock
  7. +1
    -0
      pubspec.yaml

+ 2
- 1
lib/app.dart View File

@@ -5,6 +5,7 @@ import 'package:farm_tpf/presentation/screens/splash/view/splash_page.dart';
import 'package:farm_tpf/utils/const_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get/get.dart';

import 'authentication/bloc/authentication_bloc.dart';
import 'data/repository/authentication_repository.dart';
@@ -44,7 +45,7 @@ class _AppViewState extends State<AppView> {

@override
Widget build(BuildContext context) {
return MaterialApp(
return GetMaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
backgroundColor: Colors.white,

+ 7
- 1
lib/presentation/screens/plot/sc_plot.dart View File

@@ -5,12 +5,14 @@ import 'package:farm_tpf/presentation/custom_widgets/loading_list_page.dart';
import 'package:farm_tpf/presentation/custom_widgets/widget_loading.dart';
import 'package:farm_tpf/presentation/screens/plot/widget_search.dart';
import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_detail.dart';
import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_information.dart';
import 'package:farm_tpf/utils/const_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:farm_tpf/utils/const_string.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:farm_tpf/utils/formatter.dart';
import 'package:get/get.dart';

import 'bloc/plot_bloc.dart';

@@ -40,7 +42,11 @@ class HoldInfinityWidget extends StatelessWidget {
centerTitle: true,
title: Text("Danh sách lô"),
actions: <Widget>[
IconButton(icon: Icon(FontAwesomeIcons.qrcode), onPressed: () {})
IconButton(
icon: Icon(FontAwesomeIcons.infoCircle),
onPressed: () {
Get.to(PlotInformationScreen());
})
],
),
body: InfinityView());

+ 3
- 2
lib/presentation/screens/plot_detail/sc_plot_detail.dart View File

@@ -1,6 +1,7 @@
import 'package:farm_tpf/presentation/custom_widgets/widget_rounded_rect_indicator.dart';
import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_action.dart';
import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_information.dart';
import 'package:farm_tpf/presentation/screens/plot_detail/sc_plot_parameter.dart';
import 'package:farm_tpf/utils/const_color.dart';
import 'package:flutter/material.dart';

@@ -27,12 +28,12 @@ class _PlotDetailScreenState extends State<PlotDetailScreen> {
child: new Scaffold(
backgroundColor: COLOR_CONST.ITEM_BG,
body: TabBarView(
children: [PlotInformationScreen(), PlotActionScreen()],
children: [PlotParameterScreen(), PlotActionScreen()],
),
bottomNavigationBar: new TabBar(
tabs: [
Tab(
text: "Thông tin",
text: "Chỉ số",
),
Tab(
text: "Canh tác",

+ 187
- 3
lib/presentation/screens/plot_detail/sc_plot_information.dart View File

@@ -1,14 +1,198 @@
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> {
@override
Widget build(BuildContext context) {
return Container();
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;
if (_plot.id != null) {
iconButton = IconButton(
icon: Icon(
Icons.done,
color: COLOR_CONST.DEFAULT,
),
onPressed: () {},
);
return <Widget>[iconButton];
}
return <Widget>[Container()];
}

@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()
],
),
)))))));
}

+ 13
- 0
lib/presentation/screens/plot_detail/sc_plot_parameter.dart View File

@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';

class PlotParameterScreen extends StatefulWidget {
@override
_PlotParameterScreenState createState() => _PlotParameterScreenState();
}

class _PlotParameterScreenState extends State<PlotParameterScreen> {
@override
Widget build(BuildContext context) {
return Container();
}
}

+ 8
- 1
pubspec.lock View File

@@ -303,6 +303,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
get:
dependency: "direct main"
description:
name: get
url: "https://pub.dartlang.org"
source: hosted
version: "3.8.0"
glob:
dependency: transitive
description:
@@ -799,5 +806,5 @@ packages:
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.7.0 <3.0.0"
dart: ">=2.8.0 <3.0.0"
flutter: ">=1.16.0 <2.0.0"

+ 1
- 0
pubspec.yaml View File

@@ -34,6 +34,7 @@ dependencies:
package_info: ^0.4.3
change_app_package_name: ^0.1.2
firebase_messaging: ^7.0.0
get: ^3.8.0

dev_dependencies:
flutter_test:

Loading…
Cancel
Save