diff --git a/assets/FirstName&LastName.png b/assets/FirstName&LastName.png new file mode 100644 index 0000000..24ea2e2 Binary files /dev/null and b/assets/FirstName&LastName.png differ diff --git a/assets/FirstName&LastName.jpeg b/assets/FirstName&LastName_.jpeg similarity index 100% rename from assets/FirstName&LastName.jpeg rename to assets/FirstName&LastName_.jpeg diff --git a/assets/Fullname.png b/assets/Fullname.png new file mode 100644 index 0000000..506c419 Binary files /dev/null and b/assets/Fullname.png differ diff --git a/assets/Fullname.jpeg b/assets/Fullname_.jpeg similarity index 100% rename from assets/Fullname.jpeg rename to assets/Fullname_.jpeg diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index 3fa19dd..e6f7273 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -329,7 +329,7 @@ "delivery.title":"Deliveries", - "delivery":"Delivery", + "delivery":"DELIVERIES", "delivery.confirm":"End delivery?", "delivery.detail":"Details", "delivery.date":"Date", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index ee1a4a1..670c1b8 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -324,7 +324,7 @@ "banks.account.delete.confirmation":"Delete Bank Account?", "delivery.title":"ပေးပို့ရန်များ", - "delivery":"ပေးပို့ရန်", + "delivery":"ပေးပို့ရန်များ", "delivery.confirm":"ပေးပို့ခြင်း အဆုံးသတ်မည်လား?", "delivery.detail":"အသေးစိတ်", "delivery.date":"ရက်စွဲ", diff --git a/lib/model/pickup_model.dart b/lib/model/pickup_model.dart index 72aec01..da167b6 100644 --- a/lib/model/pickup_model.dart +++ b/lib/model/pickup_model.dart @@ -48,7 +48,7 @@ class PickUpModel extends BaseModel { toTime: '3PM', numberOfPackage: 5, weight: 25, - status: 'Assigned', + status: 'Confirmed', date: DateTime(2020, 5, 6), address: '154-19 64th Ave.\nFlushing, NY 11367', handlingFee: 5000, @@ -180,7 +180,7 @@ class PickUpModel extends BaseModel { return pickups .where((e) => e.status == "Pending" || - e.status == "Assigned" || + e.status == "Confirmed" || e.status == "Processed" || e.status == "Rescheduled") .toList() diff --git a/lib/model/shipment_model.dart b/lib/model/shipment_model.dart index 313a4c4..bf8d954 100644 --- a/lib/model/shipment_model.dart +++ b/lib/model/shipment_model.dart @@ -86,10 +86,10 @@ class ShipmentModel extends BaseModel { ShippingAddress( fullName: 'Mg Myo', addressLine1: '153-154 5th Thitsar.', - addressLine2: 'Flushing', + addressLine2: 'South Okkalapa Township', city: 'Yangon', - state: 'Yangon', - phoneNumber: '+09 5724 87508'), + state: 'Myanmar', + phoneNumber: '+09 95724 8750'), ]; void initUser(user) { diff --git a/lib/model_fcs/box_model.dart b/lib/model_fcs/box_model.dart index 47b6c1b..a7233b4 100644 --- a/lib/model_fcs/box_model.dart +++ b/lib/model_fcs/box_model.dart @@ -6,6 +6,7 @@ import 'package:fcs/model_fcs/package_model.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:logging/logging.dart'; class BoxModel extends BaseModel { @@ -41,6 +42,13 @@ class BoxModel extends BaseModel { length: 10, packages: packages, 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: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -58,11 +66,18 @@ class BoxModel extends BaseModel { cargoDesc: "Clothes", arrivedDate: DateTime(2020, 6, 1), width: 10, - height: 10, - length: 10, + height: 20, + length: 30, statusHistory: statusHistory, packages: packages, 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: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -85,6 +100,13 @@ class BoxModel extends BaseModel { statusHistory: statusHistory, packages: packages, 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: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -107,6 +129,42 @@ class BoxModel extends BaseModel { 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: [ + 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: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -129,6 +187,13 @@ class BoxModel extends BaseModel { 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: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -151,6 +216,13 @@ class BoxModel extends BaseModel { statusHistory: statusHistory, packages: packages, 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: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -173,6 +245,13 @@ class BoxModel extends BaseModel { statusHistory: statusHistory, packages: packages, 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: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -192,7 +271,8 @@ class BoxModel extends BaseModel { .where((e) => e.status == "Packed" || e.status == "Received" || - e.status == "Shipped") + e.status == "Shipped" || + e.status == "Arrived") .toList() ..sort((e1, e2) { return e2.packageNumber.compareTo(e1.packageNumber); diff --git a/lib/pages/buying_online.dart b/lib/pages/buying_online.dart index e5e65fc..a822004 100644 --- a/lib/pages/buying_online.dart +++ b/lib/pages/buying_online.dart @@ -18,12 +18,20 @@ class BuyingOnlinePage extends StatefulWidget { _BuyingOnlinePagetate createState() => _BuyingOnlinePagetate(); } -class _BuyingOnlinePagetate extends State { +class _BuyingOnlinePagetate extends State + with SingleTickerProviderStateMixin { bool _isLoading = false; List images = [ 'assets/Fullname.jpeg', 'assets/FirstName&LastName.jpeg' ]; + TabController _tabController; + + @override + void initState() { + _tabController = TabController(vsync: this, length: 2); + super.initState(); + } @override Widget build(BuildContext context) { @@ -146,21 +154,58 @@ class _BuyingOnlinePagetate extends State { ) ], ), + // deliveryAddressBox, 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, 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), - ); - }), + child: new TabBarView( + controller: _tabController, + children: [ + Container( + child: + Image.asset('assets/Fullname.png', 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) ], diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index a6e2509..864d765 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -2,6 +2,7 @@ import 'package:country_code_picker/country_code.dart'; import 'package:fcs/model/main_model.dart'; import 'package:fcs/pages/shipment_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/widget/bottom_up_page_route.dart'; import 'package:fcs/widget/localization/transalation.dart'; @@ -178,6 +179,10 @@ class _HomePageState extends State { icon: FontAwesomeIcons.info, btnCallback: () => Navigator.of(context).push(BottomUpPageRoute(Term()))); + final deliveryBtn = _buildBtn2("delivery.title", + icon: MaterialCommunityIcons.truck_fast, + btnCallback: () => + Navigator.of(context).push(BottomUpPageRoute(DeliverList()))); List widgets = []; customer ? widgets.add(buyingBtn) : ""; @@ -188,7 +193,8 @@ class _HomePageState extends State { owner ? widgets.add(fcsProfileBtn) : ""; widgets.add(shipmentCostBtn); customer || owner ? widgets.add(packagesBtn) : ""; - customer || owner ? widgets.add(boxesBtn) : ""; + owner ? widgets.add(boxesBtn) : ""; + owner ? widgets.add(deliveryBtn) : ""; owner ? widgets.add(customersBtn) : ""; customer || owner ? widgets.add(invoicesBtn) : ""; widgets.add(termBtn); @@ -318,7 +324,8 @@ class _HomePageState extends State { children: [ // _buildSmallButton( // "Policies", FontAwesomeIcons.fileContract), - _buildSmallButton("Contact Us", SimpleLineIcons.support), + _buildSmallButton( + "Contact Us", SimpleLineIcons.support), ], ) ], diff --git a/lib/pages/pickup_box_editor.dart b/lib/pages/pickup_box_editor.dart new file mode 100644 index 0000000..7eecc75 --- /dev/null +++ b/lib/pages/pickup_box_editor.dart @@ -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 { + 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 packages = [ + PackageModel.packages[0], + PackageModel.packages[1], + PackageModel.packages[2] + ]; + + List _cargoTypes = [ + Cargo(type: 'General Cargo', weight: 25), + Cargo(type: 'Medicine', weight: 20), + Cargo(type: 'Dangerous Cargo', weight: 30) + ]; + + var shipmentModel = Provider.of(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: [ + 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: [ + 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 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(); + } +} diff --git a/lib/pages/pickup_editor.dart b/lib/pages/pickup_editor.dart index 4299f8a..0fb7989 100644 --- a/lib/pages/pickup_editor.dart +++ b/lib/pages/pickup_editor.dart @@ -1,8 +1,14 @@ import 'package:fcs/model/main_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_fcs/shipping_address_row.dart'; +import 'package:fcs/vo/box.dart'; import 'package:fcs/vo/cargo.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_readonly.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 '../theme/theme.dart'; +import 'pickup_box_editor.dart'; class PickUpEditor extends StatefulWidget { final PickUp pickUp; @@ -49,6 +56,7 @@ class _PickUpEditorState extends State { bool _isLoading = false; var now = new DateTime.now(); bool isNew; + ShippingAddress _shippingAddress = new ShippingAddress(); @override void initState() { @@ -78,6 +86,8 @@ class _PickUpEditorState extends State { ]; _pickUp = PickUp(cargoTypes: _cargoTypes); } + var shipmentModel = Provider.of(context, listen: false); + _shippingAddress = shipmentModel.shippingAddresses[1]; } @override @@ -216,6 +226,7 @@ class _PickUpEditorState extends State { )); MainModel mainModel = Provider.of(context); + var boxModel = Provider.of(context); return LocalProgress( inAsyncCall: _isLoading, @@ -253,7 +264,11 @@ class _PickUpEditorState extends State { ), ), ExpansionTile( - title: Text('Pickup Location / Time'), + title: Text( + 'Pickup Location / Time', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), children: [ Padding( padding: const EdgeInsets.only(left: 20.0), @@ -280,7 +295,11 @@ class _PickUpEditorState extends State { ], ), ExpansionTile( - title: Text('Package Information'), + title: Text( + 'Package Information', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), children: [ Padding( padding: const EdgeInsets.only(left: 20.0), @@ -322,60 +341,136 @@ class _PickUpEditorState extends State { padding: const EdgeInsets.only(left: 20.0), 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: [ + 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), ], ), // ExpansionTile( - // title: Text('Box Information'), + // title: Text( + // 'Shipping Address', + // style: TextStyle( + // color: primaryColor, fontWeight: FontWeight.bold), + // ), // children: [ - // 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: [ - 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() ? Container() : ExpansionTile( @@ -413,14 +508,14 @@ class _PickUpEditorState extends State { : Container( child: Column( children: [ - widget.pickUp.status == 'Assigned' + widget.pickUp.status == 'Confirmed' ? Align( alignment: Alignment.bottomCenter, child: Center( child: Container( width: 250, child: FlatButton( - child: Text('Complete'), + child: Text('Complete Pickup'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -434,7 +529,7 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - child: Text('Assign'), + child: Text('Assign Pickup'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -442,20 +537,6 @@ class _PickUpEditorState extends State { }, ), ))), - 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( alignment: Alignment.bottomCenter, child: Center( @@ -478,4 +559,136 @@ class _PickUpEditorState extends State { ), ); } + + List getBoxList(BuildContext context, List boxes) { + List _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: [ + Row( + children: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: new Row( + children: [ + new Expanded( + child: new Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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: [ + 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(); + } } diff --git a/lib/pages/pickup_list.dart b/lib/pages/pickup_list.dart index bd0b67e..33f1368 100644 --- a/lib/pages/pickup_list.dart +++ b/lib/pages/pickup_list.dart @@ -2,20 +2,13 @@ import 'package:fcs/model/pickup_model.dart'; import 'package:fcs/pages/pickup_list_row.dart'; import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:provider/provider.dart'; -import 'package:fcs/model/buyer_model.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/popupmenu.dart'; import 'package:flutter/material.dart'; import 'package:fcs/widget/progress.dart'; import '../theme/theme.dart'; -import '../theme/theme.dart'; -import '../theme/theme.dart'; -import 'buyer_list_row.dart'; import 'pickup_editor.dart'; class PickUpList extends StatefulWidget { @@ -24,7 +17,6 @@ class PickUpList extends StatefulWidget { } class _PickUpListState extends State { - Buyer buyer; bool _isLoading = false; @override @@ -39,56 +31,69 @@ class _PickUpListState extends State { @override Widget build(BuildContext context) { + var pickupModel = Provider.of(context); return LocalProgress( inAsyncCall: _isLoading, child: DefaultTabController( length: 3, child: Scaffold( - appBar: AppBar( - centerTitle: true, - leading: new IconButton( - icon: new Icon(Icons.close), - onPressed: () => Navigator.of(context).pop(), - ), - backgroundColor: primaryColor, - title: Text(AppTranslations.of(context).text("pickup.title")), - actions: [ - IconButton( - icon: Icon( - Icons.search, - color: Colors.white, - ), - iconSize: 30, - onPressed: () => showPlacesSearch(context), + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: primaryColor, + title: Text(AppTranslations.of(context).text("pickup.title")), + actions: [ + IconButton( + icon: Icon( + Icons.search, + color: Colors.white, ), - ], - bottom: TabBar( - unselectedLabelColor: Colors.grey, - tabs: [ - Tab( - text: "Upcoming", - ), - Tab(text: "Completed"), - Tab(text: "Canceled"), - ], + iconSize: 30, + onPressed: () => showPlacesSearch(context), ), - ), - floatingActionButton: FloatingActionButton.extended( - onPressed: () { - _newPickup(); - }, - icon: Icon(Icons.add), - label: Text(AppTranslations.of(context).text("pickup.new")), - backgroundColor: primaryColor, - ), - body: TabBarView( - children: [ - //Icon(Icons.directions_car), - _upComing(), - _completed(), - _canceled() - ], - )), + ], + // bottom: TabBar( + // unselectedLabelColor: Colors.grey, + // tabs: [ + // Tab( + // text: "Upcoming", + // ), + // Tab(text: "Completed"), + // Tab(text: "Canceled"), + // ], + // ), + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: () { + _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() + // ], + // ) + ), ), ); } diff --git a/lib/pages/profile_page.dart b/lib/pages/profile_page.dart index abe7d85..0dd3dc7 100644 --- a/lib/pages/profile_page.dart +++ b/lib/pages/profile_page.dart @@ -1,4 +1,5 @@ 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/widget/bottom_up_page_route.dart'; import 'package:fcs/widget/local_text.dart'; @@ -216,7 +217,7 @@ class _ProfileState extends State { )); final logoutbutton = Container( - padding: EdgeInsets.only( left: 20.0, right: 24.0), + padding: EdgeInsets.only(left: 20.0, right: 24.0), child: Padding( padding: EdgeInsets.symmetric(vertical: 10.0), child: Card( @@ -330,7 +331,7 @@ class _ProfileState extends State { child: Align( alignment: Alignment.bottomRight, child: Container( - width: 120, + width: 130, height: 40, child: FloatingActionButton.extended( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, @@ -340,6 +341,7 @@ class _ProfileState extends State { BottomUpPageRoute(ShippingAddressEditor()), ); }, + icon: Icon(Icons.add), label: Text( 'Add Shipping\nAddress', style: TextStyle(fontSize: 12), @@ -357,72 +359,14 @@ class _ProfileState extends State { List getAddressList( BuildContext context, List addresses) { return addresses.asMap().entries.map((s) { - return Container( - padding: EdgeInsets.only(left: 10, right: 10), - child: InkWell( - onTap: () { - Navigator.push( - context, - BottomUpPageRoute( - ShippingAddressEditor(shippingAddress: s.value)), - ); - }, - child: Column( - children: [ - Row( - children: [ - Expanded( - child: new Padding( - padding: const EdgeInsets.symmetric(vertical: 10.0), - child: Row( - children: [ - Padding( - padding: EdgeInsets.all(5.0), - child: Icon( - SimpleLineIcons.location_pin, - color: primaryColor, - )), - new Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - 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) - ], - ), - ), + return InkWell( + onTap: () { + Navigator.push( + context, + BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s.value)), + ); + }, + child: ShippingAddressRow(shippingAddress: s.value, index: s.key), ); }).toList(); } diff --git a/lib/pages_fcs/box_editor.dart b/lib/pages_fcs/box_editor.dart index bc08e80..35edd94 100644 --- a/lib/pages_fcs/box_editor.dart +++ b/lib/pages_fcs/box_editor.dart @@ -1,10 +1,13 @@ 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/shipping_address_editor.dart'; import 'package:fcs/pages/util.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'; @@ -19,6 +22,7 @@ import 'package:timeline_list/timeline.dart'; import 'package:timeline_list/timeline_model.dart'; import '../theme/theme.dart'; +import 'shipping_address_row.dart'; class BoxEditor extends StatefulWidget { final Box box; @@ -45,14 +49,15 @@ class _BoxEditorState extends State { "assets/photos/3.jpg" ]; 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; // _addressEditingController.text = _pickUp.address; // _fromTimeEditingController.text = _pickUp.fromTime; @@ -72,6 +77,9 @@ class _BoxEditorState extends State { Cargo(type: 'Dangerous Cargo', weight: 30) ]; + var shipmentModel = Provider.of(context, listen: false); + _shippingAddress = shipmentModel.shippingAddresses[1]; + isNew = true; _box = Box( rate: 0, @@ -133,6 +141,7 @@ class _BoxEditorState extends State { @override Widget build(BuildContext context) { var mainModel = Provider.of(context); + var shipmentModel = Provider.of(context); var images = isNew ? [] : _images; return LocalProgress( @@ -247,7 +256,7 @@ class _BoxEditorState extends State { ), ExpansionTile( title: Text( - 'Packages', + 'Cargo Types', style: TextStyle( color: primaryColor, fontWeight: FontWeight.bold), ), @@ -333,7 +342,6 @@ class _BoxEditorState extends State { ), ), ), - mainModel.isOwner() ? Container( padding: EdgeInsets.only(top: 20), @@ -403,6 +411,39 @@ class _BoxEditorState extends State { 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 ? Container() : ExpansionTile( @@ -459,8 +500,24 @@ class _BoxEditorState extends State { }, ), ))), + 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 { ); }).toList(); } + + List getAddressList( + BuildContext context, List addresses) { + return addresses.asMap().entries.map((s) { + return InkWell( + onTap: () {}, + child: ShippingAddressRow(shippingAddress: s.value, index: s.key), + ); + }).toList(); + } } diff --git a/lib/pages_fcs/delivery_list.dart b/lib/pages_fcs/delivery_list.dart new file mode 100644 index 0000000..859e88f --- /dev/null +++ b/lib/pages_fcs/delivery_list.dart @@ -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 { + 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: [ + 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(context); + return Column( + children: [ + 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(context); + return Column( + children: [ + 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, + ); + }), + ), + ], + ); + } +} diff --git a/lib/pages_fcs/delivery_list_row.dart b/lib/pages_fcs/delivery_list_row.dart new file mode 100644 index 0000000..ba265a1 --- /dev/null +++ b/lib/pages_fcs/delivery_list_row.dart @@ -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 { + 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: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 16.0), + child: new Row( + children: [ + new Expanded( + child: new Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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: [ + 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: [ + 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), + ), + ], + ), + ), + ], + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages_fcs/shipping_address_row.dart b/lib/pages_fcs/shipping_address_row.dart new file mode 100644 index 0000000..231b38b --- /dev/null +++ b/lib/pages_fcs/shipping_address_row.dart @@ -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(context); + return Container( + padding: EdgeInsets.only(left: 10, right: 10), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 10.0), + child: Row( + children: [ + // Padding( + // padding: EdgeInsets.all(5.0), + // child: Icon( + // SimpleLineIcons.location_pin, + // color: primaryColor, + // )), + new Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + 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) + ], + ), + ); + } +} diff --git a/lib/vo/box.dart b/lib/vo/box.dart index 0f2bd84..d619fc7 100644 --- a/lib/vo/box.dart +++ b/lib/vo/box.dart @@ -1,4 +1,5 @@ import 'package:fcs/vo/cargo.dart'; +import 'package:fcs/vo/shipping_address.dart'; import 'package.dart'; class Status { @@ -36,6 +37,8 @@ class Box { List cargoTypes; + ShippingAddress shippingAddress; + int get amount => rate != null && weight != null ? rate * weight : 0; String get packageNumber => @@ -67,5 +70,6 @@ class Box { this.cargoDesc, this.statusHistory, this.packages, - this.cargoTypes}); + this.cargoTypes, + this.shippingAddress}); }