merge
This commit is contained in:
@@ -508,6 +508,11 @@
|
|||||||
|
|
||||||
"rate.cal.title":"CALCULATE RATES",
|
"rate.cal.title":"CALCULATE RATES",
|
||||||
|
|
||||||
|
"package.name":"Packages",
|
||||||
|
"package.title":"PACKAGES",
|
||||||
|
"package.new":"New Package",
|
||||||
|
"package.edit.title":"PACKAGE",
|
||||||
|
|
||||||
"pickup.date": "Pickup Date",
|
"pickup.date": "Pickup Date",
|
||||||
|
|
||||||
"term":"TERMS"
|
"term":"TERMS"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fcs/model_fcs/package_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@@ -63,6 +64,8 @@ class _AppState extends State<App> {
|
|||||||
final ReportUserModel reportUserModel = new ReportUserModel();
|
final ReportUserModel reportUserModel = new ReportUserModel();
|
||||||
final PickUpModel pickUpModel = new PickUpModel();
|
final PickUpModel pickUpModel = new PickUpModel();
|
||||||
final ShipmentRateModel shipmentRateModel = new ShipmentRateModel();
|
final ShipmentRateModel shipmentRateModel = new ShipmentRateModel();
|
||||||
|
final PackageModel packageModel=new PackageModel();
|
||||||
|
|
||||||
|
|
||||||
AppTranslationsDelegate _newLocaleDelegate;
|
AppTranslationsDelegate _newLocaleDelegate;
|
||||||
|
|
||||||
@@ -94,6 +97,7 @@ class _AppState extends State<App> {
|
|||||||
..addModel(testModel)
|
..addModel(testModel)
|
||||||
..addModel(reportUserModel)
|
..addModel(reportUserModel)
|
||||||
..addModel(pickUpModel)
|
..addModel(pickUpModel)
|
||||||
|
..addModel(packageModel)
|
||||||
..addModel(shipmentRateModel);
|
..addModel(shipmentRateModel);
|
||||||
this.mainModel.init();
|
this.mainModel.init();
|
||||||
}
|
}
|
||||||
@@ -145,6 +149,7 @@ class _AppState extends State<App> {
|
|||||||
ChangeNotifierProvider(builder: (context) => reportUserModel),
|
ChangeNotifierProvider(builder: (context) => reportUserModel),
|
||||||
ChangeNotifierProvider(builder: (context) => pickUpModel),
|
ChangeNotifierProvider(builder: (context) => pickUpModel),
|
||||||
ChangeNotifierProvider(builder: (context) => shipmentRateModel),
|
ChangeNotifierProvider(builder: (context) => shipmentRateModel),
|
||||||
|
ChangeNotifierProvider(builder: (context) => packageModel),
|
||||||
ChangeNotifierProvider(
|
ChangeNotifierProvider(
|
||||||
builder: (context) => testModel,
|
builder: (context) => testModel,
|
||||||
),
|
),
|
||||||
|
|||||||
115
lib/model_fcs/package_model.dart
Normal file
115
lib/model_fcs/package_model.dart
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:fcs/model/base_model.dart';
|
||||||
|
import 'package:fcs/vo/package.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
|
class PackageModel extends BaseModel {
|
||||||
|
final log = Logger('PackageModel');
|
||||||
|
|
||||||
|
StreamSubscription<QuerySnapshot> listener;
|
||||||
|
|
||||||
|
List<Package> packages = [
|
||||||
|
Package(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "3",
|
||||||
|
boxNumber: "1",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 25,
|
||||||
|
status: "Received",
|
||||||
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
),
|
||||||
|
Package(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "3",
|
||||||
|
boxNumber: "2",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 20,
|
||||||
|
status: "Received",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
|
||||||
|
Package(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "3",
|
||||||
|
boxNumber: "3",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 15,
|
||||||
|
status: "Received",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'),
|
||||||
|
Package(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "2",
|
||||||
|
boxNumber: "1",
|
||||||
|
rate: 8,
|
||||||
|
packageType: "Medicine",
|
||||||
|
weight: 15,
|
||||||
|
status: "Processing",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'),
|
||||||
|
Package(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "2",
|
||||||
|
boxNumber: "2",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 55,
|
||||||
|
status: "Ready to ship",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'),
|
||||||
|
Package(
|
||||||
|
shipmentNumber: "A201",
|
||||||
|
receiverNumber: "1",
|
||||||
|
boxNumber: "1",
|
||||||
|
rate: 9,
|
||||||
|
packageType: "Dangerous",
|
||||||
|
weight: 25,
|
||||||
|
status: "Delivered",
|
||||||
|
arrivedDate: DateTime(2020, 5, 21),
|
||||||
|
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'),
|
||||||
|
Package(
|
||||||
|
shipmentNumber: "A201",
|
||||||
|
receiverNumber: "1",
|
||||||
|
boxNumber: "2",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
weight: 5,
|
||||||
|
status: "Delivered",
|
||||||
|
arrivedDate: DateTime(2020, 5, 21),
|
||||||
|
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'),
|
||||||
|
];
|
||||||
|
|
||||||
|
List<Package> get completed {
|
||||||
|
return packages.where((e) => e.status == "Delivered").toList()
|
||||||
|
..sort((e1, e2) {
|
||||||
|
return e2.packageNumber.compareTo(e1.packageNumber);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Package> get upcoming {
|
||||||
|
return packages
|
||||||
|
.where((e) =>
|
||||||
|
e.status == "Processing" ||
|
||||||
|
e.status == "Received" ||
|
||||||
|
e.status == "Ready to ship")
|
||||||
|
.toList()
|
||||||
|
..sort((e1, e2) {
|
||||||
|
return e2.packageNumber.compareTo(e1.packageNumber);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void initUser(user) {
|
||||||
|
super.initUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
logout() async {
|
||||||
|
if (listener != null) await listener.cancel();
|
||||||
|
packages = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:fcs/model/main_model.dart';
|
import 'package:fcs/model/main_model.dart';
|
||||||
|
import 'package:fcs/pages_fcs/package_list.dart';
|
||||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_icons/flutter_icons.dart';
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
@@ -96,35 +97,17 @@ class _HomePageState extends State<HomePage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
login=Provider.of<MainModel>(context).isLogin();
|
login = Provider.of<MainModel>(context).isLogin();
|
||||||
final helpBtn = _buildBtn2("manual.title",
|
final packagesBtn = _buildBtn2("package.name",
|
||||||
icon: FontAwesomeIcons.readme,
|
icon: Octicons.package,
|
||||||
imgIcon: Image.asset(
|
|
||||||
"assets/manual.png",
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
btnCallback: () => Navigator.of(context)
|
btnCallback: () => Navigator.of(context)
|
||||||
.push(BottomUpPageRoute(ManualPage()))
|
.push(MaterialPageRoute(builder: (_) => PackageList())));
|
||||||
// btnCallback: () => Navigator.of(context)
|
|
||||||
// .push(MaterialPageRoute(builder: (_) => TestList()))
|
|
||||||
);
|
|
||||||
final announcementBtn = _buildBtn2("announcement.title",
|
final announcementBtn = _buildBtn2("announcement.title",
|
||||||
icon: Icons.announcement,
|
icon: Icons.announcement,
|
||||||
btnCallback: () => Navigator.of(context)
|
btnCallback: () => Navigator.of(context)
|
||||||
.push(MaterialPageRoute(builder: (_) => AnnouncementList())));
|
.push(MaterialPageRoute(builder: (_) => AnnouncementList())));
|
||||||
|
|
||||||
final buyerBtn = _buildBtn("buyer.title",
|
|
||||||
imgIcon: Image.asset(
|
|
||||||
"assets/buyer.png",
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
btnCallback: () => Navigator.of(context)
|
|
||||||
.push(MaterialPageRoute(builder: (_) => BuyerList())));
|
|
||||||
|
|
||||||
final reportBtn = _buildBtn2("report.title",
|
final reportBtn = _buildBtn2("report.title",
|
||||||
icon: FontAwesomeIcons.paperPlane,
|
icon: FontAwesomeIcons.paperPlane,
|
||||||
imgIcon: Image.asset(
|
imgIcon: Image.asset(
|
||||||
@@ -138,47 +121,19 @@ class _HomePageState extends State<HomePage> {
|
|||||||
|
|
||||||
final pickUpBtn = _buildBtn2("pickup",
|
final pickUpBtn = _buildBtn2("pickup",
|
||||||
icon: MaterialCommunityIcons.directions,
|
icon: MaterialCommunityIcons.directions,
|
||||||
btnCallback: () => Navigator.of(context)
|
btnCallback: () =>
|
||||||
.push(BottomUpPageRoute(PickUpList())));
|
Navigator.of(context).push(BottomUpPageRoute(PickUpList())));
|
||||||
|
|
||||||
final shipmentCostBtn = _buildBtn2("rate",
|
final shipmentCostBtn = _buildBtn2("rate",
|
||||||
icon: FontAwesomeIcons.calculator,
|
icon: FontAwesomeIcons.calculator,
|
||||||
btnCallback: () => Navigator.of(context)
|
btnCallback: () =>
|
||||||
.push(BottomUpPageRoute(ShipmentRates())));
|
Navigator.of(context).push(BottomUpPageRoute(ShipmentRates())));
|
||||||
|
|
||||||
final fcsProfileBtn = _buildBtn2("profile.title",
|
final fcsProfileBtn = _buildBtn2("profile.title",
|
||||||
icon: Icons.account_circle,
|
icon: Icons.account_circle,
|
||||||
btnCallback: () => Navigator.of(context)
|
btnCallback: () => Navigator.of(context)
|
||||||
.push(MaterialPageRoute(builder: (_) => FCSProfilePage())));
|
.push(MaterialPageRoute(builder: (_) => FCSProfilePage())));
|
||||||
|
|
||||||
final myRegBtn = _buildBtn("myreg.title",
|
|
||||||
imgIcon: Image.asset(
|
|
||||||
"assets/reg.png",
|
|
||||||
width: 40,
|
|
||||||
height: 30,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
btnCallback: () async {});
|
|
||||||
|
|
||||||
final posBtn = _buildBtn("po.title",
|
|
||||||
imgIcon: Image.asset(
|
|
||||||
"assets/pay.png",
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
btnCallback: () {});
|
|
||||||
|
|
||||||
final dosBtn = _buildBtn("do.title",
|
|
||||||
imgIcon: Image.asset(
|
|
||||||
"assets/do.png",
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
btnCallback: () => Navigator.of(context)
|
|
||||||
.push(MaterialPageRoute(builder: (_) => DOList())));
|
|
||||||
|
|
||||||
final shipmentBtn = _buildBtn2("shipment.title",
|
final shipmentBtn = _buildBtn2("shipment.title",
|
||||||
icon: Ionicons.ios_airplane,
|
icon: Ionicons.ios_airplane,
|
||||||
imgIcon: Image.asset(
|
imgIcon: Image.asset(
|
||||||
@@ -190,26 +145,6 @@ class _HomePageState extends State<HomePage> {
|
|||||||
btnCallback: () => Navigator.of(context)
|
btnCallback: () => Navigator.of(context)
|
||||||
.push(MaterialPageRoute(builder: (_) => ShipmentList())));
|
.push(MaterialPageRoute(builder: (_) => ShipmentList())));
|
||||||
|
|
||||||
final storageBtn = _buildBtn("storage.title",
|
|
||||||
imgIcon: Image.asset(
|
|
||||||
"assets/inventory.png",
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
btnCallback: () => Navigator.of(context)
|
|
||||||
.push(MaterialPageRoute(builder: (_) => StorageList())));
|
|
||||||
|
|
||||||
final pdosBtn = _buildBtn("pd.title",
|
|
||||||
imgIcon: Image.asset(
|
|
||||||
"assets/pdo.png",
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
color: primaryColor,
|
|
||||||
),
|
|
||||||
btnCallback: () => Navigator.of(context)
|
|
||||||
.push(MaterialPageRoute(builder: (_) => PDList())));
|
|
||||||
|
|
||||||
final termBtn = _buildBtn2("term.title",
|
final termBtn = _buildBtn2("term.title",
|
||||||
icon: FontAwesomeIcons.fileContract,
|
icon: FontAwesomeIcons.fileContract,
|
||||||
imgIcon: Image.asset(
|
imgIcon: Image.asset(
|
||||||
@@ -221,22 +156,11 @@ class _HomePageState extends State<HomePage> {
|
|||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => Term()));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => Term()));
|
||||||
});
|
});
|
||||||
|
|
||||||
final userBtn =
|
|
||||||
_buildBtn("users.title", icon: Icons.group, btnCallback: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => UserList()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
final buyingBtn = _buildBtn2("buy_online",
|
final buyingBtn = _buildBtn2("buy_online",
|
||||||
icon: MaterialCommunityIcons.cart_outline, btnCallback: () {
|
icon: MaterialCommunityIcons.cart_outline, btnCallback: () {
|
||||||
Navigator.push(
|
Navigator.push(context, BottomUpPageRoute(BuyingOnlinePage())
|
||||||
context,
|
// MaterialPageRoute(builder: (context) => BuyingOnlinePage()),
|
||||||
BottomUpPageRoute(BuyingOnlinePage())
|
);
|
||||||
// MaterialPageRoute(builder: (context) => BuyingOnlinePage()),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final notiBtn = _buildBtn2("notifications.title", icon: Icons.notifications,
|
final notiBtn = _buildBtn2("notifications.title", icon: Icons.notifications,
|
||||||
@@ -266,116 +190,13 @@ class _HomePageState extends State<HomePage> {
|
|||||||
widgets.add(shipmentBtn);
|
widgets.add(shipmentBtn);
|
||||||
widgets.add(notiBtn);
|
widgets.add(notiBtn);
|
||||||
widgets.add(staffBtn);
|
widgets.add(staffBtn);
|
||||||
// widgets.add(_bankAccountsBtn);
|
|
||||||
widgets.add(announcementBtn);
|
widgets.add(announcementBtn);
|
||||||
widgets.add(fcsProfileBtn);
|
widgets.add(fcsProfileBtn);
|
||||||
widgets.add(shipmentCostBtn);
|
widgets.add(shipmentCostBtn);
|
||||||
widgets.add(reportBtn);
|
widgets.add(reportBtn);
|
||||||
widgets.add(termBtn);
|
widgets.add(termBtn);
|
||||||
widgets.add(_bankAccountsBtn);
|
widgets.add(_bankAccountsBtn);
|
||||||
|
widgets.add(packagesBtn);
|
||||||
var revenueChart = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[RevenueLineChart()],
|
|
||||||
));
|
|
||||||
|
|
||||||
var productListBox = Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
LocalText(context, 'products.prices', color: primaryColor),
|
|
||||||
Row(
|
|
||||||
children: <Widget>[
|
|
||||||
LocalText(context, 'products.gas',
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 19,
|
|
||||||
fontWeight: FontWeight.w700),
|
|
||||||
Consumer<ProductModel>(builder: (context, model, child) {
|
|
||||||
return Text(' ${model.products.length}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.black,
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 19.0));
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Material(
|
|
||||||
color: thirdColor,
|
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
|
||||||
child: Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(5.0),
|
|
||||||
child: //Icon(Icons.timeline, color: Colors.white, size: 30.0),
|
|
||||||
Image.asset(
|
|
||||||
"assets/product.png",
|
|
||||||
width: 60,
|
|
||||||
height: 70,
|
|
||||||
color: Colors.white,
|
|
||||||
))))
|
|
||||||
]);
|
|
||||||
|
|
||||||
var poqtyByProductChart = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[BarChart()],
|
|
||||||
));
|
|
||||||
|
|
||||||
var poChart = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[POLineChart()],
|
|
||||||
));
|
|
||||||
|
|
||||||
var doChart = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[DOLineChart()],
|
|
||||||
));
|
|
||||||
|
|
||||||
var deliveryChart = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[DeliveryBarChart()],
|
|
||||||
));
|
|
||||||
|
|
||||||
var deliveryDOChart = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[DODeliveryLineChart()],
|
|
||||||
));
|
|
||||||
|
|
||||||
var deliveryDoSummary = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[DeliveryDoSummaryChart()],
|
|
||||||
));
|
|
||||||
var deliverySummary = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[DeliverySummary()],
|
|
||||||
));
|
|
||||||
var poBalancebyBuyerChart = Padding(
|
|
||||||
padding: const EdgeInsets.all(10.0),
|
|
||||||
child: ListView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
children: <Widget>[POBalanceChart()],
|
|
||||||
));
|
|
||||||
List<Widget> chartWidgets = [];
|
|
||||||
|
|
||||||
return OfflineRedirect(
|
return OfflineRedirect(
|
||||||
child: FlavorBanner(
|
child: FlavorBanner(
|
||||||
@@ -422,7 +243,10 @@ class _HomePageState extends State<HomePage> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
// iconSize: 30,
|
// iconSize: 30,
|
||||||
child: Text("Sign in",style: siginButtonStyle,),
|
child: Text(
|
||||||
|
"Sign in",
|
||||||
|
style: siginButtonStyle,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -492,47 +316,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
))),
|
||||||
// child: StaggeredGridView.count(
|
|
||||||
// crossAxisCount: 3,
|
|
||||||
// crossAxisSpacing: 12.0,
|
|
||||||
// mainAxisSpacing: 12.0,
|
|
||||||
// padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
|
||||||
// children: <Widget>[
|
|
||||||
// _buildTile(
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.all(20.0),
|
|
||||||
// child: productListBox,
|
|
||||||
// ),
|
|
||||||
// onTap: () => Navigator.of(context).push(
|
|
||||||
// MaterialPageRoute(builder: (_) => ProductsList())),
|
|
||||||
// ),
|
|
||||||
// new GridView.count(
|
|
||||||
// shrinkWrap: true,
|
|
||||||
// scrollDirection: Axis.horizontal,
|
|
||||||
// crossAxisCount: 1,
|
|
||||||
// crossAxisSpacing: 12,
|
|
||||||
// mainAxisSpacing: 12,
|
|
||||||
// padding: EdgeInsets.only(bottom: 5, left: 10, right: 5),
|
|
||||||
// children: widgets,
|
|
||||||
// ),
|
|
||||||
// Container(
|
|
||||||
// color:Colors.red
|
|
||||||
// ),
|
|
||||||
|
|
||||||
// _buildTile(
|
|
||||||
// PageView(
|
|
||||||
// children: chartWidgets,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// staggeredTiles: [
|
|
||||||
// StaggeredTile.extent(5, 110.0),
|
|
||||||
// StaggeredTile.extent(3, 110.0),
|
|
||||||
// StaggeredTile.extent(3, 250.0),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:fcs/widget/label_widgets.dart';
|
import 'package:fcs/widget/label_widgets.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
@@ -200,17 +201,11 @@ void showCommentDialog(BuildContext context, commentCallback(comment)) {
|
|||||||
|
|
||||||
Widget getStatus(String status) {
|
Widget getStatus(String status) {
|
||||||
return status == "Delivered"
|
return status == "Delivered"
|
||||||
? Chip(
|
? Text(
|
||||||
backgroundColor: Colors.green,
|
status,
|
||||||
avatar: Icon(
|
style: TextStyle(
|
||||||
Icons.check,
|
color: primaryColor, fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
color: Colors.white,
|
)
|
||||||
size: 14,
|
|
||||||
),
|
|
||||||
label: Text(
|
|
||||||
status,
|
|
||||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
|
||||||
))
|
|
||||||
: status == "rejected"
|
: status == "rejected"
|
||||||
? Chip(
|
? Chip(
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
@@ -243,12 +238,14 @@ Widget getStatus(String status) {
|
|||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: FontWeight.bold),
|
fontWeight: FontWeight.bold),
|
||||||
)
|
)
|
||||||
: status == "Pending" || status == "Rescheduled"
|
: status == "Pending" ||
|
||||||
|
status == "Rescheduled" ||
|
||||||
|
status == "Processing"
|
||||||
? Row(
|
? Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(Icons.schedule),
|
child: Icon(Icons.schedule, color: primaryColor),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
status,
|
status,
|
||||||
@@ -259,12 +256,13 @@ Widget getStatus(String status) {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: status == "Assigned"
|
: status == "Ready to ship"
|
||||||
? Row(
|
? Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(Icons.check),
|
child: Icon(Ionicons.ios_airplane,
|
||||||
|
color: primaryColor),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
status,
|
status,
|
||||||
@@ -275,26 +273,60 @@ Widget getStatus(String status) {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: status == "Canceled"
|
: status == "Received"
|
||||||
? Text(
|
? Row(
|
||||||
status,
|
children: <Widget>[
|
||||||
style: TextStyle(
|
Padding(
|
||||||
color: primaryColor,
|
padding: const EdgeInsets.all(8.0),
|
||||||
fontSize: 18,
|
child: Icon(
|
||||||
fontWeight: FontWeight.bold),
|
MaterialCommunityIcons.package_down,
|
||||||
)
|
color: primaryColor)),
|
||||||
: status == "Delivered"
|
Text(
|
||||||
? Text(
|
|
||||||
status,
|
status,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.green, fontSize: 12),
|
color: primaryColor,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
)
|
)
|
||||||
: Chip(
|
],
|
||||||
avatar: Icon(
|
)
|
||||||
Icons.check,
|
: status == "Assigned"
|
||||||
size: 14,
|
? Row(
|
||||||
),
|
children: <Widget>[
|
||||||
label: Text(status));
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Icon(Icons.check),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
status,
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: status == "Canceled"
|
||||||
|
? Text(
|
||||||
|
status,
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor,
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
)
|
||||||
|
: status == "Delivered"
|
||||||
|
? Text(
|
||||||
|
status,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.green,
|
||||||
|
fontSize: 12),
|
||||||
|
)
|
||||||
|
: Chip(
|
||||||
|
avatar: Icon(
|
||||||
|
Icons.check,
|
||||||
|
size: 14,
|
||||||
|
),
|
||||||
|
label: Text(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
call(BuildContext context, String phone) {
|
call(BuildContext context, String phone) {
|
||||||
|
|||||||
271
lib/pages_fcs/package_editor.dart
Normal file
271
lib/pages_fcs/package_editor.dart
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
import 'package:fcs/model/main_model.dart';
|
||||||
|
import 'package:fcs/model/pickup_model.dart';
|
||||||
|
import 'package:fcs/pages/util.dart';
|
||||||
|
import 'package:fcs/vo/package.dart';
|
||||||
|
import 'package:fcs/vo/pickup.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:fcs/widget/localization/app_translations.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
|
||||||
|
import '../theme/theme.dart';
|
||||||
|
|
||||||
|
class PackageEditor extends StatefulWidget {
|
||||||
|
final Package package;
|
||||||
|
PackageEditor({this.package});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PackageEditorState createState() => _PackageEditorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageEditorState extends State<PackageEditor> {
|
||||||
|
TextEditingController _addressEditingController = new TextEditingController();
|
||||||
|
TextEditingController _fromTimeEditingController =
|
||||||
|
new TextEditingController();
|
||||||
|
TextEditingController _toTimeEditingController = new TextEditingController();
|
||||||
|
TextEditingController _noOfPackageEditingController =
|
||||||
|
new TextEditingController();
|
||||||
|
TextEditingController _weightEditingController = new TextEditingController();
|
||||||
|
|
||||||
|
Package _package;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.package != null) {
|
||||||
|
_package = widget.package;
|
||||||
|
// _addressEditingController.text = _pickUp.address;
|
||||||
|
// _fromTimeEditingController.text = _pickUp.fromTime;
|
||||||
|
// _toTimeEditingController.text = _pickUp.toTime;
|
||||||
|
// _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
|
||||||
|
// _weightEditingController.text = _pickUp.weight.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var pickupModel = Provider.of<PickUpModel>(context);
|
||||||
|
|
||||||
|
final pickUpAddress = Container(
|
||||||
|
child: TextFormField(
|
||||||
|
maxLines: null,
|
||||||
|
controller: _addressEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
style: textStyle,
|
||||||
|
minLines: 2,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'Pickup Address',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
final pickupTime = Container(
|
||||||
|
height: 50.0,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 70.0,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _fromTimeEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'From',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(' - '),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 70.0,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _toTimeEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'To',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
final noOfPackageBox = Container(
|
||||||
|
height: 50.0,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _noOfPackageEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'Number of Packages',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
final weightBox = Container(
|
||||||
|
height: 50.0,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _weightEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'Total Weight (lb)',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: Text(AppTranslations.of(context).text("package.edit.title")),
|
||||||
|
),
|
||||||
|
body: Card(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: ListView(children: <Widget>[
|
||||||
|
DropdownButtonFormField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Colors.white,
|
||||||
|
labelText: 'Shipment Number',
|
||||||
|
icon: Icon(Icons.pages)
|
||||||
|
// prefixIcon: Icon(Icons.play_arrow)
|
||||||
|
),
|
||||||
|
items: ["A102", "A103"]
|
||||||
|
.map((e) => DropdownMenuItem(child: Text(e), value: e))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (map) => {},
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "FCS383-283-1",
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Colors.white,
|
||||||
|
labelText: 'FCS_ID',
|
||||||
|
hintText: 'FCS_ID',
|
||||||
|
filled: true,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.account_box,
|
||||||
|
),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(Icons.search), onPressed: () {})),
|
||||||
|
),
|
||||||
|
DropdownButtonFormField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Colors.white,
|
||||||
|
labelText: 'Cargo Type',
|
||||||
|
icon: Icon(Icons.pages)
|
||||||
|
// prefixIcon: Icon(Icons.play_arrow)
|
||||||
|
),
|
||||||
|
items: ["A102", "A103"]
|
||||||
|
.map((e) => DropdownMenuItem(child: Text(e), value: e))
|
||||||
|
.toList(),
|
||||||
|
onChanged: (map) => {},
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "0",
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Colors.white,
|
||||||
|
labelText: 'Weight',
|
||||||
|
filled: true,
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.weightHanging,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
TextFormField(
|
||||||
|
initialValue: "P0203",
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Colors.white,
|
||||||
|
labelText: 'Pickup ID',
|
||||||
|
filled: true,
|
||||||
|
icon: Icon(
|
||||||
|
Icons.account_box,
|
||||||
|
),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: Icon(Icons.search), onPressed: () {})),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
)),
|
||||||
|
widget.package == null
|
||||||
|
? Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 250,
|
||||||
|
child: FlatButton(
|
||||||
|
child: Text('Create package'),
|
||||||
|
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('Save package'),
|
||||||
|
color: primaryColor,
|
||||||
|
textColor: Colors.white,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
))),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
137
lib/pages_fcs/package_list.dart
Normal file
137
lib/pages_fcs/package_list.dart
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
import 'package:fcs/model/pickup_model.dart';
|
||||||
|
import 'package:fcs/model_fcs/package_model.dart';
|
||||||
|
import 'package:fcs/pages/pickup_list_row.dart';
|
||||||
|
import 'package:fcs/pages/search_page.dart';
|
||||||
|
import 'package:fcs/pages_fcs/package_editor.dart';
|
||||||
|
import 'package:fcs/pages_fcs/package_list_row.dart';
|
||||||
|
import 'package:fcs/vo/buyer.dart';
|
||||||
|
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:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../theme/theme.dart';
|
||||||
|
import 'pickup_editor.dart';
|
||||||
|
|
||||||
|
class PackageList extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_PackageListState createState() => _PackageListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageListState extends State<PackageList> {
|
||||||
|
Buyer buyer;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: DefaultTabController(
|
||||||
|
length: 2,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: Text(AppTranslations.of(context).text("package.title")),
|
||||||
|
actions: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
iconSize: 30,
|
||||||
|
onPressed: () => showPlacesSearch(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
bottom: TabBar(
|
||||||
|
unselectedLabelColor: Colors.grey,
|
||||||
|
tabs: [
|
||||||
|
Tab(
|
||||||
|
text: "Upcoming",
|
||||||
|
),
|
||||||
|
Tab(text: "Completed"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton.extended(
|
||||||
|
onPressed: () {
|
||||||
|
_newPickup();
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.add),
|
||||||
|
label: Text(AppTranslations.of(context).text("package.new")),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
body: TabBarView(
|
||||||
|
children: [
|
||||||
|
_upComing(),
|
||||||
|
_completed(),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_newPickup() {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
BottomUpPageRoute(PackageEditor()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _upComing() {
|
||||||
|
var packageModel = Provider.of<PackageModel>(context);
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
padding: EdgeInsets.only(top: 15),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: packageModel.upcoming.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return PackageListRow(package: packageModel.upcoming[index]);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _completed() {
|
||||||
|
var packageModel = Provider.of<PackageModel>(context);
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
padding: EdgeInsets.only(top: 15),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: packageModel.completed.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return PackageListRow(package: packageModel.completed[index]);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
108
lib/pages_fcs/package_list_row.dart
Normal file
108
lib/pages_fcs/package_list_row.dart
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
import 'package:fcs/pages/util.dart';
|
||||||
|
import 'package:fcs/pages_fcs/package_editor.dart';
|
||||||
|
import 'package:fcs/vo/package.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
class PackageListRow extends StatefulWidget {
|
||||||
|
final Package package;
|
||||||
|
const PackageListRow({this.package});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PackageListRowtate createState() => _PackageListRowtate();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PackageListRowtate extends State<PackageListRow> {
|
||||||
|
final double dotSize = 15.0;
|
||||||
|
Package _package = new Package();
|
||||||
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_package = widget.package;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(left: 15, right: 15),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => PackageEditor(package: _package)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||||
|
child: new Row(
|
||||||
|
children: <Widget>[
|
||||||
|
new Expanded(
|
||||||
|
child: new Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
_package.packageNumber == null
|
||||||
|
? ''
|
||||||
|
: _package.packageNumber,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0, color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
||||||
|
child: new Text(
|
||||||
|
dateFormat.format(_package.arrivedDate),
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
child: getStatus(_package.status),
|
||||||
|
),
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
272
lib/pages_fcs/pickup_editor.dart
Normal file
272
lib/pages_fcs/pickup_editor.dart
Normal file
@@ -0,0 +1,272 @@
|
|||||||
|
import 'package:fcs/model/main_model.dart';
|
||||||
|
import 'package:fcs/model/pickup_model.dart';
|
||||||
|
import 'package:fcs/pages/util.dart';
|
||||||
|
import 'package:fcs/vo/pickup.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:fcs/widget/localization/app_translations.dart';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
|
||||||
|
import '../theme/theme.dart';
|
||||||
|
|
||||||
|
class PickUpEditor extends StatefulWidget {
|
||||||
|
final PickUp pickUp;
|
||||||
|
PickUpEditor({this.pickUp});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PickUpEditorState createState() => _PickUpEditorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PickUpEditorState extends State<PickUpEditor> {
|
||||||
|
TextEditingController _addressEditingController = new TextEditingController();
|
||||||
|
TextEditingController _fromTimeEditingController =
|
||||||
|
new TextEditingController();
|
||||||
|
TextEditingController _toTimeEditingController = new TextEditingController();
|
||||||
|
TextEditingController _noOfPackageEditingController =
|
||||||
|
new TextEditingController();
|
||||||
|
TextEditingController _weightEditingController = new TextEditingController();
|
||||||
|
|
||||||
|
PickUp _pickUp;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.pickUp != null) {
|
||||||
|
_pickUp = widget.pickUp;
|
||||||
|
_addressEditingController.text = _pickUp.address;
|
||||||
|
_fromTimeEditingController.text = _pickUp.fromTime;
|
||||||
|
_toTimeEditingController.text = _pickUp.toTime;
|
||||||
|
_noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
|
||||||
|
_weightEditingController.text = _pickUp.weight.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var pickupModel = Provider.of<PickUpModel>(context);
|
||||||
|
|
||||||
|
final pickUpAddress = Container(
|
||||||
|
child: TextFormField(
|
||||||
|
maxLines: null,
|
||||||
|
controller: _addressEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
style: textStyle,
|
||||||
|
minLines: 2,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'Pickup Address',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
final pickupTime = Container(
|
||||||
|
height: 50.0,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Container(
|
||||||
|
width: 70.0,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _fromTimeEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'From',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(' - '),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 70.0,
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _toTimeEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'To',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
final noOfPackageBox = Container(
|
||||||
|
height: 50.0,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _noOfPackageEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'Number of Packages',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
final weightBox = Container(
|
||||||
|
height: 50.0,
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: TextFormField(
|
||||||
|
controller: _weightEditingController,
|
||||||
|
cursorColor: primaryColor,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
decoration: new InputDecoration(
|
||||||
|
labelText: 'Total Weight (lb)',
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
|
||||||
|
MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
|
|
||||||
|
return LocalProgress(
|
||||||
|
inAsyncCall: _isLoading,
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
leading: new IconButton(
|
||||||
|
icon: new Icon(Icons.close),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
title: Text(AppTranslations.of(context).text("pickup.edit.title")),
|
||||||
|
),
|
||||||
|
body: Card(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: ListView(children: <Widget>[
|
||||||
|
Center(child: nameWidget(mainModel.customer.name)),
|
||||||
|
phoneWidget(context, mainModel.customer.phoneNumber),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
|
child: Icon(Icons.location_on),
|
||||||
|
),
|
||||||
|
Expanded(child: pickUpAddress),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 25),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
|
child: Icon(Icons.timer),
|
||||||
|
),
|
||||||
|
Text('Pickup Time',
|
||||||
|
style: TextStyle(color: Colors.grey, fontSize: 18)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(height: 5),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 33),
|
||||||
|
child: pickupTime,
|
||||||
|
),
|
||||||
|
SizedBox(height: 15),
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 8.0),
|
||||||
|
child: Icon(Octicons.package),
|
||||||
|
),
|
||||||
|
Expanded(child: noOfPackageBox),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
fcsInput("Total Weight (lb)", FontAwesomeIcons.weightHanging),
|
||||||
|
SizedBox(
|
||||||
|
height: 15,
|
||||||
|
),
|
||||||
|
widget.pickUp != null
|
||||||
|
? fcsDropDown("Assigned", MaterialCommunityIcons.worker)
|
||||||
|
: Container(),
|
||||||
|
fcsInput("Remark", MaterialCommunityIcons.note)
|
||||||
|
]),
|
||||||
|
)),
|
||||||
|
widget.pickUp == null
|
||||||
|
? Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 250,
|
||||||
|
child: FlatButton(
|
||||||
|
child: Text('Request for pickup'),
|
||||||
|
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('Update'),
|
||||||
|
color: primaryColor,
|
||||||
|
textColor: Colors.white,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
))),
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 250,
|
||||||
|
child: FlatButton(
|
||||||
|
child: Text('Cancel Pickup'),
|
||||||
|
color: Colors.grey[600],
|
||||||
|
textColor: Colors.white,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)))
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
42
lib/vo/package.dart
Normal file
42
lib/vo/package.dart
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
class Package {
|
||||||
|
String id;
|
||||||
|
String shipmentNumber;
|
||||||
|
String senderFCSID;
|
||||||
|
String senderName;
|
||||||
|
String receiverFCSID;
|
||||||
|
String receiverName;
|
||||||
|
String receiverAddress;
|
||||||
|
String receiverNumber;
|
||||||
|
String boxNumber;
|
||||||
|
String status;
|
||||||
|
|
||||||
|
int rate;
|
||||||
|
int weight;
|
||||||
|
String packageType;
|
||||||
|
String pickUpID;
|
||||||
|
List<String> photos;
|
||||||
|
String remark;
|
||||||
|
DateTime arrivedDate;
|
||||||
|
|
||||||
|
String get packageNumber =>
|
||||||
|
shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
|
||||||
|
double get price => rate.toDouble() * weight;
|
||||||
|
|
||||||
|
Package(
|
||||||
|
{this.id,
|
||||||
|
this.shipmentNumber,
|
||||||
|
this.senderFCSID,
|
||||||
|
this.senderName,
|
||||||
|
this.receiverFCSID,
|
||||||
|
this.receiverName,
|
||||||
|
this.receiverNumber,
|
||||||
|
this.receiverAddress,
|
||||||
|
this.boxNumber,
|
||||||
|
this.rate,
|
||||||
|
this.weight,
|
||||||
|
this.packageType,
|
||||||
|
this.pickUpID,
|
||||||
|
this.remark,
|
||||||
|
this.status,
|
||||||
|
this.arrivedDate});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user