From a8caaf6073fe92f02cb81ada046b551c25848e3e Mon Sep 17 00:00:00 2001 From: Thinzar Win Date: Tue, 30 Jun 2020 16:27:56 +0630 Subject: [PATCH] update pickup --- assets/local/localization_en.json | 8 +- assets/local/localization_mu.json | 6 +- lib/model/pickup_model.dart | 21 ++ lib/pages/notification_list.dart | 5 +- lib/pages/pickup_box_editor.dart | 12 +- lib/pages/pickup_editor.dart | 355 +++++++++++++++++------------- lib/vo/pickup.dart | 4 +- lib/vo/radio.dart | 5 + 8 files changed, 250 insertions(+), 166 deletions(-) create mode 100644 lib/vo/radio.dart diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index ba827aa..80fa72d 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -504,10 +504,10 @@ "shipment.form.title":"SHIPMENT", "shipment.number":"Shipment number", - "pickup": "Pickups", - "pickup.title": "PICKUPS", - "pickup.new": "New Pickup", - "pickup.edit.title": "PICKUP", + "pickup": "Shipments", + "pickup.title": "SHIPMENTS", + "pickup.new": "New Shipment", + "pickup.edit.title": "SHIPMENT", "rate":"Rates", "rate.title":"RATES", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 48ae8ad..1e5d00d 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -548,9 +548,9 @@ "package.weight":"Weight", "package.amount":"Amount", - "pickup": "Pickups", - "pickup.title": "Pickups", - "pickup.new": "New Pickup", + "pickup": "Shipments", + "pickup.title": "SHIPMENTS", + "pickup.new": "New Shipment", "pickup.edit.title": "PICKUP", "pickup.date": "Pickup Date", "pickup.location_time": "Pickup Location / Time", diff --git a/lib/model/pickup_model.dart b/lib/model/pickup_model.dart index da167b6..afff27d 100644 --- a/lib/model/pickup_model.dart +++ b/lib/model/pickup_model.dart @@ -4,6 +4,7 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:fcs/vo/cargo.dart'; import 'package:fcs/vo/fcs_profile.dart'; import 'package:fcs/vo/pickup.dart'; +import 'package:fcs/vo/radio.dart'; import 'package:logging/logging.dart'; import 'base_model.dart'; @@ -22,6 +23,25 @@ class PickUpModel extends BaseModel { mail: 'admin@fcs.com', facebook: 'https://facebook.com/fcs'); + List radioGroups = [ + RadioGroup( + text: "FCS Pickup", + index: 1, + ), + RadioGroup( + text: "Courier Pickup", + index: 2, + ), + RadioGroup( + text: "FCS Drop-off", + index: 3, + ), + RadioGroup( + text: "Courier Drop-off", + index: 4, + ), + ]; + List pickups = [ PickUp( id: "P200412 - 12 Apr 2020", @@ -35,6 +55,7 @@ class PickUpModel extends BaseModel { date: DateTime(2020, 5, 1), address: '154-19 64th Ave.\nFlushing, NY 11367', handlingFee: 5000, + isCourier: true, cargoTypes: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), diff --git a/lib/pages/notification_list.dart b/lib/pages/notification_list.dart index 6317876..dcd75f7 100644 --- a/lib/pages/notification_list.dart +++ b/lib/pages/notification_list.dart @@ -108,7 +108,10 @@ class _NotificationListState extends State { ), msg.fromToday() ? Container() - : Text(dateFormatter.format(msg.date),style: TextStyle(color: Colors.grey),), + : Text( + dateFormatter.format(msg.date), + style: TextStyle(color: Colors.grey), + ), ], ), ) diff --git a/lib/pages/pickup_box_editor.dart b/lib/pages/pickup_box_editor.dart index cc7ce1b..d7d8588 100644 --- a/lib/pages/pickup_box_editor.dart +++ b/lib/pages/pickup_box_editor.dart @@ -90,7 +90,7 @@ class _PickupBoxEditorState extends State { onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, - title: Text(AppTranslations.of(context).text("box.edit.title")), + title: Text(AppTranslations.of(context).text("package.edit.title")), ), body: Card( child: Column( @@ -220,7 +220,7 @@ class _PickupBoxEditorState extends State { ), ExpansionTile( title: Text( - 'Shipping Address', + 'Address', style: TextStyle( color: primaryColor, fontWeight: FontWeight.bold), ), @@ -232,7 +232,7 @@ class _PickupBoxEditorState extends State { child: Align( alignment: Alignment.bottomRight, child: Container( - width: 130, + width: 120, height: 40, child: FloatingActionButton.extended( materialTapTargetSize: @@ -240,7 +240,7 @@ class _PickupBoxEditorState extends State { onPressed: () {}, icon: Icon(Icons.add), label: Text( - 'Add Shipping\nAddress', + 'Select\nAddress', style: TextStyle(fontSize: 12), ), backgroundColor: primaryColor, @@ -261,7 +261,7 @@ class _PickupBoxEditorState extends State { child: Container( width: 250, child: FlatButton( - child: Text('Create New Box'), + child: Text('Create New Package'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -278,7 +278,7 @@ class _PickupBoxEditorState extends State { child: Container( width: 250, child: FlatButton( - child: Text('Update Box'), + child: Text('Update Package'), color: primaryColor, textColor: Colors.white, onPressed: () { diff --git a/lib/pages/pickup_editor.dart b/lib/pages/pickup_editor.dart index a2d8798..9d8f833 100644 --- a/lib/pages/pickup_editor.dart +++ b/lib/pages/pickup_editor.dart @@ -58,6 +58,9 @@ class _PickUpEditorState extends State { bool isNew; ShippingAddress _shippingAddress = new ShippingAddress(); + dynamic _currVal = 1; + String _currText = ''; + @override void initState() { super.initState(); @@ -265,134 +268,53 @@ class _PickUpEditorState extends State { ), widget.pickUp == null ? Container() - : Padding( - padding: const EdgeInsets.only(left: 15.0), - child: fcsInputReadOnly( - "Handling Fee", FontAwesomeIcons.moneyBill, - controller: _handlingFeeController), - // child: widget.pickUp == null - // ? fcsInput( - // "Handling Fee", FontAwesomeIcons.moneyBill, - // controller: _handlingFeeController) - // : widget.pickUp.status == 'Pending' - // ? fcsInput( - // "Handling Fee", FontAwesomeIcons.moneyBill, - // controller: _handlingFeeController) - // : fcsInputReadOnly( - // "Handling Fee", FontAwesomeIcons.moneyBill, - // controller: _handlingFeeController), - ), + : widget.pickUp.isCourier + ? Padding( + padding: const EdgeInsets.only(left: 15.0), + child: fcsInputReadOnly( + "Courier Fee", FontAwesomeIcons.moneyBill, + controller: _handlingFeeController), + ) + : Padding( + padding: const EdgeInsets.only(left: 15.0), + child: fcsInputReadOnly( + "Handling Fee", FontAwesomeIcons.moneyBill, + controller: _handlingFeeController), + ), + ExpansionTile( title: Text( - 'Pickup Location / Time', + 'Shipment Type', style: TextStyle( color: primaryColor, fontWeight: FontWeight.bold), ), children: [ - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: widget.pickUp == null - ? pickUpAddress - : widget.pickUp.status == 'Pending' - ? pickUpAddress - : pickUpAddressReadOnly, - ), - widget.pickUp == null - ? pickupTime - : widget.pickUp.status == 'Pending' - ? pickupTime - : pickupTimeReadOnly, - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: Column( - children: [ - SizedBox(height: 5), - Container(height: 50.0, child: requestDateBox) - ], + Container( + child: Wrap( + children: pickupModel.radioGroups + .map((t) => RadioListTile( + title: Text("${t.text}"), + groupValue: _currVal, + activeColor: primaryColor, + value: t.index, + onChanged: (val) { + setState(() { + _currVal = val; + }); + }, + )) + .toList(), ), ), ], ), + ExpansionTile( title: Text( 'Package Information', style: TextStyle( color: primaryColor, fontWeight: FontWeight.bold), ), - children: [ - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: widget.pickUp == null - ? noOfPackageBox - : widget.pickUp.status == 'Pending' - ? noOfPackageBox - : noOfPackageBoxReadonly, - ), - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: widget.pickUp == null - ? fcsInput("Total Weight (lb)", - FontAwesomeIcons.weightHanging, - controller: _weightEditingController) - : widget.pickUp.status == 'Pending' - ? fcsInput("Total Weight (lb)", - FontAwesomeIcons.weightHanging, - controller: _weightEditingController) - : fcsInputReadOnly("Total Weight (lb)", - FontAwesomeIcons.weightHanging, - controller: _weightEditingController), - ), - Padding( - 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), @@ -416,7 +338,7 @@ class _PickUpEditorState extends State { ); }, label: Text( - 'Add Box', + 'Add Package', style: TextStyle(fontSize: 12), ), backgroundColor: primaryColor, @@ -427,53 +349,184 @@ class _PickUpEditorState extends State { SizedBox(height: 10.0), ], ), + ExpansionTile( + title: Text( + 'Pickup Location / Time', + style: TextStyle( + color: primaryColor, fontWeight: FontWeight.bold), + ), + children: [ + Padding( + padding: const EdgeInsets.only(left: 20.0), + child: Column( + children: [ + Row( + children: [ + Icon( + Icons.location_on, + color: primaryColor, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text('Pickup Address'), + ), + ], + ), + Padding( + padding: const EdgeInsets.only(left: 10.0), + child: ShippingAddressRow( + shippingAddress: _shippingAddress), + ), + 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, + onPressed: () {}, + icon: Icon(Icons.add), + label: Text( + 'Select\nAddress', + style: TextStyle(fontSize: 12), + ), + backgroundColor: primaryColor, + ), + ), + ), + ), + ], + ), + // child: ExpansionTile( + // leading: Icon( + // Icons.location_on, + // color: primaryColor, + // ), + // title: Text('My Address'), + // children: [ + // Padding( + // padding: const EdgeInsets.only(left: 10.0), + // child: ShippingAddressRow( + // shippingAddress: _shippingAddress), + // ), + // 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, + // onPressed: () {}, + // icon: Icon(Icons.add), + // label: Text( + // 'Select\nAddress', + // style: TextStyle(fontSize: 12), + // ), + // backgroundColor: primaryColor, + // ), + // ), + // ), + // ), + // ], + // ), + ), + widget.pickUp == null + ? pickupTime + : widget.pickUp.status == 'Pending' + ? pickupTime + : pickupTimeReadOnly, + Padding( + padding: const EdgeInsets.only(left: 20.0), + child: Column( + children: [ + SizedBox(height: 5), + Container(height: 50.0, child: requestDateBox) + ], + ), + ), + SizedBox(height: 15.0), + ], + ), // ExpansionTile( // title: Text( - // 'Shipping Address', + // 'Package Information', // style: TextStyle( // color: primaryColor, fontWeight: FontWeight.bold), // ), // 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: const EdgeInsets.only(left: 20.0), + // child: widget.pickUp == null + // ? noOfPackageBox + // : widget.pickUp.status == 'Pending' + // ? noOfPackageBox + // : noOfPackageBoxReadonly, + // ), // 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: const EdgeInsets.only(left: 20.0), + // child: widget.pickUp == null + // ? fcsInput("Total Weight (lb)", + // FontAwesomeIcons.weightHanging, + // controller: _weightEditingController) + // : widget.pickUp.status == 'Pending' + // ? fcsInput("Total Weight (lb)", + // FontAwesomeIcons.weightHanging, + // controller: _weightEditingController) + // : fcsInputReadOnly("Total Weight (lb)", + // FontAwesomeIcons.weightHanging, + // controller: _weightEditingController), + // ), // 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)), + // 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), // ], // ), mainModel.isCustomer() diff --git a/lib/vo/pickup.dart b/lib/vo/pickup.dart index d34a123..697d358 100644 --- a/lib/vo/pickup.dart +++ b/lib/vo/pickup.dart @@ -13,6 +13,7 @@ class PickUp { String status; DateTime date; List cargoTypes; + bool isCourier; PickUp( {this.id, @@ -26,7 +27,8 @@ class PickUp { this.address, this.status, this.date, - this.cargoTypes}); + this.cargoTypes, + this.isCourier=false}); int get last => DateTime.now().difference(date).inDays; diff --git a/lib/vo/radio.dart b/lib/vo/radio.dart new file mode 100644 index 0000000..63c9e06 --- /dev/null +++ b/lib/vo/radio.dart @@ -0,0 +1,5 @@ +class RadioGroup { + String text; + dynamic index; + RadioGroup({this.text, this.index}); +} \ No newline at end of file