modify package list

This commit is contained in:
PhyoThandar
2020-06-24 16:06:15 +06:30
parent 3c147e0ecd
commit 76235bed4b
17 changed files with 52727 additions and 190 deletions

View File

@@ -1,3 +1,4 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/package.dart';
import 'package:fcs/widget/localization/app_translations.dart';
@@ -6,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'package:timeline_list/timeline.dart';
import 'package:timeline_list/timeline_model.dart';
@@ -61,8 +63,49 @@ class _PackageEditorState extends State<PackageEditor> {
final DateFormat dateFormat = DateFormat("d MMM yyyy");
List<TimelineModel> _models() {
print('_package.statusHistory=> ${_package.statusHistory}');
return _package.statusHistory
.map((e) => TimelineModel(
Padding(
padding: const EdgeInsets.all(18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(e.status,
style: TextStyle(
color: e.done ? primaryColor : Colors.grey,
fontSize: 16,
fontWeight: FontWeight.bold)),
e.status == "Processed"
? Text("(Waiting for payment)",
style: TextStyle(
color: e.done ? primaryColor : Colors.grey,
fontSize: 14,
fontWeight: FontWeight.bold))
: Container(),
Text(dateFormat.format(e.date)),
],
),
),
iconBackground: e.done ? primaryColor : Colors.grey,
icon: Icon(
e.status == "Shipped"
? Ionicons.ios_airplane
: e.status == "Delivered"
? MaterialCommunityIcons.truck_fast
: e.status == "Processed"
? MaterialIcons.check
: Octicons.package,
color: Colors.white,
)))
.toList();
}
@override
Widget build(BuildContext context) {
var owner = Provider.of<MainModel>(context).isOwner();
var images = isNew ? [] : _images;
return LocalProgress(
inAsyncCall: _isLoading,
@@ -89,105 +132,10 @@ class _PackageEditorState extends State<PackageEditor> {
Expanded(
child: ListView(
children: [
ExpansionTile(
title: Text(
'Receiving',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "PKG2039",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Package ID',
hintText: 'Package ID',
filled: true,
icon: Icon(MaterialCommunityIcons.id_card,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "Amazon",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Market',
hintText: 'FCS_ID',
filled: true,
icon: Icon(MaterialCommunityIcons.cart_outline,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Tracking ID',
hintText: 'Tracking ID',
filled: true,
icon: Icon(Octicons.package, color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "FCS-0203-390-2",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'FCS_ID',
hintText: 'FCS_ID',
filled: true,
icon: Icon(Feather.user, color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _package.receiverName,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Customer Name',
filled: true,
icon: Icon(Feather.user, color: Colors.white),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Pickup ID',
filled: true,
icon: Icon(MaterialCommunityIcons.directions,
color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
],
),
isNew
? Container()
: ExpansionTile(
owner
? ExpansionTile(
title: Text(
'Processing',
'Receiving',
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold),
@@ -197,19 +145,130 @@ class _PackageEditorState extends State<PackageEditor> {
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew
? ""
: _package.cargoDesc.toString(),
decoration: InputDecoration(
initialValue: isNew ? "" : "PKG2039",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Package ID',
hintText: 'Package ID',
filled: true,
icon: Icon(MaterialCommunityIcons.id_card,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "Amazon",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Market',
hintText: 'FCS_ID',
filled: true,
icon: Icon(
MaterialCommunityIcons.cart_outline,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Tracking ID',
hintText: 'Tracking ID',
filled: true,
icon: Icon(Octicons.package,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "FCS-0203-390-2",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Description',
labelText: 'FCS_ID',
hintText: 'FCS_ID',
filled: true,
icon: Icon(MaterialIcons.description,
icon: Icon(Feather.user,
color: primaryColor),
)),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: _package.receiverName,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Customer Name',
filled: true,
icon: Icon(Feather.user,
color: Colors.white),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Pickup ID',
filled: true,
icon: Icon(
MaterialCommunityIcons.directions,
color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
],
),
)
: Container(),
owner
? isNew
? Container()
: ExpansionTile(
title: Text(
'Processing',
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew
? ""
: _package.cargoDesc.toString(),
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Description',
filled: true,
icon: Icon(MaterialIcons.description,
color: primaryColor),
)),
),
],
)
: Container(),
isNew
? Container()
: ExpansionTile(
@@ -267,43 +326,66 @@ class _PackageEditorState extends State<PackageEditor> {
),
],
),
isNew
? Container()
: ExpansionTile(
title: Text(
'Status',
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
height: 500,
padding: EdgeInsets.only(left: 20),
child: isNew
? Container()
: Timeline(
children: _models(),
position: TimelinePosition.Left),
),
],
)
],
),
),
widget.package == null
? Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Complete receiving'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
)))
: Container(
child: Column(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Complete processing'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
))),
],
))
owner
? widget.package == null
? Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Complete receiving'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
)))
: Container(
child: Column(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Complete processing'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
))),
],
))
: Container()
],
),
),

View File

@@ -1,5 +1,6 @@
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/model_fcs/package_model.dart';
import 'package:fcs/pages/barcode_screen_page.dart';
import 'package:fcs/pages/pickup_list_row.dart';
import 'package:fcs/pages/search_page.dart';
import 'package:fcs/pages_fcs/package_editor.dart';
@@ -9,6 +10,7 @@ import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../theme/theme.dart';
@@ -49,6 +51,19 @@ class _PackageListState extends State<PackageList> {
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("package.title")),
actions: <Widget>[
IconButton(
icon: Icon(
FontAwesomeIcons.barcode,
color: Colors.white,
),
iconSize: 30,
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(BarcodeScreenPage()),
);
},
),
IconButton(
icon: Icon(
Icons.search,

View File

@@ -90,6 +90,10 @@ class _PackageListRowtate extends State<PackageListRow> {
),
Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(3.0),
child: getStatus(_package.status),
),
Padding(
padding: const EdgeInsets.all(0),
child: new Text(
@@ -97,27 +101,27 @@ class _PackageListRowtate extends State<PackageListRow> {
style: new TextStyle(fontSize: 15.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
child: Row(
children: <Widget>[
new Text(
_package.weight == null
? ''
: _package.weight.toString() + 'lb - ',
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
new Text(
_package.price == null
? ""
: "\$ " + _package.price.toString(),
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
],
),
),
// Padding(
// padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
// child: Row(
// children: <Widget>[
// new Text(
// _package.weight == null
// ? ''
// : _package.weight.toString() + 'lb - ',
// style:
// new TextStyle(fontSize: 15.0, color: Colors.grey),
// ),
// new Text(
// _package.price == null
// ? ""
// : "\$ " + _package.price.toString(),
// style:
// new TextStyle(fontSize: 15.0, color: Colors.grey),
// ),
// ],
// ),
// ),
],
)
],