diff --git a/lib/model/pickup_model.dart b/lib/model/pickup_model.dart index afff27d..5e8a947 100644 --- a/lib/model/pickup_model.dart +++ b/lib/model/pickup_model.dart @@ -56,6 +56,7 @@ class PickUpModel extends BaseModel { address: '154-19 64th Ave.\nFlushing, NY 11367', handlingFee: 5000, isCourier: true, + radioIndex: 2, cargoTypes: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -73,6 +74,8 @@ class PickUpModel extends BaseModel { date: DateTime(2020, 5, 6), address: '154-19 64th Ave.\nFlushing, NY 11367', handlingFee: 5000, + isCourier: true, + radioIndex: 4, cargoTypes: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), @@ -90,6 +93,7 @@ class PickUpModel extends BaseModel { date: DateTime(2020, 5, 9), address: '154-19 64th Ave.\nFlushing, NY 11367', handlingFee: 5000, + radioIndex: 3, cargoTypes: [ Cargo(type: 'General Cargo', weight: 25), Cargo(type: 'Medicine', weight: 20), diff --git a/lib/pages/pickup_editor.dart b/lib/pages/pickup_editor.dart index 9d8f833..2cc2bed 100644 --- a/lib/pages/pickup_editor.dart +++ b/lib/pages/pickup_editor.dart @@ -58,8 +58,7 @@ class _PickUpEditorState extends State { bool isNew; ShippingAddress _shippingAddress = new ShippingAddress(); - dynamic _currVal = 1; - String _currText = ''; + int _currVal = 1; @override void initState() { @@ -74,6 +73,7 @@ class _PickUpEditorState extends State { _weightEditingController.text = _pickUp.weight.toString(); _pickupDate.text = dateFormatter.format(now); _handlingFeeController.text = numberFormatter.format(_pickUp.handlingFee); + _currVal = _pickUp.radioIndex; var mainModel = Provider.of(context, listen: false); _recipientNameEditingController.text = mainModel.recipient.name; @@ -230,6 +230,7 @@ class _PickUpEditorState extends State { MainModel mainModel = Provider.of(context); var boxModel = Provider.of(context); + // var shipmentModel = Provider.of(context); return LocalProgress( inAsyncCall: _isLoading, @@ -308,74 +309,28 @@ class _PickUpEditorState extends State { ), ], ), - - ExpansionTile( - title: Text( - 'Package 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 Package', - style: TextStyle(fontSize: 12), - ), - backgroundColor: primaryColor, - ), + _currVal == 3 + ? Container( + child: ShippingAddressRow( + shippingAddress: ShippingAddress( + fullName: 'Myo Min', + addressLine1: '154-19 64th Ave.', + addressLine2: 'Flushing', + city: 'NY', + state: 'NY', + phoneNumber: '+1 (292)215-2247'), + ), + ) + : ExpansionTile( + title: Text( + 'Package Information', + style: TextStyle( + color: primaryColor, + fontWeight: FontWeight.bold), ), - ), - ), - 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), + Column( + children: getBoxList(context, boxModel.boxes), ), Container( padding: EdgeInsets.only( @@ -388,10 +343,15 @@ class _PickUpEditorState extends State { child: FloatingActionButton.extended( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - onPressed: () {}, icon: Icon(Icons.add), + onPressed: () { + Navigator.push( + context, + BottomUpPageRoute(PickupBoxEditor()), + ); + }, label: Text( - 'Select\nAddress', + 'Add Package', style: TextStyle(fontSize: 12), ), backgroundColor: primaryColor, @@ -399,62 +359,118 @@ class _PickUpEditorState extends State { ), ), ), + SizedBox(height: 10.0), ], ), - // 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( + _currVal == 3 + ? Container() + : ExpansionTile( + title: Text( + 'Pickup Location / Time', + style: TextStyle( + color: primaryColor, + fontWeight: FontWeight.bold), + ), children: [ - SizedBox(height: 5), - Container(height: 50.0, child: requestDateBox) + 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), ], ), - ), - SizedBox(height: 15.0), - ], - ), // ExpansionTile( // title: Text( // 'Package Information', @@ -555,7 +571,7 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - child: Text('Request for pickup'), + child: Text('Request for shipment'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -573,7 +589,7 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - child: Text('Complete Pickup'), + child: Text('Complete Shipment'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -587,7 +603,7 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - child: Text('Assign Pickup'), + child: Text('Assign Shipment'), color: primaryColor, textColor: Colors.white, onPressed: () { @@ -601,7 +617,7 @@ class _PickUpEditorState extends State { child: Container( width: 250, child: FlatButton( - child: Text('Cancel Pickup'), + child: Text('Cancel Shipment'), color: Colors.grey[600], textColor: Colors.white, onPressed: () { diff --git a/lib/vo/pickup.dart b/lib/vo/pickup.dart index 697d358..850b78b 100644 --- a/lib/vo/pickup.dart +++ b/lib/vo/pickup.dart @@ -14,6 +14,7 @@ class PickUp { DateTime date; List cargoTypes; bool isCourier; + int radioIndex; PickUp( {this.id, @@ -28,7 +29,8 @@ class PickUp { this.status, this.date, this.cargoTypes, - this.isCourier=false}); + this.isCourier = false, + this.radioIndex = 1}); int get last => DateTime.now().difference(date).inDays; diff --git a/lib/vo/radio.dart b/lib/vo/radio.dart index 63c9e06..ab1a7a1 100644 --- a/lib/vo/radio.dart +++ b/lib/vo/radio.dart @@ -1,5 +1,5 @@ class RadioGroup { String text; - dynamic index; + int index; RadioGroup({this.text, this.index}); } \ No newline at end of file