update pickup and box list
This commit is contained in:
BIN
assets/FirstName&LastName.png
Normal file
BIN
assets/FirstName&LastName.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
BIN
assets/Fullname.png
Normal file
BIN
assets/Fullname.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 239 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 82 KiB |
@@ -329,7 +329,7 @@
|
|||||||
|
|
||||||
|
|
||||||
"delivery.title":"Deliveries",
|
"delivery.title":"Deliveries",
|
||||||
"delivery":"Delivery",
|
"delivery":"DELIVERIES",
|
||||||
"delivery.confirm":"End delivery?",
|
"delivery.confirm":"End delivery?",
|
||||||
"delivery.detail":"Details",
|
"delivery.detail":"Details",
|
||||||
"delivery.date":"Date",
|
"delivery.date":"Date",
|
||||||
|
|||||||
@@ -324,7 +324,7 @@
|
|||||||
"banks.account.delete.confirmation":"Delete Bank Account?",
|
"banks.account.delete.confirmation":"Delete Bank Account?",
|
||||||
|
|
||||||
"delivery.title":"ပေးပို့ရန်များ",
|
"delivery.title":"ပေးပို့ရန်များ",
|
||||||
"delivery":"ပေးပို့ရန်",
|
"delivery":"ပေးပို့ရန်များ",
|
||||||
"delivery.confirm":"ပေးပို့ခြင်း အဆုံးသတ်မည်လား?",
|
"delivery.confirm":"ပေးပို့ခြင်း အဆုံးသတ်မည်လား?",
|
||||||
"delivery.detail":"အသေးစိတ်",
|
"delivery.detail":"အသေးစိတ်",
|
||||||
"delivery.date":"ရက်စွဲ",
|
"delivery.date":"ရက်စွဲ",
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class PickUpModel extends BaseModel {
|
|||||||
toTime: '3PM',
|
toTime: '3PM',
|
||||||
numberOfPackage: 5,
|
numberOfPackage: 5,
|
||||||
weight: 25,
|
weight: 25,
|
||||||
status: 'Assigned',
|
status: 'Confirmed',
|
||||||
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,
|
||||||
@@ -180,7 +180,7 @@ class PickUpModel extends BaseModel {
|
|||||||
return pickups
|
return pickups
|
||||||
.where((e) =>
|
.where((e) =>
|
||||||
e.status == "Pending" ||
|
e.status == "Pending" ||
|
||||||
e.status == "Assigned" ||
|
e.status == "Confirmed" ||
|
||||||
e.status == "Processed" ||
|
e.status == "Processed" ||
|
||||||
e.status == "Rescheduled")
|
e.status == "Rescheduled")
|
||||||
.toList()
|
.toList()
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ class ShipmentModel extends BaseModel {
|
|||||||
ShippingAddress(
|
ShippingAddress(
|
||||||
fullName: 'Mg Myo',
|
fullName: 'Mg Myo',
|
||||||
addressLine1: '153-154 5th Thitsar.',
|
addressLine1: '153-154 5th Thitsar.',
|
||||||
addressLine2: 'Flushing',
|
addressLine2: 'South Okkalapa Township',
|
||||||
city: 'Yangon',
|
city: 'Yangon',
|
||||||
state: 'Yangon',
|
state: 'Myanmar',
|
||||||
phoneNumber: '+09 5724 87508'),
|
phoneNumber: '+09 95724 8750'),
|
||||||
];
|
];
|
||||||
|
|
||||||
void initUser(user) {
|
void initUser(user) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ 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/cargo.dart';
|
||||||
import 'package:fcs/vo/package.dart';
|
import 'package:fcs/vo/package.dart';
|
||||||
|
import 'package:fcs/vo/shipping_address.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
class BoxModel extends BaseModel {
|
class BoxModel extends BaseModel {
|
||||||
@@ -41,6 +42,13 @@ class BoxModel extends BaseModel {
|
|||||||
length: 10,
|
length: 10,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
statusHistory: statusHistory,
|
statusHistory: statusHistory,
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'U Nyi Nyi',
|
||||||
|
addressLine1: '154-19 64th Ave.',
|
||||||
|
addressLine2: 'Flushing',
|
||||||
|
city: 'NY',
|
||||||
|
state: 'NY',
|
||||||
|
phoneNumber: '+1 (292)215-2247'),
|
||||||
cargoTypes: [
|
cargoTypes: [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -58,11 +66,18 @@ class BoxModel extends BaseModel {
|
|||||||
cargoDesc: "Clothes",
|
cargoDesc: "Clothes",
|
||||||
arrivedDate: DateTime(2020, 6, 1),
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
width: 10,
|
width: 10,
|
||||||
height: 10,
|
height: 20,
|
||||||
length: 10,
|
length: 30,
|
||||||
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',
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'Mg Myo',
|
||||||
|
addressLine1: '153-154 5th Thitsar.',
|
||||||
|
addressLine2: 'South Okkalapa Township',
|
||||||
|
city: 'Yangon',
|
||||||
|
state: 'Myanmar',
|
||||||
|
phoneNumber: '+09 95724 8750'),
|
||||||
cargoTypes: [
|
cargoTypes: [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -85,6 +100,13 @@ class BoxModel extends BaseModel {
|
|||||||
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',
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'Mg Myo',
|
||||||
|
addressLine1: '153-154 5th Thitsar.',
|
||||||
|
addressLine2: 'South Okkalapa Township',
|
||||||
|
city: 'Yangon',
|
||||||
|
state: 'Myanmar',
|
||||||
|
phoneNumber: '+09 95724 8750'),
|
||||||
cargoTypes: [
|
cargoTypes: [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -107,6 +129,42 @@ class BoxModel extends BaseModel {
|
|||||||
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',
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'U Nyi Nyi',
|
||||||
|
addressLine1: '154-19 64th Ave.',
|
||||||
|
addressLine2: 'Flushing',
|
||||||
|
city: 'NY',
|
||||||
|
state: 'NY',
|
||||||
|
phoneNumber: '+1 (292)215-2247'),
|
||||||
|
cargoTypes: [
|
||||||
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
|
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||||
|
]),
|
||||||
|
Box(
|
||||||
|
shipmentNumber: "A202",
|
||||||
|
receiverNumber: "2",
|
||||||
|
receiverName: "Ma Aye",
|
||||||
|
boxNumber: "3",
|
||||||
|
rate: 7,
|
||||||
|
packageType: "General",
|
||||||
|
cargoDesc: "Handbags",
|
||||||
|
weight: 75,
|
||||||
|
status: "Arrived",
|
||||||
|
arrivedDate: DateTime(2020, 6, 1),
|
||||||
|
width: 10,
|
||||||
|
height: 10,
|
||||||
|
length: 10,
|
||||||
|
statusHistory: statusHistory,
|
||||||
|
packages: packages,
|
||||||
|
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'U Nyi Nyi',
|
||||||
|
addressLine1: '154-19 64th Ave.',
|
||||||
|
addressLine2: 'Flushing',
|
||||||
|
city: 'NY',
|
||||||
|
state: 'NY',
|
||||||
|
phoneNumber: '+1 (292)215-2247'),
|
||||||
cargoTypes: [
|
cargoTypes: [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -129,6 +187,13 @@ class BoxModel extends BaseModel {
|
|||||||
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',
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'U Nyi Nyi',
|
||||||
|
addressLine1: '154-19 64th Ave.',
|
||||||
|
addressLine2: 'Flushing',
|
||||||
|
city: 'NY',
|
||||||
|
state: 'NY',
|
||||||
|
phoneNumber: '+1 (292)215-2247'),
|
||||||
cargoTypes: [
|
cargoTypes: [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -151,6 +216,13 @@ class BoxModel extends BaseModel {
|
|||||||
statusHistory: statusHistory,
|
statusHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'U Nyi Nyi',
|
||||||
|
addressLine1: '154-19 64th Ave.',
|
||||||
|
addressLine2: 'Flushing',
|
||||||
|
city: 'NY',
|
||||||
|
state: 'NY',
|
||||||
|
phoneNumber: '+1 (292)215-2247'),
|
||||||
cargoTypes: [
|
cargoTypes: [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -173,6 +245,13 @@ class BoxModel extends BaseModel {
|
|||||||
statusHistory: statusHistory,
|
statusHistory: statusHistory,
|
||||||
packages: packages,
|
packages: packages,
|
||||||
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
|
||||||
|
shippingAddress: ShippingAddress(
|
||||||
|
fullName: 'U Nyi Nyi',
|
||||||
|
addressLine1: '154-19 64th Ave.',
|
||||||
|
addressLine2: 'Flushing',
|
||||||
|
city: 'NY',
|
||||||
|
state: 'NY',
|
||||||
|
phoneNumber: '+1 (292)215-2247'),
|
||||||
cargoTypes: [
|
cargoTypes: [
|
||||||
Cargo(type: 'General Cargo', weight: 25),
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
Cargo(type: 'Medicine', weight: 20),
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
@@ -192,7 +271,8 @@ class BoxModel extends BaseModel {
|
|||||||
.where((e) =>
|
.where((e) =>
|
||||||
e.status == "Packed" ||
|
e.status == "Packed" ||
|
||||||
e.status == "Received" ||
|
e.status == "Received" ||
|
||||||
e.status == "Shipped")
|
e.status == "Shipped" ||
|
||||||
|
e.status == "Arrived")
|
||||||
.toList()
|
.toList()
|
||||||
..sort((e1, e2) {
|
..sort((e1, e2) {
|
||||||
return e2.packageNumber.compareTo(e1.packageNumber);
|
return e2.packageNumber.compareTo(e1.packageNumber);
|
||||||
|
|||||||
@@ -18,12 +18,20 @@ class BuyingOnlinePage extends StatefulWidget {
|
|||||||
_BuyingOnlinePagetate createState() => _BuyingOnlinePagetate();
|
_BuyingOnlinePagetate createState() => _BuyingOnlinePagetate();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _BuyingOnlinePagetate extends State<BuyingOnlinePage> {
|
class _BuyingOnlinePagetate extends State<BuyingOnlinePage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
List<String> images = [
|
List<String> images = [
|
||||||
'assets/Fullname.jpeg',
|
'assets/Fullname.jpeg',
|
||||||
'assets/FirstName&LastName.jpeg'
|
'assets/FirstName&LastName.jpeg'
|
||||||
];
|
];
|
||||||
|
TabController _tabController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
_tabController = TabController(vsync: this, length: 2);
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -146,21 +154,58 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
// deliveryAddressBox,
|
// deliveryAddressBox,
|
||||||
instructionBox,
|
instructionBox,
|
||||||
Container(
|
new Container(
|
||||||
|
decoration: new BoxDecoration(color: Colors.white),
|
||||||
|
child: new TabBar(
|
||||||
|
// indicatorColor: primaryColor,
|
||||||
|
labelColor: primaryColor,
|
||||||
|
labelStyle: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
unselectedLabelColor: Colors.grey,
|
||||||
|
controller: _tabController,
|
||||||
|
tabs: [
|
||||||
|
new Tab(
|
||||||
|
text: 'FULL NAME',
|
||||||
|
),
|
||||||
|
new Tab(
|
||||||
|
text: 'FIRST NAME&\nLAST NAME',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
new Container(
|
||||||
|
padding: EdgeInsets.only(top:10),
|
||||||
height: 500,
|
height: 500,
|
||||||
width: 500,
|
width: 500,
|
||||||
child: ListView.builder(
|
child: new TabBarView(
|
||||||
itemCount: images.length,
|
controller: _tabController,
|
||||||
scrollDirection: Axis.horizontal,
|
children: <Widget>[
|
||||||
itemBuilder: (context, index) {
|
Container(
|
||||||
return Container(
|
child:
|
||||||
padding: EdgeInsets.only(left: 0, right: 5, top: 5),
|
Image.asset('assets/Fullname.png', fit: BoxFit.contain),
|
||||||
child: Image.asset(images[index], fit: BoxFit.contain),
|
),
|
||||||
);
|
Container(
|
||||||
}),
|
child: Image.asset('assets/FirstName&LastName.png',
|
||||||
|
fit: BoxFit.contain),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
// Container(
|
||||||
|
// height: 500,
|
||||||
|
// width: 500,
|
||||||
|
// child: ListView.builder(
|
||||||
|
// itemCount: images.length,
|
||||||
|
// scrollDirection: Axis.horizontal,
|
||||||
|
// itemBuilder: (context, index) {
|
||||||
|
// return Container(
|
||||||
|
// padding: EdgeInsets.only(left: 0, right: 5, top: 5),
|
||||||
|
// child: Image.asset(images[index], fit: BoxFit.contain),
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
// ),
|
||||||
|
|
||||||
SizedBox(height: 10)
|
SizedBox(height: 10)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:country_code_picker/country_code.dart';
|
|||||||
import 'package:fcs/model/main_model.dart';
|
import 'package:fcs/model/main_model.dart';
|
||||||
import 'package:fcs/pages/shipment_list.dart';
|
import 'package:fcs/pages/shipment_list.dart';
|
||||||
import 'package:fcs/pages_fcs/box_list.dart';
|
import 'package:fcs/pages_fcs/box_list.dart';
|
||||||
|
import 'package:fcs/pages_fcs/delivery_list.dart';
|
||||||
import 'package:fcs/pages_fcs/package_list.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:fcs/widget/localization/transalation.dart';
|
import 'package:fcs/widget/localization/transalation.dart';
|
||||||
@@ -178,6 +179,10 @@ class _HomePageState extends State<HomePage> {
|
|||||||
icon: FontAwesomeIcons.info,
|
icon: FontAwesomeIcons.info,
|
||||||
btnCallback: () =>
|
btnCallback: () =>
|
||||||
Navigator.of(context).push(BottomUpPageRoute(Term())));
|
Navigator.of(context).push(BottomUpPageRoute(Term())));
|
||||||
|
final deliveryBtn = _buildBtn2("delivery.title",
|
||||||
|
icon: MaterialCommunityIcons.truck_fast,
|
||||||
|
btnCallback: () =>
|
||||||
|
Navigator.of(context).push(BottomUpPageRoute(DeliverList())));
|
||||||
|
|
||||||
List<Widget> widgets = [];
|
List<Widget> widgets = [];
|
||||||
customer ? widgets.add(buyingBtn) : "";
|
customer ? widgets.add(buyingBtn) : "";
|
||||||
@@ -188,7 +193,8 @@ class _HomePageState extends State<HomePage> {
|
|||||||
owner ? widgets.add(fcsProfileBtn) : "";
|
owner ? widgets.add(fcsProfileBtn) : "";
|
||||||
widgets.add(shipmentCostBtn);
|
widgets.add(shipmentCostBtn);
|
||||||
customer || owner ? widgets.add(packagesBtn) : "";
|
customer || owner ? widgets.add(packagesBtn) : "";
|
||||||
customer || owner ? widgets.add(boxesBtn) : "";
|
owner ? widgets.add(boxesBtn) : "";
|
||||||
|
owner ? widgets.add(deliveryBtn) : "";
|
||||||
owner ? widgets.add(customersBtn) : "";
|
owner ? widgets.add(customersBtn) : "";
|
||||||
customer || owner ? widgets.add(invoicesBtn) : "";
|
customer || owner ? widgets.add(invoicesBtn) : "";
|
||||||
widgets.add(termBtn);
|
widgets.add(termBtn);
|
||||||
@@ -318,7 +324,8 @@ class _HomePageState extends State<HomePage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
// _buildSmallButton(
|
// _buildSmallButton(
|
||||||
// "Policies", FontAwesomeIcons.fileContract),
|
// "Policies", FontAwesomeIcons.fileContract),
|
||||||
_buildSmallButton("Contact Us", SimpleLineIcons.support),
|
_buildSmallButton(
|
||||||
|
"Contact Us", SimpleLineIcons.support),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
311
lib/pages/pickup_box_editor.dart
Normal file
311
lib/pages/pickup_box_editor.dart
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
import 'package:fcs/model/main_model.dart';
|
||||||
|
import 'package:fcs/model/shipment_model.dart';
|
||||||
|
import 'package:fcs/model_fcs/package_model.dart';
|
||||||
|
import 'package:fcs/pages/invoice/package_addition.dart';
|
||||||
|
import 'package:fcs/pages/util.dart';
|
||||||
|
import 'package:fcs/pages_fcs/shipping_address_row.dart';
|
||||||
|
import 'package:fcs/vo/box.dart';
|
||||||
|
import 'package:fcs/vo/cargo.dart';
|
||||||
|
import 'package:fcs/vo/package.dart';
|
||||||
|
import 'package:fcs/vo/shipping_address.dart';
|
||||||
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||||
|
import 'package:fcs/widget/local_text.dart';
|
||||||
|
import 'package:fcs/widget/localization/app_translations.dart';
|
||||||
|
import 'package:fcs/widget/my_data_table.dart';
|
||||||
|
import 'package:fcs/widget/progress.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import '../theme/theme.dart';
|
||||||
|
import 'shipping_address_editor.dart';
|
||||||
|
|
||||||
|
class PickupBoxEditor extends StatefulWidget {
|
||||||
|
final Box box;
|
||||||
|
PickupBoxEditor({this.box});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PickupBoxEditorState createState() => _PickupBoxEditorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PickupBoxEditorState extends State<PickupBoxEditor> {
|
||||||
|
Box _box;
|
||||||
|
bool _isLoading = false;
|
||||||
|
|
||||||
|
bool isNew;
|
||||||
|
|
||||||
|
bool isMixBox = false;
|
||||||
|
ShippingAddress _shippingAddress = new ShippingAddress();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
if (widget.box != null) {
|
||||||
|
_box = widget.box;
|
||||||
|
_shippingAddress = _box.shippingAddress;
|
||||||
|
isNew = false;
|
||||||
|
} else {
|
||||||
|
List<Package> packages = [
|
||||||
|
PackageModel.packages[0],
|
||||||
|
PackageModel.packages[1],
|
||||||
|
PackageModel.packages[2]
|
||||||
|
];
|
||||||
|
|
||||||
|
List<Cargo> _cargoTypes = [
|
||||||
|
Cargo(type: 'General Cargo', weight: 25),
|
||||||
|
Cargo(type: 'Medicine', weight: 20),
|
||||||
|
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||||
|
];
|
||||||
|
|
||||||
|
var shipmentModel = Provider.of<ShipmentModel>(context, listen: false);
|
||||||
|
_shippingAddress = shipmentModel.shippingAddresses[1];
|
||||||
|
|
||||||
|
isNew = true;
|
||||||
|
_box = Box(
|
||||||
|
rate: 0,
|
||||||
|
weight: 75,
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
length: 0,
|
||||||
|
packages: packages,
|
||||||
|
cargoTypes: _cargoTypes,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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("box.edit.title")),
|
||||||
|
),
|
||||||
|
body: Card(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
ExpansionTile(
|
||||||
|
title: Text(
|
||||||
|
'Cargo Types',
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20.0, right: 20),
|
||||||
|
child: TextFormField(
|
||||||
|
initialValue: _box.weight.toString(),
|
||||||
|
textAlign: TextAlign.end,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
fillColor: Colors.white,
|
||||||
|
labelText: 'Total Weight',
|
||||||
|
filled: true,
|
||||||
|
icon: Icon(FontAwesomeIcons.weightHanging,
|
||||||
|
color: primaryColor),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 10),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: MyDataTable(
|
||||||
|
headingRowHeight: 40,
|
||||||
|
columnSpacing: 120,
|
||||||
|
columns: [
|
||||||
|
MyDataColumn(
|
||||||
|
label: LocalText(
|
||||||
|
context,
|
||||||
|
"cargo.type",
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MyDataColumn(
|
||||||
|
label: LocalText(
|
||||||
|
context,
|
||||||
|
"cargo.weight",
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
rows: getCargoRows(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(top: 20),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomRight,
|
||||||
|
child: FloatingActionButton.extended(
|
||||||
|
icon: Icon(Icons.add),
|
||||||
|
label: Text("Add Cargo"),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
onPressed: () {
|
||||||
|
// Navigator.of(context).push(
|
||||||
|
// BottomUpPageRoute(PackageAddition()));
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
ExpansionTile(
|
||||||
|
title: Text(
|
||||||
|
'Shipping Address',
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
ShippingAddressRow(shippingAddress: _shippingAddress),
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomRight,
|
||||||
|
child: Container(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
child: FloatingActionButton.extended(
|
||||||
|
materialTapTargetSize:
|
||||||
|
MaterialTapTargetSize.shrinkWrap,
|
||||||
|
onPressed: () {},
|
||||||
|
icon: Icon(Icons.add),
|
||||||
|
label: Text(
|
||||||
|
'Add Shipping\nAddress',
|
||||||
|
style: TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 25),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
widget.box == null
|
||||||
|
? Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 250,
|
||||||
|
child: FlatButton(
|
||||||
|
child: Text('Create New Box'),
|
||||||
|
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 Box'),
|
||||||
|
color: primaryColor,
|
||||||
|
textColor: Colors.white,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
))),
|
||||||
|
],
|
||||||
|
))
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<MyDataRow> getCargoRows(BuildContext context) {
|
||||||
|
if (_box == null || _box.cargoTypes == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return _box.cargoTypes.map((c) {
|
||||||
|
return MyDataRow(
|
||||||
|
onSelectChanged: (bool selected) {},
|
||||||
|
cells: [
|
||||||
|
MyDataCell(new Text(
|
||||||
|
c.type == null ? "" : c.type,
|
||||||
|
style: textStyle,
|
||||||
|
)),
|
||||||
|
MyDataCell(
|
||||||
|
new Text(c.weight == null ? "0" : c.weight.toString(),
|
||||||
|
style: textStyle),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
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/model/shipment_model.dart';
|
||||||
|
import 'package:fcs/model_fcs/box_model.dart';
|
||||||
import 'package:fcs/pages/util.dart';
|
import 'package:fcs/pages/util.dart';
|
||||||
|
import 'package:fcs/pages_fcs/shipping_address_row.dart';
|
||||||
|
import 'package:fcs/vo/box.dart';
|
||||||
import 'package:fcs/vo/cargo.dart';
|
import 'package:fcs/vo/cargo.dart';
|
||||||
import 'package:fcs/vo/pickup.dart';
|
import 'package:fcs/vo/pickup.dart';
|
||||||
|
import 'package:fcs/vo/shipping_address.dart';
|
||||||
|
import 'package:fcs/widget/bottom_up_page_route.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';
|
||||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||||
@@ -16,6 +22,7 @@ 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 'pickup_box_editor.dart';
|
||||||
|
|
||||||
class PickUpEditor extends StatefulWidget {
|
class PickUpEditor extends StatefulWidget {
|
||||||
final PickUp pickUp;
|
final PickUp pickUp;
|
||||||
@@ -49,6 +56,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
var now = new DateTime.now();
|
var now = new DateTime.now();
|
||||||
bool isNew;
|
bool isNew;
|
||||||
|
ShippingAddress _shippingAddress = new ShippingAddress();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -78,6 +86,8 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
];
|
];
|
||||||
_pickUp = PickUp(cargoTypes: _cargoTypes);
|
_pickUp = PickUp(cargoTypes: _cargoTypes);
|
||||||
}
|
}
|
||||||
|
var shipmentModel = Provider.of<ShipmentModel>(context, listen: false);
|
||||||
|
_shippingAddress = shipmentModel.shippingAddresses[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -216,6 +226,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
));
|
));
|
||||||
|
|
||||||
MainModel mainModel = Provider.of<MainModel>(context);
|
MainModel mainModel = Provider.of<MainModel>(context);
|
||||||
|
var boxModel = Provider.of<BoxModel>(context);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -253,7 +264,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
title: Text('Pickup Location / Time'),
|
title: Text(
|
||||||
|
'Pickup Location / Time',
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
@@ -280,7 +295,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
title: Text('Package Information'),
|
title: Text(
|
||||||
|
'Package Information',
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
@@ -322,60 +341,136 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
padding: const EdgeInsets.only(left: 20.0),
|
padding: const EdgeInsets.only(left: 20.0),
|
||||||
child: fcsInput("Remark", MaterialCommunityIcons.note),
|
child: fcsInput("Remark", MaterialCommunityIcons.note),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 3.0),
|
||||||
|
child: ExpansionTile(
|
||||||
|
leading: Icon(
|
||||||
|
SimpleLineIcons.location_pin,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
'Shipping Address',
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
ShippingAddressRow(
|
||||||
|
shippingAddress: _shippingAddress),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: 20, bottom: 15, right: 15),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomRight,
|
||||||
|
child: Container(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
child: FloatingActionButton.extended(
|
||||||
|
materialTapTargetSize:
|
||||||
|
MaterialTapTargetSize.shrinkWrap,
|
||||||
|
onPressed: () {},
|
||||||
|
icon: Icon(Icons.add),
|
||||||
|
label: Text(
|
||||||
|
'Add Shipping\nAddress',
|
||||||
|
style: TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.0),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
ExpansionTile(
|
||||||
|
title: Text(
|
||||||
|
'Box Information',
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: getBoxList(context, boxModel.boxes),
|
||||||
|
),
|
||||||
|
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(PickupBoxEditor()),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
label: Text(
|
||||||
|
'Add Box',
|
||||||
|
style: TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(height: 10.0),
|
SizedBox(height: 10.0),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// ExpansionTile(
|
// ExpansionTile(
|
||||||
// title: Text('Box Information'),
|
// title: Text(
|
||||||
|
// 'Shipping Address',
|
||||||
|
// style: TextStyle(
|
||||||
|
// color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
|
// ),
|
||||||
// children: <Widget>[
|
// children: <Widget>[
|
||||||
// SizedBox(height: 10.0),
|
// 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)),
|
||||||
// ],
|
// ],
|
||||||
// ),
|
// ),
|
||||||
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(
|
||||||
@@ -413,14 +508,14 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
: Container(
|
: Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
widget.pickUp.status == 'Assigned'
|
widget.pickUp.status == 'Confirmed'
|
||||||
? Align(
|
? Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 250,
|
width: 250,
|
||||||
child: FlatButton(
|
child: FlatButton(
|
||||||
child: Text('Complete'),
|
child: Text('Complete Pickup'),
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -434,7 +529,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: 250,
|
width: 250,
|
||||||
child: FlatButton(
|
child: FlatButton(
|
||||||
child: Text('Assign'),
|
child: Text('Assign Pickup'),
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -442,20 +537,6 @@ 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(
|
||||||
@@ -478,4 +559,136 @@ class _PickUpEditorState extends State<PickUpEditor> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Widget> getBoxList(BuildContext context, List<Box> boxes) {
|
||||||
|
List<Box> _boxes = [boxes[0], boxes[1]];
|
||||||
|
|
||||||
|
return _boxes.asMap().entries.map((_box) {
|
||||||
|
ShippingAddress shippingAddress = _box.value.shippingAddress;
|
||||||
|
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context)
|
||||||
|
.push(BottomUpPageRoute(PickupBoxEditor(box: _box.value)));
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(left: 10),
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: new Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 10.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(
|
||||||
|
shippingAddress.fullName == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.fullName,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.addressLine1 == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.addressLine1,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.addressLine2 == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.addressLine2,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.city == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.city,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.state == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.state,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.phoneNumber == null
|
||||||
|
? ''
|
||||||
|
: "Phone:${shippingAddress.phoneNumber}",
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
"L${_box.value.length}xW${_box.value.weight}xH${_box.value.height}",
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0, color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
_box.value.weight == null
|
||||||
|
? ''
|
||||||
|
: "Total Weight:${_box.value.weight.toString()}lb",
|
||||||
|
style:
|
||||||
|
new TextStyle(fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
_box.key == _boxes.length - 1
|
||||||
|
? Container()
|
||||||
|
: Divider(
|
||||||
|
color: Colors.black,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,13 @@ import 'package:fcs/model/pickup_model.dart';
|
|||||||
import 'package:fcs/pages/pickup_list_row.dart';
|
import 'package:fcs/pages/pickup_list_row.dart';
|
||||||
import 'package:fcs/widget/bottom_up_page_route.dart';
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:fcs/model/buyer_model.dart';
|
|
||||||
import 'package:fcs/pages/search_page.dart';
|
import 'package:fcs/pages/search_page.dart';
|
||||||
import 'package:fcs/vo/buyer.dart';
|
|
||||||
import 'package:fcs/vo/popup_menu.dart';
|
|
||||||
import 'package:fcs/widget/localization/app_translations.dart';
|
import 'package:fcs/widget/localization/app_translations.dart';
|
||||||
import 'package:fcs/widget/popupmenu.dart';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
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 '../theme/theme.dart';
|
|
||||||
import '../theme/theme.dart';
|
|
||||||
import 'buyer_list_row.dart';
|
|
||||||
import 'pickup_editor.dart';
|
import 'pickup_editor.dart';
|
||||||
|
|
||||||
class PickUpList extends StatefulWidget {
|
class PickUpList extends StatefulWidget {
|
||||||
@@ -24,7 +17,6 @@ class PickUpList extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PickUpListState extends State<PickUpList> {
|
class _PickUpListState extends State<PickUpList> {
|
||||||
Buyer buyer;
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -39,56 +31,69 @@ class _PickUpListState extends State<PickUpList> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
var pickupModel = Provider.of<PickUpModel>(context);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: DefaultTabController(
|
child: DefaultTabController(
|
||||||
length: 3,
|
length: 3,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
leading: new IconButton(
|
leading: new IconButton(
|
||||||
icon: new Icon(Icons.close),
|
icon: new Icon(Icons.close),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
backgroundColor: primaryColor,
|
backgroundColor: primaryColor,
|
||||||
title: Text(AppTranslations.of(context).text("pickup.title")),
|
title: Text(AppTranslations.of(context).text("pickup.title")),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.search,
|
Icons.search,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
|
||||||
iconSize: 30,
|
|
||||||
onPressed: () => showPlacesSearch(context),
|
|
||||||
),
|
),
|
||||||
],
|
iconSize: 30,
|
||||||
bottom: TabBar(
|
onPressed: () => showPlacesSearch(context),
|
||||||
unselectedLabelColor: Colors.grey,
|
|
||||||
tabs: [
|
|
||||||
Tab(
|
|
||||||
text: "Upcoming",
|
|
||||||
),
|
|
||||||
Tab(text: "Completed"),
|
|
||||||
Tab(text: "Canceled"),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
floatingActionButton: FloatingActionButton.extended(
|
// bottom: TabBar(
|
||||||
onPressed: () {
|
// unselectedLabelColor: Colors.grey,
|
||||||
_newPickup();
|
// tabs: [
|
||||||
},
|
// Tab(
|
||||||
icon: Icon(Icons.add),
|
// text: "Upcoming",
|
||||||
label: Text(AppTranslations.of(context).text("pickup.new")),
|
// ),
|
||||||
backgroundColor: primaryColor,
|
// Tab(text: "Completed"),
|
||||||
),
|
// Tab(text: "Canceled"),
|
||||||
body: TabBarView(
|
// ],
|
||||||
children: [
|
// ),
|
||||||
//Icon(Icons.directions_car),
|
),
|
||||||
_upComing(),
|
floatingActionButton: FloatingActionButton.extended(
|
||||||
_completed(),
|
onPressed: () {
|
||||||
_canceled()
|
_newPickup();
|
||||||
],
|
},
|
||||||
)),
|
icon: Icon(Icons.add),
|
||||||
|
label: Text(AppTranslations.of(context).text("pickup.new")),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
body: new ListView.separated(
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
padding: EdgeInsets.only(top: 15),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: pickupModel.pickups.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return PickupListRow(pickUp: pickupModel.pickups[index]);
|
||||||
|
}),
|
||||||
|
// body: TabBarView(
|
||||||
|
// children: [
|
||||||
|
// //Icon(Icons.directions_car),
|
||||||
|
// _upComing(),
|
||||||
|
// _completed(),
|
||||||
|
// _canceled()
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:fcs/model/shipment_model.dart';
|
import 'package:fcs/model/shipment_model.dart';
|
||||||
|
import 'package:fcs/pages_fcs/shipping_address_row.dart';
|
||||||
import 'package:fcs/vo/shipping_address.dart';
|
import 'package:fcs/vo/shipping_address.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';
|
||||||
@@ -216,7 +217,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
));
|
));
|
||||||
|
|
||||||
final logoutbutton = Container(
|
final logoutbutton = Container(
|
||||||
padding: EdgeInsets.only( left: 20.0, right: 24.0),
|
padding: EdgeInsets.only(left: 20.0, right: 24.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||||
child: Card(
|
child: Card(
|
||||||
@@ -330,7 +331,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.bottomRight,
|
alignment: Alignment.bottomRight,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 120,
|
width: 130,
|
||||||
height: 40,
|
height: 40,
|
||||||
child: FloatingActionButton.extended(
|
child: FloatingActionButton.extended(
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
@@ -340,6 +341,7 @@ class _ProfileState extends State<Profile> {
|
|||||||
BottomUpPageRoute(ShippingAddressEditor()),
|
BottomUpPageRoute(ShippingAddressEditor()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
icon: Icon(Icons.add),
|
||||||
label: Text(
|
label: Text(
|
||||||
'Add Shipping\nAddress',
|
'Add Shipping\nAddress',
|
||||||
style: TextStyle(fontSize: 12),
|
style: TextStyle(fontSize: 12),
|
||||||
@@ -357,72 +359,14 @@ class _ProfileState extends State<Profile> {
|
|||||||
List<Widget> getAddressList(
|
List<Widget> getAddressList(
|
||||||
BuildContext context, List<ShippingAddress> addresses) {
|
BuildContext context, List<ShippingAddress> addresses) {
|
||||||
return addresses.asMap().entries.map((s) {
|
return addresses.asMap().entries.map((s) {
|
||||||
return Container(
|
return InkWell(
|
||||||
padding: EdgeInsets.only(left: 10, right: 10),
|
onTap: () {
|
||||||
child: InkWell(
|
Navigator.push(
|
||||||
onTap: () {
|
context,
|
||||||
Navigator.push(
|
BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s.value)),
|
||||||
context,
|
);
|
||||||
BottomUpPageRoute(
|
},
|
||||||
ShippingAddressEditor(shippingAddress: s.value)),
|
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
|
||||||
);
|
|
||||||
},
|
|
||||||
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)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import 'package:fcs/model/main_model.dart';
|
import 'package:fcs/model/main_model.dart';
|
||||||
|
import 'package:fcs/model/shipment_model.dart';
|
||||||
import 'package:fcs/model_fcs/package_model.dart';
|
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/shipping_address_editor.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/cargo.dart';
|
||||||
import 'package:fcs/vo/package.dart';
|
import 'package:fcs/vo/package.dart';
|
||||||
|
import 'package:fcs/vo/shipping_address.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';
|
||||||
import 'package:fcs/widget/localization/app_translations.dart';
|
import 'package:fcs/widget/localization/app_translations.dart';
|
||||||
@@ -19,6 +22,7 @@ import 'package:timeline_list/timeline.dart';
|
|||||||
import 'package:timeline_list/timeline_model.dart';
|
import 'package:timeline_list/timeline_model.dart';
|
||||||
|
|
||||||
import '../theme/theme.dart';
|
import '../theme/theme.dart';
|
||||||
|
import 'shipping_address_row.dart';
|
||||||
|
|
||||||
class BoxEditor extends StatefulWidget {
|
class BoxEditor extends StatefulWidget {
|
||||||
final Box box;
|
final Box box;
|
||||||
@@ -45,14 +49,15 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
"assets/photos/3.jpg"
|
"assets/photos/3.jpg"
|
||||||
];
|
];
|
||||||
bool isNew;
|
bool isNew;
|
||||||
|
|
||||||
bool isMixBox = false;
|
bool isMixBox = false;
|
||||||
|
ShippingAddress _shippingAddress = new ShippingAddress();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
if (widget.box != null) {
|
if (widget.box != null) {
|
||||||
_box = widget.box;
|
_box = widget.box;
|
||||||
|
_shippingAddress = _box.shippingAddress;
|
||||||
isNew = false;
|
isNew = false;
|
||||||
// _addressEditingController.text = _pickUp.address;
|
// _addressEditingController.text = _pickUp.address;
|
||||||
// _fromTimeEditingController.text = _pickUp.fromTime;
|
// _fromTimeEditingController.text = _pickUp.fromTime;
|
||||||
@@ -72,6 +77,9 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
Cargo(type: 'Dangerous Cargo', weight: 30)
|
Cargo(type: 'Dangerous Cargo', weight: 30)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
var shipmentModel = Provider.of<ShipmentModel>(context, listen: false);
|
||||||
|
_shippingAddress = shipmentModel.shippingAddresses[1];
|
||||||
|
|
||||||
isNew = true;
|
isNew = true;
|
||||||
_box = Box(
|
_box = Box(
|
||||||
rate: 0,
|
rate: 0,
|
||||||
@@ -133,6 +141,7 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var mainModel = Provider.of<MainModel>(context);
|
var mainModel = Provider.of<MainModel>(context);
|
||||||
|
var shipmentModel = Provider.of<ShipmentModel>(context);
|
||||||
|
|
||||||
var images = isNew ? [] : _images;
|
var images = isNew ? [] : _images;
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
@@ -247,7 +256,7 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
),
|
),
|
||||||
ExpansionTile(
|
ExpansionTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
'Packages',
|
'Cargo Types',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: primaryColor, fontWeight: FontWeight.bold),
|
color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
@@ -333,7 +342,6 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
mainModel.isOwner()
|
mainModel.isOwner()
|
||||||
? Container(
|
? Container(
|
||||||
padding: EdgeInsets.only(top: 20),
|
padding: EdgeInsets.only(top: 20),
|
||||||
@@ -403,6 +411,39 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
SizedBox(height: 25),
|
SizedBox(height: 25),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
ExpansionTile(
|
||||||
|
title: Text(
|
||||||
|
'Shipping Address',
|
||||||
|
style: TextStyle(
|
||||||
|
color: primaryColor, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
ShippingAddressRow(shippingAddress: _shippingAddress),
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(top: 20, bottom: 15, right: 15),
|
||||||
|
child: Align(
|
||||||
|
alignment: Alignment.bottomRight,
|
||||||
|
child: Container(
|
||||||
|
width: 130,
|
||||||
|
height: 40,
|
||||||
|
child: FloatingActionButton.extended(
|
||||||
|
materialTapTargetSize:
|
||||||
|
MaterialTapTargetSize.shrinkWrap,
|
||||||
|
onPressed: () {},
|
||||||
|
icon: Icon(Icons.add),
|
||||||
|
label: Text(
|
||||||
|
'Add Shipping\nAddress',
|
||||||
|
style: TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
backgroundColor: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 25),
|
||||||
|
],
|
||||||
|
),
|
||||||
isNew
|
isNew
|
||||||
? Container()
|
? Container()
|
||||||
: ExpansionTile(
|
: ExpansionTile(
|
||||||
@@ -459,8 +500,24 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
))),
|
))),
|
||||||
|
widget.box.status == 'Arrived'
|
||||||
|
? Align(
|
||||||
|
alignment: Alignment.bottomCenter,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 250,
|
||||||
|
child: FlatButton(
|
||||||
|
child: Text('Deliver'),
|
||||||
|
color: primaryColor,
|
||||||
|
textColor: Colors.white,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)))
|
||||||
|
: Container(),
|
||||||
],
|
],
|
||||||
))
|
)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -488,4 +545,14 @@ class _BoxEditorState extends State<BoxEditor> {
|
|||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Widget> getAddressList(
|
||||||
|
BuildContext context, List<ShippingAddress> addresses) {
|
||||||
|
return addresses.asMap().entries.map((s) {
|
||||||
|
return InkWell(
|
||||||
|
onTap: () {},
|
||||||
|
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
140
lib/pages_fcs/delivery_list.dart
Normal file
140
lib/pages_fcs/delivery_list.dart
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
import 'package:fcs/model_fcs/box_model.dart';
|
||||||
|
import 'package:fcs/pages/search_page.dart';
|
||||||
|
import 'package:fcs/pages_fcs/box_editor.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 'delivery_list_row.dart';
|
||||||
|
|
||||||
|
class DeliverList extends StatefulWidget {
|
||||||
|
@override
|
||||||
|
_DeliverListState createState() => _DeliverListState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeliverListState extends State<DeliverList> {
|
||||||
|
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("delivery")),
|
||||||
|
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: "Delivered"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// floatingActionButton: FloatingActionButton.extended(
|
||||||
|
// onPressed: () {
|
||||||
|
// _newPickup();
|
||||||
|
// },
|
||||||
|
// icon: Icon(Icons.add),
|
||||||
|
// label: Text(AppTranslations.of(context).text("boxes.new")),
|
||||||
|
// backgroundColor: primaryColor,
|
||||||
|
// ),
|
||||||
|
body: TabBarView(
|
||||||
|
children: [
|
||||||
|
_upComing(),
|
||||||
|
_completed(),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_newPickup() {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
BottomUpPageRoute(BoxEditor()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _upComing() {
|
||||||
|
var boxModel = Provider.of<BoxModel>(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: boxModel.upcoming.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return DeliveryListRow(
|
||||||
|
box: boxModel.upcoming[index],
|
||||||
|
isReadOnly: false,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _completed() {
|
||||||
|
var boxModel = Provider.of<BoxModel>(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: boxModel.completed.length,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return DeliveryListRow(
|
||||||
|
box: boxModel.completed[index],
|
||||||
|
isReadOnly: false,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
114
lib/pages_fcs/delivery_list_row.dart
Normal file
114
lib/pages_fcs/delivery_list_row.dart
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import 'package:fcs/pages/util.dart';
|
||||||
|
import 'package:fcs/pages_fcs/box_editor.dart';
|
||||||
|
import 'package:fcs/vo/box.dart';
|
||||||
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
class DeliveryListRow extends StatefulWidget {
|
||||||
|
final bool isReadOnly;
|
||||||
|
final Box box;
|
||||||
|
const DeliveryListRow({this.box, this.isReadOnly});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_DeliveryListRowState createState() => _DeliveryListRowState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _DeliveryListRowState extends State<DeliveryListRow> {
|
||||||
|
final double dotSize = 15.0;
|
||||||
|
Box _box = new Box();
|
||||||
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_box = widget.box;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(left: 15, right: 15),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
if (widget.isReadOnly) {
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// BottomUpPageRoute(PackageInfo(package: _box)),
|
||||||
|
// );
|
||||||
|
} else {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
BottomUpPageRoute(BoxEditor(box: _box)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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(
|
||||||
|
_box.packageNumber == null
|
||||||
|
? ''
|
||||||
|
: _box.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(_box.arrivedDate),
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
child: getStatus(_box.status),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
new Text(
|
||||||
|
_box.weight == null
|
||||||
|
? ''
|
||||||
|
: _box.weight.toString() + 'lb - ',
|
||||||
|
style:
|
||||||
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
new Text(
|
||||||
|
_box.price == null ? "" : "\$ " + _box.price.toString(),
|
||||||
|
style:
|
||||||
|
new TextStyle(fontSize: 15.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
123
lib/pages_fcs/shipping_address_row.dart
Normal file
123
lib/pages_fcs/shipping_address_row.dart
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
import 'package:fcs/model/shipment_model.dart';
|
||||||
|
import 'package:fcs/theme/theme.dart';
|
||||||
|
import 'package:fcs/vo/shipping_address.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class ShippingAddressRow extends StatelessWidget {
|
||||||
|
final ShippingAddress shippingAddress;
|
||||||
|
final int index;
|
||||||
|
|
||||||
|
const ShippingAddressRow({Key key, this.shippingAddress, this.index})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var shipmentModel = Provider.of<ShipmentModel>(context);
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.only(left: 10, right: 10),
|
||||||
|
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,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.fullName == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.fullName,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.addressLine1 == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.addressLine1,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.addressLine2 == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.addressLine2,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.city == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.city,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.state == null
|
||||||
|
? ''
|
||||||
|
: shippingAddress.state,
|
||||||
|
style: new TextStyle(
|
||||||
|
fontSize: 14.0, color: Colors.grey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
|
child: new Text(
|
||||||
|
shippingAddress.phoneNumber == null
|
||||||
|
? ''
|
||||||
|
: "Phone:${shippingAddress.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)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
index == null
|
||||||
|
? Container()
|
||||||
|
: index == shipmentModel.shippingAddresses.length - 1
|
||||||
|
? Container()
|
||||||
|
: Divider(color: Colors.black)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:fcs/vo/cargo.dart';
|
import 'package:fcs/vo/cargo.dart';
|
||||||
|
import 'package:fcs/vo/shipping_address.dart';
|
||||||
import 'package.dart';
|
import 'package.dart';
|
||||||
|
|
||||||
class Status {
|
class Status {
|
||||||
@@ -36,6 +37,8 @@ class Box {
|
|||||||
|
|
||||||
List<Cargo> cargoTypes;
|
List<Cargo> cargoTypes;
|
||||||
|
|
||||||
|
ShippingAddress shippingAddress;
|
||||||
|
|
||||||
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 =>
|
||||||
@@ -67,5 +70,6 @@ class Box {
|
|||||||
this.cargoDesc,
|
this.cargoDesc,
|
||||||
this.statusHistory,
|
this.statusHistory,
|
||||||
this.packages,
|
this.packages,
|
||||||
this.cargoTypes});
|
this.cargoTypes,
|
||||||
|
this.shippingAddress});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user