Merge branch 'master' of tzw/fcs into master

This commit is contained in:
2020-06-26 00:46:44 +00:00
committed by Gogs
18 changed files with 797 additions and 300 deletions

View File

@@ -516,6 +516,10 @@
"rate.cal.title":"ESTIMATE SHIPPING COST", "rate.cal.title":"ESTIMATE SHIPPING COST",
"cargo.form.title":"CARGO",
"cargo.type":"Cargo Type",
"cargo.weight":"Weight",
"boxes.name":"Boxes", "boxes.name":"Boxes",
"boxes.title":"BOXES", "boxes.title":"BOXES",
"boxes.new":"New Box", "boxes.new":"New Box",

View File

@@ -563,6 +563,10 @@
"rate.cal.title":"အဆင့်သတ်မှတ်ချက်များတွက်ချက်ရန်", "rate.cal.title":"အဆင့်သတ်မှတ်ချက်များတွက်ချက်ရန်",
"cargo.form.title":"ကုန်ပစ္စည်းအမျိုးအစား",
"cargo.type":"ကုန်ပစ္စည်းအမျိုးအစား",
"cargo.weight":"အလေးချိန်",
"message.btn":"အသိပေးချက်များ", "message.btn":"အသိပေးချက်များ",
"message.title":"အသိပေးချက်များ", "message.title":"အသိပေးချက်များ",

View File

@@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/vo/cargo.dart';
import 'package:fcs/vo/fcs_profile.dart'; import 'package:fcs/vo/fcs_profile.dart';
import 'package:fcs/vo/pickup.dart'; import 'package:fcs/vo/pickup.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
@@ -33,7 +34,12 @@ class PickUpModel extends BaseModel {
status: 'Pending', status: 'Pending',
date: DateTime(2020, 5, 1), date: DateTime(2020, 5, 1),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
PickUp( PickUp(
id: "P200125 - 12 May 2020", id: "P200125 - 12 May 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -45,7 +51,12 @@ class PickUpModel extends BaseModel {
status: 'Assigned', status: 'Assigned',
date: DateTime(2020, 5, 6), date: DateTime(2020, 5, 6),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
PickUp( PickUp(
id: "P200441 - 13 Apr 2020", id: "P200441 - 13 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -57,7 +68,12 @@ class PickUpModel extends BaseModel {
status: "Pickuped", status: "Pickuped",
date: DateTime(2020, 5, 9), date: DateTime(2020, 5, 9),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
PickUp( PickUp(
id: "P200412 - 12 Apr 2020", id: "P200412 - 12 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -69,7 +85,12 @@ class PickUpModel extends BaseModel {
status: 'Pickuped', status: 'Pickuped',
date: DateTime(2020, 5, 15), date: DateTime(2020, 5, 15),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
PickUp( PickUp(
id: "P200125 - 12 May 2020", id: "P200125 - 12 May 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -81,7 +102,12 @@ class PickUpModel extends BaseModel {
status: 'Pickuped', status: 'Pickuped',
date: DateTime(2020, 5, 20), date: DateTime(2020, 5, 20),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
PickUp( PickUp(
id: "P200441 - 13 Apr 2020", id: "P200441 - 13 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -93,7 +119,12 @@ class PickUpModel extends BaseModel {
status: "Pickuped", status: "Pickuped",
date: DateTime(2020, 5, 21), date: DateTime(2020, 5, 21),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
PickUp( PickUp(
id: "P200441 - 10 Apr 2020", id: "P200441 - 10 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -105,7 +136,12 @@ class PickUpModel extends BaseModel {
status: "Canceled", status: "Canceled",
date: DateTime(2020, 5, 25), date: DateTime(2020, 5, 25),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
PickUp( PickUp(
id: "P200441 - 6 Apr 2020", id: "P200441 - 6 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -117,7 +153,12 @@ class PickUpModel extends BaseModel {
status: "Canceled", status: "Canceled",
date: DateTime(2020, 5, 27), date: DateTime(2020, 5, 27),
address: '154-19 64th Ave.\nFlushing, NY 11367', address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000), handlingFee: 5000,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
]; ];
List<PickUp> get canceled { List<PickUp> get canceled {

View File

@@ -77,14 +77,14 @@ class ShipmentModel extends BaseModel {
List<ShippingAddress> shippingAddresses = [ List<ShippingAddress> shippingAddresses = [
ShippingAddress( ShippingAddress(
fullName: 'FCS-0203-390-2', fullName: 'U Nyi Nyi',
addressLine1: '154-19 64th Ave.', addressLine1: '154-19 64th Ave.',
addressLine2: 'Flushing', addressLine2: 'Flushing',
city: 'NY', city: 'NY',
state: 'NY', state: 'NY',
phoneNumber: '+1 (292)215-2247'), phoneNumber: '+1 (292)215-2247'),
ShippingAddress( ShippingAddress(
fullName: 'FCS-0204-390-2', fullName: 'Mg Myo',
addressLine1: '153-154 5th Thitsar.', addressLine1: '153-154 5th Thitsar.',
addressLine2: 'Flushing', addressLine2: 'Flushing',
city: 'Yangon', city: 'Yangon',

View File

@@ -4,6 +4,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/model/base_model.dart'; import 'package:fcs/model/base_model.dart';
import 'package:fcs/model_fcs/package_model.dart'; import 'package:fcs/model_fcs/package_model.dart';
import 'package:fcs/vo/box.dart'; import 'package:fcs/vo/box.dart';
import 'package:fcs/vo/cargo.dart';
import 'package:fcs/vo/package.dart'; import 'package:fcs/vo/package.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
@@ -21,6 +22,7 @@ class BoxModel extends BaseModel {
PackageModel.packages[1], PackageModel.packages[1],
PackageModel.packages[2] PackageModel.packages[2]
]; ];
List<Box> boxes = [ List<Box> boxes = [
Box( Box(
shipmentNumber: "A202", shipmentNumber: "A202",
@@ -29,13 +31,21 @@ class BoxModel extends BaseModel {
boxNumber: "1", boxNumber: "1",
rate: 7, rate: 7,
packageType: "General", packageType: "General",
weight: 25, weight: 75,
status: "Packed", status: "Packed",
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon', receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
cargoDesc: "Clothes", cargoDesc: "Clothes",
arrivedDate: DateTime(2020, 6, 1), arrivedDate: DateTime(2020, 6, 1),
width: 10,
height: 10,
length: 10,
packages: packages, packages: packages,
statusHistory: statusHistory), statusHistory: statusHistory,
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
Box( Box(
shipmentNumber: "A202", shipmentNumber: "A202",
receiverNumber: "3", receiverNumber: "3",
@@ -43,13 +53,21 @@ class BoxModel extends BaseModel {
boxNumber: "2", boxNumber: "2",
rate: 7, rate: 7,
packageType: "General", packageType: "General",
weight: 20, weight: 75,
status: "Packed", status: "Packed",
cargoDesc: "Clothes", cargoDesc: "Clothes",
arrivedDate: DateTime(2020, 6, 1), arrivedDate: DateTime(2020, 6, 1),
width: 10,
height: 10,
length: 10,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'), receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
Box( Box(
shipmentNumber: "A202", shipmentNumber: "A202",
receiverNumber: "3", receiverNumber: "3",
@@ -57,13 +75,21 @@ class BoxModel extends BaseModel {
boxNumber: "3", boxNumber: "3",
rate: 7, rate: 7,
packageType: "General", packageType: "General",
weight: 15, weight: 75,
cargoDesc: "Shoes", cargoDesc: "Shoes",
status: "Packed", status: "Packed",
arrivedDate: DateTime(2020, 6, 1), arrivedDate: DateTime(2020, 6, 1),
width: 10,
height: 10,
length: 10,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon'), receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
Box( Box(
shipmentNumber: "A202", shipmentNumber: "A202",
receiverNumber: "2", receiverNumber: "2",
@@ -71,13 +97,21 @@ class BoxModel extends BaseModel {
boxNumber: "1", boxNumber: "1",
rate: 8, rate: 8,
packageType: "Medicine", packageType: "Medicine",
weight: 15, weight: 75,
status: "Packed", status: "Packed",
cargoDesc: "Dietary supplement", cargoDesc: "Dietary supplement",
arrivedDate: DateTime(2020, 6, 1), arrivedDate: DateTime(2020, 6, 1),
width: 10,
height: 10,
length: 10,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'), receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
Box( Box(
shipmentNumber: "A202", shipmentNumber: "A202",
receiverNumber: "2", receiverNumber: "2",
@@ -86,12 +120,20 @@ class BoxModel extends BaseModel {
rate: 7, rate: 7,
packageType: "General", packageType: "General",
cargoDesc: "Handbags", cargoDesc: "Handbags",
weight: 55, weight: 75,
status: "Shipped", status: "Shipped",
arrivedDate: DateTime(2020, 6, 1), arrivedDate: DateTime(2020, 6, 1),
width: 10,
height: 10,
length: 10,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon'), receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
Box( Box(
shipmentNumber: "A201", shipmentNumber: "A201",
receiverNumber: "1", receiverNumber: "1",
@@ -100,12 +142,20 @@ class BoxModel extends BaseModel {
rate: 9, rate: 9,
packageType: "Dangerous", packageType: "Dangerous",
cargoDesc: "Phones and Scooters", cargoDesc: "Phones and Scooters",
weight: 25, weight: 75,
status: "Delivered", status: "Delivered",
arrivedDate: DateTime(2020, 5, 21), arrivedDate: DateTime(2020, 5, 21),
width: 10,
height: 10,
length: 10,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'), receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
Box( Box(
shipmentNumber: "A201", shipmentNumber: "A201",
receiverNumber: "1", receiverNumber: "1",
@@ -114,12 +164,20 @@ class BoxModel extends BaseModel {
rate: 7, rate: 7,
packageType: "General", packageType: "General",
cargoDesc: "Construction tools", cargoDesc: "Construction tools",
weight: 5, weight: 75,
status: "Delivered", status: "Delivered",
arrivedDate: DateTime(2020, 5, 21), arrivedDate: DateTime(2020, 5, 21),
width: 10,
height: 10,
length: 10,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon'), receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
cargoTypes: [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
]),
]; ];
List<Box> get completed { List<Box> get completed {

View File

@@ -1,6 +1,7 @@
import 'package:fcs/model/main_model.dart'; import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/pickup_model.dart'; import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/pages/util.dart'; import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/cargo.dart';
import 'package:fcs/vo/pickup.dart'; import 'package:fcs/vo/pickup.dart';
import 'package:fcs/widget/fcs_text_field.dart'; import 'package:fcs/widget/fcs_text_field.dart';
import 'package:fcs/widget/fcs_text_field_readonly.dart'; import 'package:fcs/widget/fcs_text_field_readonly.dart';
@@ -70,6 +71,12 @@ class _PickUpEditorState extends State<PickUpEditor> {
mainModel.recipient.shippingAddress; mainModel.recipient.shippingAddress;
} else { } else {
isNew = true; isNew = true;
List<Cargo> _cargoTypes = [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
];
_pickUp = PickUp(cargoTypes: _cargoTypes);
} }
} }
@@ -319,50 +326,56 @@ class _PickUpEditorState extends State<PickUpEditor> {
], ],
), ),
// ExpansionTile( // ExpansionTile(
// title: Text('Recipient Information'), // title: Text('Box Information'),
// children: <Widget>[ // children: <Widget>[
// Padding( // SizedBox(height: 10.0),
// padding: const EdgeInsets.only(left: 20.0),
// child: widget.pickUp == null
// ? fcsInput("Name", FontAwesomeIcons.user,
// controller: _recipientNameEditingController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput("Name", FontAwesomeIcons.user,
// controller:
// _recipientNameEditingController)
// : fcsInputReadOnly(
// "Name", FontAwesomeIcons.user,
// controller:
// _recipientNameEditingController)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0),
// child: widget.pickUp == null
// ? fcsInput("Phone Number", Icons.phone,
// controller: _recipientPhoneEditingController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput("Phone Number", Icons.phone,
// controller:
// _recipientPhoneEditingController)
// : fcsInputReadOnly(
// "Phone Number", Icons.phone,
// controller:
// _recipientPhoneEditingController)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0),
// child: widget.pickUp == null
// ? fcsInput("Address", Icons.location_on,
// controller:
// _recipientAddressEditingController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput("Address", Icons.location_on,
// controller:
// _recipientAddressEditingController)
// : fcsInputReadOnly(
// "Address", Icons.location_on,
// controller:
// _recipientAddressEditingController)),
// ], // ],
// ), // ),
ExpansionTile(
title: Text('Shipping Address'),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput("Name", FontAwesomeIcons.user,
controller: _recipientNameEditingController)
: widget.pickUp.status == 'Pending'
? fcsInput("Name", FontAwesomeIcons.user,
controller:
_recipientNameEditingController)
: fcsInputReadOnly(
"Name", FontAwesomeIcons.user,
controller:
_recipientNameEditingController)),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput("Phone Number", Icons.phone,
controller: _recipientPhoneEditingController)
: widget.pickUp.status == 'Pending'
? fcsInput("Phone Number", Icons.phone,
controller:
_recipientPhoneEditingController)
: fcsInputReadOnly(
"Phone Number", Icons.phone,
controller:
_recipientPhoneEditingController)),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput("Address", Icons.location_on,
controller:
_recipientAddressEditingController)
: widget.pickUp.status == 'Pending'
? fcsInput("Address", Icons.location_on,
controller:
_recipientAddressEditingController)
: fcsInputReadOnly(
"Address", Icons.location_on,
controller:
_recipientAddressEditingController)),
],
),
mainModel.isCustomer() mainModel.isCustomer()
? Container() ? Container()
: ExpansionTile( : ExpansionTile(
@@ -421,7 +434,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
child: Container( child: Container(
width: 250, width: 250,
child: FlatButton( child: FlatButton(
child: Text('Update'), child: Text('Assign'),
color: primaryColor, color: primaryColor,
textColor: Colors.white, textColor: Colors.white,
onPressed: () { onPressed: () {
@@ -429,6 +442,20 @@ class _PickUpEditorState extends State<PickUpEditor> {
}, },
), ),
))), ))),
Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Complete Pickup '),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
))),
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: Center( child: Center(

View File

@@ -4,6 +4,7 @@ import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/local_text.dart'; import 'package:fcs/widget/local_text.dart';
import 'package:fcs/widget/my_data_table.dart'; import 'package:fcs/widget/my_data_table.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:fcs/model/language_model.dart'; import 'package:fcs/model/language_model.dart';
@@ -214,52 +215,55 @@ class _ProfileState extends State<Profile> {
), ),
)); ));
final logoutbutton = Padding( final logoutbutton = Container(
padding: EdgeInsets.symmetric(vertical: 10.0), padding: EdgeInsets.only( left: 20.0, right: 24.0),
child: Card( child: Padding(
elevation: 23, padding: EdgeInsets.symmetric(vertical: 10.0),
child: Container( child: Card(
height: 45.0, elevation: 23,
child: ButtonTheme( child: Container(
minWidth: 900.0, height: 45.0,
height: 100.0, child: ButtonTheme(
child: FlatButton.icon( minWidth: 900.0,
onPressed: () { height: 100.0,
showConfirmDialog(context, "profile.logout.confirm", child: FlatButton.icon(
() async { onPressed: () {
setState(() { showConfirmDialog(context, "profile.logout.confirm",
_isLoading = true; () async {
});
await mainModel.logout();
Navigator.of(context).pushNamedAndRemoveUntil(
"/home", ModalRoute.withName('/home'));
Future.delayed(Duration(seconds: 1), () {
if (mounted) {
setState(() { setState(() {
_isLoading = false; _isLoading = true;
}); });
} await mainModel.logout();
}); Navigator.of(context).pushNamedAndRemoveUntil(
}); "/home", ModalRoute.withName('/home'));
}, Future.delayed(Duration(seconds: 1), () {
label: Text(AppTranslations.of(context).text("profile.logout"), if (mounted) {
style: languageModel.isEng setState(() {
? TextStyle( _isLoading = false;
fontSize: 16.0, });
fontWeight: FontWeight.bold, }
fontStyle: FontStyle.normal) });
: TextStyle( });
fontSize: 16.0, },
fontWeight: FontWeight.bold, label: Text(
fontStyle: FontStyle.normal, AppTranslations.of(context).text("profile.logout"),
fontFamily: "MyanmarUnicode")), style: languageModel.isEng
icon: Icon( ? TextStyle(
Icons.exit_to_app, fontSize: 16.0,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal)
: TextStyle(
fontSize: 16.0,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
fontFamily: "MyanmarUnicode")),
icon: Icon(
Icons.exit_to_app,
),
),
), ),
), ),
), )));
),
));
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
@@ -270,32 +274,37 @@ class _ProfileState extends State<Profile> {
backgroundColor: primaryColor, backgroundColor: primaryColor,
actions: <Widget>[], actions: <Widget>[],
), ),
body: ListView( body: Column(
// padding: EdgeInsets.only(left: 25.0, right: 25.0),
shrinkWrap: true,
children: <Widget>[ children: <Widget>[
Row( Expanded(
children: <Widget>[ child: ListView(
namebox, // padding: EdgeInsets.only(left: 25.0, right: 25.0),
Padding( shrinkWrap: true,
padding: const EdgeInsets.only(left: 18.0), children: <Widget>[
child: Icon(Icons.edit), Row(
) children: <Widget>[
], namebox,
), Padding(
mainModel.isBuyer() ? Container() : getPrivilegeBox(context), padding: const EdgeInsets.only(left: 18.0),
phonenumberbox, child: Icon(Icons.edit),
mainModel.user == null )
? Container() ],
: mainModel.user.email == null || mainModel.user.email == '' ),
? Container() mainModel.isBuyer() ? Container() : getPrivilegeBox(context),
: emailBox, phonenumberbox,
languageBox, mainModel.user == null
getShippingAddressList(context), ? Container()
SizedBox( : mainModel.user.email == null ||
height: 50, mainModel.user.email == ''
? Container()
: emailBox,
languageBox,
getShippingAddressList(context),
],
),
), ),
logoutbutton, logoutbutton,
SizedBox(height: 25)
], ],
), ),
), ),
@@ -313,41 +322,8 @@ class _ProfileState extends State<Profile> {
fontWeight: FontWeight.bold, fontStyle: FontStyle.normal), fontWeight: FontWeight.bold, fontStyle: FontStyle.normal),
), ),
children: <Widget>[ children: <Widget>[
Container( Column(
child: SingleChildScrollView( children: getAddressList(context, shipmentModel.shippingAddresses),
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 50,
columns: [
MyDataColumn(
label: Text(
"Full Name",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600],
),
)),
MyDataColumn(
label: Text(
"Phone Number",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600],
),
)),
MyDataColumn(
label: Text(
"Delete",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600],
),
)),
],
rows: getAddressRows(shipmentModel.shippingAddresses),
),
),
), ),
Container( Container(
padding: EdgeInsets.only(top: 20, bottom: 15, right: 15), padding: EdgeInsets.only(top: 20, bottom: 15, right: 15),
@@ -378,30 +354,75 @@ class _ProfileState extends State<Profile> {
); );
} }
List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) { List<Widget> getAddressList(
return addresses.map((s) { BuildContext context, List<ShippingAddress> addresses) {
return MyDataRow( return addresses.asMap().entries.map((s) {
onSelectChanged: (selected) { return Container(
Navigator.push( padding: EdgeInsets.only(left: 10, right: 10),
context, child: InkWell(
BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s)), onTap: () {
); Navigator.push(
}, context,
cells: [ BottomUpPageRoute(
MyDataCell( ShippingAddressEditor(shippingAddress: s.value)),
new Text( );
s.fullName, },
style: textStyle, child: Column(
), children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.all(5.0),
child: Icon(
SimpleLineIcons.location_pin,
color: primaryColor,
)),
new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
s.value.fullName == null
? ''
: s.value.fullName,
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
s.value.phoneNumber == null
? ''
: s.value.phoneNumber,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
],
),
],
),
),
),
IconButton(
padding: EdgeInsets.only(right: 30),
icon: Icon(Icons.delete, color: Colors.black45),
onPressed: null)
],
),
s.key == addresses.length - 1
? Container()
: Divider(color: Colors.black)
],
), ),
MyDataCell( ),
new Text(
s.phoneNumber,
style: textStyle,
),
),
MyDataCell(IconButton(icon: Icon(Icons.delete), onPressed: null)),
],
); );
}).toList(); }).toList();
} }

View File

@@ -157,6 +157,24 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
var shipmentModel = Provider.of<ShipmentModel>(context); var shipmentModel = Provider.of<ShipmentModel>(context);
MainModel mainModel = Provider.of<MainModel>(context); MainModel mainModel = Provider.of<MainModel>(context);
final cargoBtn = Container(
padding: EdgeInsets.only(top: 5),
child: Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Download Cargo Manifest'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
))),
);
final commercialBtn = Container( final commercialBtn = Container(
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
child: Align( child: Align(
@@ -296,7 +314,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
Container( Container(
padding: padding:
EdgeInsets.only(top: widget.shipment == null ? 5 : 0), EdgeInsets.only(top: widget.shipment == null ? 5 : 0),
child: fcsInput('Arrival Date', Icons.date_range, child: fcsInput('ETA', Icons.date_range,
controller: _arrivalDateController), controller: _arrivalDateController),
), ),
Container( Container(
@@ -378,6 +396,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
widget.shipment == null ? Container() : commercialBtn, widget.shipment == null ? Container() : commercialBtn,
widget.shipment == null ? Container() : packingBtn, widget.shipment == null ? Container() : packingBtn,
widget.shipment == null ? Container() : dmsBtn, widget.shipment == null ? Container() : dmsBtn,
widget.shipment == null ? Container() : cargoBtn,
widget.shipment == null ? createBtn : updateBtn, widget.shipment == null ? createBtn : updateBtn,
SizedBox(height: 15) SizedBox(height: 15)
]), ]),

View File

@@ -105,6 +105,7 @@ class _ShipmentRatesState extends State<ShipmentRates> {
_row("Free delivery within Yangon \nfor shipments over", "10", _row("Free delivery within Yangon \nfor shipments over", "10",
"pounds"), "pounds"),
_row("Delivery fees", "\$ 5", "below 10 pounds"), _row("Delivery fees", "\$ 5", "below 10 pounds"),
_row("Volumetric Ratio", "\$ 166.36", "per pound"),
fcsButton(context, "Terms & Conditions", callack: () { fcsButton(context, "Terms & Conditions", callack: () {
Navigator.of(context) Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Term())); .push(MaterialPageRoute(builder: (_) => Term()));

View File

@@ -1,7 +1,4 @@
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/model/shipment_rate_model.dart'; import 'package:fcs/model/shipment_rate_model.dart';
import 'package:fcs/pages/shipment_rates_calculate.dart';
import 'package:fcs/pages/shipment_rates_edit.dart';
import 'package:fcs/vo/pickup.dart'; import 'package:fcs/vo/pickup.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:fcs/widget/localization/app_translations.dart'; import 'package:fcs/widget/localization/app_translations.dart';
@@ -10,7 +7,6 @@ import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart'; import 'package:fcs/widget/progress.dart';
import '../theme/theme.dart'; import '../theme/theme.dart';
import 'util.dart';
class ShipmentRatesCal extends StatefulWidget { class ShipmentRatesCal extends StatefulWidget {
final PickUp pickUp; final PickUp pickUp;
@@ -31,6 +27,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
PickUp _pickUp; PickUp _pickUp;
bool _isLoading = false; bool _isLoading = false;
String cargoType;
@override @override
void initState() { void initState() {
@@ -53,6 +50,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var shipmentRateModel = Provider.of<ShipmentRateModel>(context); var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
@@ -70,33 +68,74 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
body: Padding( body: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: ListView( child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( Container(
height: 185, padding: EdgeInsets.only(top: 5, left: 25),
child: ListView.builder( child: Row(
itemCount: shipmentRateModel.rates.length, children: <Widget>[
itemBuilder: (context, index) { Expanded(
return _row( child:
shipmentRateModel.rates[index].description + Text('Cargo Type', style: TextStyle(fontSize: 15))),
"\n\$ " + Container(
shipmentRateModel.rates[index].price.toString() + width: 150.0,
" per pound", child: DropdownButtonFormField(
'', decoration: InputDecoration(
"", fillColor: Colors.white,
input: true); hintText: shipmentRateModel.rates[0].description,
}), hintStyle: TextStyle(color: Colors.black87)),
items: shipmentRateModel.rates
.map((e) => DropdownMenuItem(
child: Text(e.description),
value: e.description))
.toList(),
onChanged: (selected) => {
setState(() {
cargoType = selected;
})
},
),
),
],
),
), ),
_row('Width (inches)', "", "", "10", input: true),
_row('Height', "", "", "10", input: true),
_row('Length', "", "", "10", input: true),
Container(
padding: EdgeInsets.only(left: 25, top: 15, bottom: 5),
child: Row(
children: <Widget>[
Text('Shipment Weight', style: TextStyle(fontSize: 15)),
Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(bottom: 3.0),
child: Text(
'6',
style:
TextStyle(color: primaryColor, fontSize: 16),
),
),
Text(
'pounds',
style: TextStyle(color: Colors.grey, fontSize: 16),
),
],
),
],
)),
SizedBox(height: 50), SizedBox(height: 50),
Center( Center(
child: Text( child: Text(
"Delivery fee:\$ 0", "Delivery fee:\$ 5",
style: TextStyle(color: primaryColor, fontSize: 16), style: TextStyle(color: primaryColor, fontSize: 16),
)), )),
SizedBox(height: 20), SizedBox(height: 20),
Center( Center(
child: Text( child: Text(
"Total estimated amount:\$ 95", "Total estimated amount:\$ 41",
style: TextStyle(color: primaryColor, fontSize: 20), style: TextStyle(color: primaryColor, fontSize: 20),
)) ))
], ],
@@ -106,7 +145,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
); );
} }
_row(String desc, String price, String unit, {bool input}) { _row(String desc, String price, String unit, String value, {bool input}) {
return Container( return Container(
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5), padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
child: Row( child: Row(
@@ -134,8 +173,9 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
width: 50, width: 50,
), ),
Container( Container(
width: 70, width: 150,
child: TextField( child: TextFormField(
initialValue: value,
textAlign: TextAlign.end, textAlign: TextAlign.end,
)), )),
], ],

View File

@@ -1,6 +1,11 @@
import 'package:fcs/model/pickup_model.dart'; import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/model/shipment_rate_model.dart'; import 'package:fcs/model/shipment_rate_model.dart';
import 'package:fcs/pages_fcs/cargo_editor.dart';
import 'package:fcs/vo/pickup.dart'; import 'package:fcs/vo/pickup.dart';
import 'package:fcs/vo/rate.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/local_text.dart';
import 'package:fcs/widget/my_data_table.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:fcs/widget/localization/app_translations.dart'; import 'package:fcs/widget/localization/app_translations.dart';
@@ -69,26 +74,88 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
), ),
body: Container( body: Container(
padding: EdgeInsets.all(18), padding: EdgeInsets.all(18),
child: ListView( child: Column(
children: <Widget>[ children: <Widget>[
Container( Expanded(
height: 190, child: ListView(
child: ListView.builder( children: <Widget>[
itemCount: shipmentRateModel.rates.length, fcsInput("Min Weight for Free delivery within Yangon",
itemBuilder: (context, index) { FontAwesomeIcons.weightHanging,
return fcsInput( value: "10"),
shipmentRateModel.rates[index].description, fcsInput("Delivery fees", Icons.attach_money, value: "5"),
Icons.attach_money, SizedBox(height: 10),
value: fcsInput("Volumetric Ratio", Icons.attach_money,
shipmentRateModel.rates[index].price.toString()); value: "166.36"),
}), SizedBox(height: 10),
ExpansionTile(
title: Text(
'Cargo Types',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 50,
columns: [
MyDataColumn(
label: Text("Cargo Type",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
MyDataColumn(
label: Text("Rate",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
MyDataColumn(
label: Text("Delete",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
],
rows: getCargoRows(shipmentRateModel.rates),
),
),
),
Container(
padding:
EdgeInsets.only(top: 20, bottom: 15, right: 15),
child: Align(
alignment: Alignment.bottomRight,
child: Container(
width: 120,
height: 40,
child: FloatingActionButton.extended(
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
icon: Icon(Icons.add),
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(CargoEditor()),
);
},
label: Text(
'Add Cargo',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
)
],
),
],
),
), ),
fcsInput("Min Weight for Free delivery within Yangon", fcsButton(context, "Save", callack: () {
FontAwesomeIcons.weightHanging, Navigator.pop(context);
value: "10"), }),
fcsInput("Delivery fees", Icons.attach_money, value: "5"),
SizedBox(height: 10),
fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10) SizedBox(height: 10)
], ],
), ),
@@ -97,6 +164,34 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
); );
} }
List<MyDataRow> getCargoRows(List<Rate> rates) {
return rates.map((r) {
return MyDataRow(
onSelectChanged: (selected) {
Navigator.push(
context,
BottomUpPageRoute(CargoEditor(rate: r)),
);
},
cells: [
MyDataCell(
new Text(
r.description,
style: textStyle,
),
),
MyDataCell(
new Text(
r.price.toString(),
style: textStyle,
),
),
MyDataCell(IconButton(icon: Icon(Icons.delete), onPressed: null)),
],
);
}).toList();
}
_row(String desc, String price, String unit) { _row(String desc, String price, String unit) {
return Container( return Container(
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5), padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),

View File

@@ -85,7 +85,7 @@ class _ShippingAddressEditorState extends State<ShippingAddressEditor> {
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 10.0,right: 10),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
usaAddress, usaAddress,
SizedBox(height: 10), SizedBox(height: 10),

View File

@@ -50,8 +50,12 @@ class _SplashScreenState extends State<SplashScreen> {
if (_loaded) { if (_loaded) {
timer.cancel(); timer.cancel();
if (this._isLogin) {
Navigator.of(context).pushReplacementNamed('/homeLogin');
} else {
Navigator.of(context).pushReplacementNamed('/home');
}
Navigator.of(context).pushReplacementNamed('/home');
// if (_isSupport) { // if (_isSupport) {
// if (_isLogin) { // if (_isLogin) {
// if (!_isAgree) { // if (!_isAgree) {

View File

@@ -3,6 +3,7 @@ import 'package:fcs/model_fcs/package_model.dart';
import 'package:fcs/pages/invoice/package_addition.dart'; import 'package:fcs/pages/invoice/package_addition.dart';
import 'package:fcs/pages/util.dart'; import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/box.dart'; import 'package:fcs/vo/box.dart';
import 'package:fcs/vo/cargo.dart';
import 'package:fcs/vo/package.dart'; import 'package:fcs/vo/package.dart';
import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/local_text.dart'; import 'package:fcs/widget/local_text.dart';
@@ -45,6 +46,8 @@ class _BoxEditorState extends State<BoxEditor> {
]; ];
bool isNew; bool isNew;
bool isMixBox = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -63,8 +66,22 @@ class _BoxEditorState extends State<BoxEditor> {
PackageModel.packages[2] PackageModel.packages[2]
]; ];
List<Cargo> _cargoTypes = [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
];
isNew = true; isNew = true;
_box = Box(rate: 0, weight: 0, packages: packages); _box = Box(
rate: 0,
weight: 75,
width: 0,
height: 0,
length: 0,
packages: packages,
cargoTypes: _cargoTypes,
);
} }
} }
@@ -166,6 +183,33 @@ class _BoxEditorState extends State<BoxEditor> {
onChanged: (map) => {}, onChanged: (map) => {},
), ),
), ),
Padding(
padding: const EdgeInsets.only(left: 8.0, right: 20),
child: new Row(
children: <Widget>[
new Checkbox(
value: isMixBox,
activeColor: primaryColor,
onChanged: (bool value) {
setState(() {
isMixBox = value;
});
}),
SizedBox(
width: 5,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
"Mix Box",
style: TextStyle(fontSize: 15.0),
),
],
),
],
),
),
Padding( Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20), padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField( child: TextFormField(
@@ -208,21 +252,21 @@ class _BoxEditorState extends State<BoxEditor> {
color: primaryColor, fontWeight: FontWeight.bold), color: primaryColor, fontWeight: FontWeight.bold),
), ),
children: [ children: [
Padding( // Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20), // padding: const EdgeInsets.only(left: 20.0, right: 20),
child: DropdownButtonFormField( // child: DropdownButtonFormField(
value: _box.packageType, // value: _box.packageType,
decoration: InputDecoration( // decoration: InputDecoration(
fillColor: Colors.white, // fillColor: Colors.white,
labelText: 'Cargo Type', // labelText: 'Cargo Type',
icon: Icon(Entypo.box, color: primaryColor)), // icon: Icon(Entypo.box, color: primaryColor)),
items: ["General", "Medicine", "Dangerous"] // items: ["General", "Medicine", "Dangerous"]
.map((e) => // .map((e) =>
DropdownMenuItem(child: Text(e), value: e)) // DropdownMenuItem(child: Text(e), value: e))
.toList(), // .toList(),
onChanged: (map) => {}, // onChanged: (map) => {},
), // ),
), // ),
Padding( Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20), padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField( child: TextFormField(
@@ -236,66 +280,60 @@ class _BoxEditorState extends State<BoxEditor> {
color: primaryColor), color: primaryColor),
)), )),
), ),
Padding( // Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20), // padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField( // child: TextFormField(
initialValue: _box.rate.toString(), // initialValue: _box.rate.toString(),
textAlign: TextAlign.end, // textAlign: TextAlign.end,
decoration: InputDecoration( // decoration: InputDecoration(
fillColor: Colors.white, // fillColor: Colors.white,
labelText: 'Rate', // labelText: 'Rate',
filled: true, // filled: true,
icon: Icon(FontAwesomeIcons.tag, // icon: Icon(FontAwesomeIcons.tag,
color: primaryColor), // color: primaryColor),
)), // )),
), // ),
Padding( // Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20), // padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField( // child: TextFormField(
initialValue: _box.amount.toString(), // initialValue: _box.amount.toString(),
textAlign: TextAlign.end, // textAlign: TextAlign.end,
decoration: InputDecoration( // decoration: InputDecoration(
fillColor: Colors.white, // fillColor: Colors.white,
labelText: 'Total Amount', // labelText: 'Total Amount',
filled: true, // filled: true,
icon: Icon(FontAwesomeIcons.moneyBill, // icon: Icon(FontAwesomeIcons.moneyBill,
color: primaryColor), // color: primaryColor),
)), // )),
), // ),
Container( Container(
padding: EdgeInsets.only(top: 10), padding: EdgeInsets.only(top: 10),
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: MyDataTable( child: MyDataTable(
headingRowHeight: 40, headingRowHeight: 40,
columnSpacing: 20, columnSpacing: 120,
columns: [ columns: [
MyDataColumn( MyDataColumn(
label: LocalText( label: LocalText(
context, context,
"box.package.id", "cargo.type",
color: Colors.grey, color: Colors.grey,
), ),
), ),
MyDataColumn( MyDataColumn(
label: LocalText( label: LocalText(
context, context,
"box.package.desc", "cargo.weight",
color: Colors.grey,
),
),
MyDataColumn(
label: LocalText(
context,
"box.package.market",
color: Colors.grey, color: Colors.grey,
), ),
), ),
], ],
rows: getPackageRow(context), rows: getCargoRows(context),
), ),
), ),
), ),
mainModel.isOwner() mainModel.isOwner()
? Container( ? Container(
padding: EdgeInsets.only(top: 20), padding: EdgeInsets.only(top: 20),
@@ -303,12 +341,11 @@ class _BoxEditorState extends State<BoxEditor> {
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
child: FloatingActionButton.extended( child: FloatingActionButton.extended(
icon: Icon(Icons.add), icon: Icon(Icons.add),
label: Text(AppTranslations.of(context) label: Text("Add Cargo"),
.text("box.add_package")),
backgroundColor: primaryColor, backgroundColor: primaryColor,
onPressed: () { onPressed: () {
Navigator.of(context).push( // Navigator.of(context).push(
BottomUpPageRoute(PackageAddition())); // BottomUpPageRoute(PackageAddition()));
}, },
), ),
), ),
@@ -317,6 +354,55 @@ class _BoxEditorState extends State<BoxEditor> {
SizedBox(height: 25), SizedBox(height: 25),
], ],
), ),
ExpansionTile(
title: Text(
'Box Dimension',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _box.width.toString(),
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Width',
filled: true,
icon: Icon(FontAwesomeIcons.arrowCircleRight,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _box.height.toString(),
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Height',
filled: true,
icon: Icon(FontAwesomeIcons.arrowAltCircleUp,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _box.length.toString(),
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Length',
filled: true,
icon: Icon(FontAwesomeIcons.arrowCircleUp,
color: primaryColor),
)),
),
SizedBox(height: 25),
],
),
isNew isNew
? Container() ? Container()
: ExpansionTile( : ExpansionTile(
@@ -382,23 +468,21 @@ class _BoxEditorState extends State<BoxEditor> {
); );
} }
List<MyDataRow> getPackageRow(BuildContext context) { List<MyDataRow> getCargoRows(BuildContext context) {
if (_box == null || _box.packages == null) { if (_box == null || _box.cargoTypes == null) {
return []; return [];
} }
return _box.packages.map((p) { return _box.cargoTypes.map((c) {
return MyDataRow( return MyDataRow(
onSelectChanged: (bool selected) {}, onSelectChanged: (bool selected) {},
cells: [ cells: [
MyDataCell(new Text( MyDataCell(new Text(
p.id == null ? "" : p.id, c.type == null ? "" : c.type,
style: textStyle, style: textStyle,
)), )),
MyDataCell( MyDataCell(
new Text(p.cargoDesc, style: textStyle), new Text(c.weight == null ? "0" : c.weight.toString(),
), style: textStyle),
MyDataCell(
new Text("${p.market}", style: textStyle),
), ),
], ],
); );

View File

@@ -0,0 +1,79 @@
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/rate.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 CargoEditor extends StatefulWidget {
final Rate rate;
CargoEditor({this.rate});
@override
_CargoEditorState createState() => _CargoEditorState();
}
class _CargoEditorState extends State<CargoEditor> {
TextEditingController _descController = new TextEditingController();
TextEditingController _rateController = new TextEditingController();
bool _isLoading = false;
Rate _rate = new Rate();
@override
void initState() {
super.initState();
if (widget.rate != null) {
_rate = widget.rate;
_descController.text = _rate.description;
_rateController.text = _rate.price.toString();
}
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext 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("cargo.form.title")),
),
body: Container(
padding: EdgeInsets.all(18),
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: <Widget>[
fcsInput("Cargo Type", Icons.text_format,
controller: _descController),
fcsInput("Rate", Icons.attach_money,
controller: _rateController),
SizedBox(height: 30),
],
),
),
widget.rate == null
? fcsButton(context, "Create", callack: () {})
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10)
],
),
),
),
);
}
}

View File

@@ -1,3 +1,4 @@
import 'package:fcs/vo/cargo.dart';
import 'package.dart'; import 'package.dart';
class Status { class Status {
@@ -19,6 +20,9 @@ class Box {
String boxNumber; String boxNumber;
String status; String status;
String cargoDesc; String cargoDesc;
int width;
int height;
int length;
int rate; int rate;
int weight; int weight;
@@ -30,6 +34,8 @@ class Box {
List<Package> packages; List<Package> packages;
List<Cargo> cargoTypes;
int get amount => rate != null && weight != null ? rate * weight : 0; int get amount => rate != null && weight != null ? rate * weight : 0;
String get packageNumber => String get packageNumber =>
@@ -48,6 +54,9 @@ class Box {
this.receiverNumber, this.receiverNumber,
this.receiverAddress, this.receiverAddress,
this.boxNumber, this.boxNumber,
this.width,
this.height,
this.length,
this.rate, this.rate,
this.weight, this.weight,
this.packageType, this.packageType,
@@ -57,5 +66,6 @@ class Box {
this.arrivedDate, this.arrivedDate,
this.cargoDesc, this.cargoDesc,
this.statusHistory, this.statusHistory,
this.packages}); this.packages,
this.cargoTypes});
} }

6
lib/vo/cargo.dart Normal file
View File

@@ -0,0 +1,6 @@
class Cargo {
String type;
int price;
int weight;
Cargo({this.type, this.price, this.weight});
}

View File

@@ -1,3 +1,5 @@
import 'cargo.dart';
class PickUp { class PickUp {
String id; String id;
String userName; String userName;
@@ -10,6 +12,7 @@ class PickUp {
String address; String address;
String status; String status;
DateTime date; DateTime date;
List<Cargo> cargoTypes;
PickUp( PickUp(
{this.id, {this.id,
@@ -22,7 +25,8 @@ class PickUp {
this.handlingFee, this.handlingFee,
this.address, this.address,
this.status, this.status,
this.date}); this.date,
this.cargoTypes});
int get last => DateTime.now().difference(date).inDays; int get last => DateTime.now().difference(date).inDays;