From 897e5c9b93ca5623da66e9196aa9181987f665ff Mon Sep 17 00:00:00 2001 From: Sai Naw Wun Date: Wed, 7 Oct 2020 14:42:07 +0630 Subject: [PATCH] rename shipment --- assets/local/localization_mu.json | 16 +++-- lib/app.dart | 8 +-- .../{shipment.dart => fcs_shipment.dart} | 4 +- lib/domain/entities/pickup.dart | 8 +-- lib/pages/customer/invitation_create.dart | 9 ++- .../fcs_shipment/fcs_shipment_editor.dart | 6 +- .../fcs_shipment/fcs_shipment_list_row.dart | 6 +- .../model/fcs_shipment_model.dart | 34 +++++----- lib/pages/main/home_page.dart | 4 +- lib/pages/main/util.dart | 63 ------------------- lib/pages/rates/shipment_rates.dart | 8 ++- ...{pickup_model.dart => shipment_model.dart} | 59 ++++++++--------- ...ickup_editor.dart => shipment_editor.dart} | 18 +++--- .../{pickup_list.dart => shipment_list.dart} | 30 ++++----- ...p_list_row.dart => shipment_list_row.dart} | 16 ++--- 15 files changed, 117 insertions(+), 172 deletions(-) rename lib/domain/entities/{shipment.dart => fcs_shipment.dart} (93%) rename lib/pages/shipment/model/{pickup_model.dart => shipment_model.dart} (92%) rename lib/pages/shipment/{pickup_editor.dart => shipment_editor.dart} (98%) rename lib/pages/shipment/{pickup_list.dart => shipment_list.dart} (82%) rename lib/pages/shipment/{pickup_list_row.dart => shipment_list_row.dart} (90%) diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 8ef116b..56abfdd 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -1,4 +1,13 @@ { + "Buttons Start ================================================================":"", + "btn.save":"သိမ်းဆည်းရန်", + "btn.approve":"အတည်ပြုရန်", + "btn.delete":"ဖျက်ရန်", + "btn.select":"ရွေးချယ်ပါ", + "btn.cancel":"Cancel", + "Buttons End ================================================================":"", + + "Contact Start ================================================================":"", "contact.btn":"ဆက်သွယ်ရန်", "contact.title":"ဆက်သွယ်ရန်", "contact.phone.title":"ဖုန်းနံပါတ်ထည့်သွင်းရန်", @@ -26,8 +35,8 @@ "contact.findus":"တည်နေရာ", "contact.emailus":"အီးမေးလ်", "contact.visitus":"ကြည့်ပါ", - "contact.edit.title":"ဆက်သွယ်ရန် ပြုပြင်ခြင်း", + "Contact End ================================================================":"", "term":"စည်းကမ်းချက်များ", "term.btn":"စည်းကမ်းချက်များ", @@ -158,11 +167,6 @@ "boxes.new":"New Box", "box.edit.title":"Edit Box", - "btn.save":"သိမ်းဆည်းရန်", - "btn.approve":"အတည်ပြုရန်", - "btn.delete":"ဖျက်ရန်", - "btn.select":"ရွေးချယ်ပါ", - "btn.cancel":"Cancel", "================================================================":"", diff --git a/lib/app.dart b/lib/app.dart index ff2e77b..4b2d409 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -16,7 +16,7 @@ import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/package/model/package_model.dart'; import 'package:fcs/pages/payment_methods/model/payment_method_model.dart'; import 'package:fcs/pages/rates/model/shipment_rate_model.dart'; -import 'package:fcs/pages/shipment/model/pickup_model.dart'; +import 'package:fcs/pages/shipment/model/shipment_model.dart'; import 'package:fcs/pages/shipment_address/model/shipment_address_model.dart'; import 'package:fcs/pages/main/splash_page.dart'; import 'package:fcs/pages/staff/model/staff_model.dart'; @@ -40,7 +40,7 @@ class _AppState extends State { final PaymentMethodModel paymentMethodModel = new PaymentMethodModel(); final FcsShipmentModel fcsShipmentModel = new FcsShipmentModel(); final LanguageModel lanuguageModel = new LanguageModel(); - final PickUpModel pickUpModel = new PickUpModel(); + final ShipmentModel shipmentModel = new ShipmentModel(); final ShipmentRateModel shipmentRateModel = new ShipmentRateModel(); final BoxModel boxModel = new BoxModel(); final MessageModel messageModel = new MessageModel(); @@ -67,7 +67,7 @@ class _AppState extends State { ..addModel(discountModel) ..addModel(shipmentRateModel) ..addModel(boxModel) - ..addModel(pickUpModel) + ..addModel(shipmentModel) ..addModel(invoiceModel) ..addModel(marketModel); @@ -98,7 +98,7 @@ class _AppState extends State { ChangeNotifierProvider.value(value: mainModel), ChangeNotifierProvider.value(value: staffModel), ChangeNotifierProvider.value(value: lanuguageModel), - ChangeNotifierProvider.value(value: pickUpModel), + ChangeNotifierProvider.value(value: shipmentModel), ChangeNotifierProvider.value(value: shipmentRateModel), ChangeNotifierProvider.value(value: shipmentAddressModel), ChangeNotifierProvider.value(value: packageModel), diff --git a/lib/domain/entities/shipment.dart b/lib/domain/entities/fcs_shipment.dart similarity index 93% rename from lib/domain/entities/shipment.dart rename to lib/domain/entities/fcs_shipment.dart index 1c3f321..7d4326a 100644 --- a/lib/domain/entities/shipment.dart +++ b/lib/domain/entities/fcs_shipment.dart @@ -1,4 +1,4 @@ -class Shipment { +class FcsShipment { DateTime shipDate; String shipmentNumber; DateTime cutoffDate; @@ -10,7 +10,7 @@ class Shipment { String destination; String status; String remark; - Shipment( + FcsShipment( {this.shipDate, this.shipmentNumber, this.cutoffDate, diff --git a/lib/domain/entities/pickup.dart b/lib/domain/entities/pickup.dart index 850b78b..732b3f1 100644 --- a/lib/domain/entities/pickup.dart +++ b/lib/domain/entities/pickup.dart @@ -1,6 +1,6 @@ import 'cargo.dart'; -class PickUp { +class Shipment { String id; String userName; String phoneNumber; @@ -16,7 +16,7 @@ class PickUp { bool isCourier; int radioIndex; - PickUp( + Shipment( {this.id, this.userName, this.phoneNumber, @@ -34,8 +34,8 @@ class PickUp { int get last => DateTime.now().difference(date).inDays; - factory PickUp.fromMap(Map map, String id) { - return PickUp( + factory Shipment.fromMap(Map map, String id) { + return Shipment( id: id, userName: map['user_name'], phoneNumber: map['phone_number'], diff --git a/lib/pages/customer/invitation_create.dart b/lib/pages/customer/invitation_create.dart index 1e711a4..306e0b7 100644 --- a/lib/pages/customer/invitation_create.dart +++ b/lib/pages/customer/invitation_create.dart @@ -2,6 +2,7 @@ import 'package:country_code_picker/country_code_picker.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/customer/model/customer_model.dart'; import 'package:fcs/pages/main/util.dart'; +import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/material.dart'; @@ -32,6 +33,11 @@ class _InvitationCreateState extends State { @override Widget build(BuildContext context) { + final nameBox = InputText( + labelTextKey: 'customer.name', + iconData: Icons.person, + controller: _nameController); + return LocalProgress( inAsyncCall: _isLoading, child: Scaffold( @@ -57,8 +63,7 @@ class _InvitationCreateState extends State { padding: EdgeInsets.all(18), child: ListView( children: [ - fcsInput(getLocalString(context, "customer.name"), Icons.person, - controller: _nameController, autoFocus: false), + nameBox, SizedBox(height: 10), Row( children: [ diff --git a/lib/pages/fcs_shipment/fcs_shipment_editor.dart b/lib/pages/fcs_shipment/fcs_shipment_editor.dart index 791bb9c..b339bf4 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_editor.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_editor.dart @@ -1,4 +1,4 @@ -import 'package:fcs/domain/entities/shipment.dart'; +import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart'; @@ -15,7 +15,7 @@ import 'package:flutter/material.dart'; import '../main/util.dart'; class FcsShipmentEditor extends StatefulWidget { - final Shipment shipment; + final FcsShipment shipment; FcsShipmentEditor({this.shipment}); @override @@ -34,7 +34,7 @@ class _FcsShipmentEditorState extends State { TextEditingController _statusController = new TextEditingController(); TextEditingController _remarkController = new TextEditingController(); - Shipment _shipment = new Shipment(); + FcsShipment _shipment = new FcsShipment(); bool _isLoading = false; String _currentShipment; diff --git a/lib/pages/fcs_shipment/fcs_shipment_list_row.dart b/lib/pages/fcs_shipment/fcs_shipment_list_row.dart index 762d959..494108a 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_list_row.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_list_row.dart @@ -1,4 +1,4 @@ -import 'package:fcs/domain/entities/shipment.dart'; +import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; @@ -9,7 +9,7 @@ import 'package:intl/intl.dart'; import 'fcs_shipment_editor.dart'; class FcsShipmentListRow extends StatefulWidget { - final Shipment shipment; + final FcsShipment shipment; const FcsShipmentListRow({this.shipment}); @override @@ -19,7 +19,7 @@ class FcsShipmentListRow extends StatefulWidget { class _FcsShipmentListRowState extends State { var dateFormatter = new DateFormat('dd MMM yyyy'); final double dotSize = 15.0; - Shipment _shipment = new Shipment(); + FcsShipment _shipment = new FcsShipment(); @override void initState() { diff --git a/lib/pages/fcs_shipment/model/fcs_shipment_model.dart b/lib/pages/fcs_shipment/model/fcs_shipment_model.dart index 68db810..0115fbe 100644 --- a/lib/pages/fcs_shipment/model/fcs_shipment_model.dart +++ b/lib/pages/fcs_shipment/model/fcs_shipment_model.dart @@ -1,40 +1,41 @@ -import 'package:fcs/domain/entities/shipment.dart'; +import 'package:fcs/data/services/services.dart'; +import 'package:fcs/domain/entities/fcs_shipment.dart'; import 'package:fcs/pages/main/model/base_model.dart'; class FcsShipmentModel extends BaseModel { List shipmentType = ['Air', 'Ship', 'Cargo Truck']; - List shipments = [ - Shipment( + List shipments = [ + FcsShipment( shipDate: DateTime(2020, 4, 23), shipmentNumber: 'A103B', status: 'In Progress', arrivalDate: DateTime(2020, 4, 30), departureDate: DateTime(2020, 4, 23)), - Shipment( + FcsShipment( shipDate: DateTime(2020, 4, 2), shipmentNumber: 'A100A', status: 'Ready to ship', arrivalDate: DateTime(2020, 4, 28), departureDate: DateTime(2020, 4, 15)), - Shipment( + FcsShipment( shipDate: DateTime(2020, 4, 2), shipmentNumber: 'A100B', status: 'Arrived', arrivalDate: DateTime(2020, 4, 28), departureDate: DateTime(2020, 4, 15)), - Shipment( + FcsShipment( shipDate: DateTime(2020, 4, 10), shipmentNumber: 'A102B', status: 'Canceled', arrivalDate: DateTime(2020, 4, 20), departureDate: DateTime(2020, 4, 10)), - Shipment( + FcsShipment( shipDate: DateTime(2020, 4, 2), shipmentNumber: 'A100B', status: 'Canceled', arrivalDate: DateTime(2020, 4, 20), departureDate: DateTime(2020, 4, 23)), - Shipment( + FcsShipment( shipDate: DateTime(2020, 4, 10), shipmentNumber: 'A102B', status: 'Arrived', @@ -43,23 +44,24 @@ class FcsShipmentModel extends BaseModel { ) ]; - List get canceled { - List _p = shipments.where((e) => e.status == "Canceled").toList() - ..sort((e1, e2) { - return e1.shipDate.compareTo(e2.shipDate); - }); + List get canceled { + List _p = + shipments.where((e) => e.status == "Canceled").toList() + ..sort((e1, e2) { + return e1.shipDate.compareTo(e2.shipDate); + }); return _p; } - List get completed { + List get completed { return shipments.where((e) => e.status == "Arrived").toList() ..sort((e1, e2) { return e1.shipDate.compareTo(e2.shipDate); }); } - List get upcoming { - List _shipments = shipments + List get upcoming { + List _shipments = shipments .where((e) => e.status == "In Progress" || e.status == "Ready to ship" || diff --git a/lib/pages/main/home_page.dart b/lib/pages/main/home_page.dart index f916421..b89d13f 100644 --- a/lib/pages/main/home_page.dart +++ b/lib/pages/main/home_page.dart @@ -19,7 +19,7 @@ import 'package:fcs/pages/main/model/language_model.dart'; import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/package/package_list.dart'; import 'package:fcs/pages/rates/shipment_rates.dart'; -import 'package:fcs/pages/shipment/pickup_list.dart'; +import 'package:fcs/pages/shipment/shipment_list.dart'; import 'package:fcs/pages/staff/staff_list.dart'; import 'package:fcs/pages/widgets/task_button.dart'; import 'package:fcs/pages/widgets/badge.dart'; @@ -211,7 +211,7 @@ class _HomePageState extends State { final pickUpBtn = TaskButton("pickup", icon: SimpleLineIcons.direction, btnCallback: () => - Navigator.of(context).push(BottomUpPageRoute(PickUpList()))); + Navigator.of(context).push(BottomUpPageRoute(ShipmentList()))); final shipmentCostBtn = TaskButton("rate", icon: FontAwesomeIcons.calculator, diff --git a/lib/pages/main/util.dart b/lib/pages/main/util.dart index eed5b76..02b9c09 100644 --- a/lib/pages/main/util.dart +++ b/lib/pages/main/util.dart @@ -87,69 +87,6 @@ Future showConfirmDialog( }); } -void showCommentDialog(BuildContext context, commentCallback(comment)) { - TextEditingController _comment = new TextEditingController(); - showDialog( - context: context, - builder: (_) { - return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(32.0))), - content: Container( - width: 300.0, - height: 80.0, - child: Container( - child: TextFormField( - controller: _comment, - autofocus: false, - cursorColor: primaryColor, - maxLines: 3, - style: textStyle, - decoration: new InputDecoration( - labelText: "Comment", - labelStyle: labelStyle, - icon: Icon( - Icons.add_comment, - color: primaryColor, - ), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide(color: primaryColor, width: 1.0)), - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide(color: primaryColor, width: 1.0)), - ), - validator: (value) { - if (value.isEmpty) { - return "Please enter comment"; - } - return null; - }, - ), - ), - ), - actions: [ - FlatButton( - child: Text( - "Cancel", - style: labelStyle, - ), - onPressed: () { - _comment.clear(); - Navigator.of(context).pop(); - }), - FlatButton( - color: primaryColor, - child: Text("Submit", - style: TextStyle( - color: Colors.white, fontWeight: FontWeight.bold)), - onPressed: () { - commentCallback(_comment.text); - Navigator.of(context).pop(); - }) - ], - ); - }); -} - Widget getStatus(String status) { return status == "Delivered" ? Text(status, diff --git a/lib/pages/rates/shipment_rates.dart b/lib/pages/rates/shipment_rates.dart index 7f46af4..64659bd 100644 --- a/lib/pages/rates/shipment_rates.dart +++ b/lib/pages/rates/shipment_rates.dart @@ -5,6 +5,7 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/rates/model/shipment_rate_model.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -49,7 +50,12 @@ class _ShipmentRatesState extends State { onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, - title: Text(AppTranslations.of(context).text("rate.title")), + title: LocalText( + context, + "rate.title", + color: Colors.white, + fontSize: 18, + ), ), body: Padding( padding: const EdgeInsets.all(8.0), diff --git a/lib/pages/shipment/model/pickup_model.dart b/lib/pages/shipment/model/shipment_model.dart similarity index 92% rename from lib/pages/shipment/model/pickup_model.dart rename to lib/pages/shipment/model/shipment_model.dart index ac9cb1c..a49a453 100644 --- a/lib/pages/shipment/model/pickup_model.dart +++ b/lib/pages/shipment/model/shipment_model.dart @@ -7,20 +7,11 @@ import 'package:fcs/domain/vo/radio.dart'; import 'package:fcs/pages/main/model/base_model.dart'; import 'package:logging/logging.dart'; -class PickUpModel extends BaseModel { - final log = Logger('PickUpModel'); +class ShipmentModel extends BaseModel { + final log = Logger('ShipmentModel'); StreamSubscription listener; - // var profile = FCSProfile( - // id: '1', - // usaAddress: '154-19 64th Ave.\nFlushing, NY 11367', - // mmAddress: 'FCS Trading Myanmar\nRoom 333, Yangon', - // usaContactNumber: '1 (929) 215-2247', - // mmContactNumber: '+95 9 700224723', - // mail: 'admin@fcs.com', - // facebook: 'https://facebook.com/fcs'); - List radioGroups1 = [ RadioGroup( text: "FCS Pickup", @@ -62,9 +53,9 @@ class PickUpModel extends BaseModel { return radioGroups; } - List get pickups { - List pickups = [ - PickUp( + List get pickups { + List pickups = [ + Shipment( id: "S200412 - 12 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -83,7 +74,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200125 - 12 May 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -100,7 +91,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 13 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -118,7 +109,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200412 - 12 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -135,7 +126,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200125 - 12 May 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -152,7 +143,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 13 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -169,7 +160,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 10 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -186,7 +177,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 6 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -207,8 +198,8 @@ class PickUpModel extends BaseModel { return pickups; } - List pickups1 = [ - PickUp( + List pickups1 = [ + Shipment( id: "S200412 - 12 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -227,7 +218,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200125 - 12 May 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -244,7 +235,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 13 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -262,7 +253,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200412 - 12 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -279,7 +270,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200125 - 12 May 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -296,7 +287,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 13 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -313,7 +304,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 10 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -330,7 +321,7 @@ class PickUpModel extends BaseModel { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]), - PickUp( + Shipment( id: "S200441 - 6 Apr 2020", userName: "Ko Kyaw Nyi", phoneNumber: '+959111111111', @@ -349,22 +340,22 @@ class PickUpModel extends BaseModel { ]), ]; - List get canceled { - List _p = pickups.where((e) => e.status == "Canceled").toList() + List get canceled { + List _p = pickups.where((e) => e.status == "Canceled").toList() ..sort((e1, e2) { return e2.date.compareTo(e1.date); }); return _p; } - List get completed { + List get completed { return pickups.where((e) => e.status == "Pickuped").toList() ..sort((e1, e2) { return e2.date.compareTo(e1.date); }); } - List get upcoming { + List get upcoming { return pickups .where((e) => e.status == "Pending" || diff --git a/lib/pages/shipment/pickup_editor.dart b/lib/pages/shipment/shipment_editor.dart similarity index 98% rename from lib/pages/shipment/pickup_editor.dart rename to lib/pages/shipment/shipment_editor.dart index 6cb34c5..24201dd 100644 --- a/lib/pages/shipment/pickup_editor.dart +++ b/lib/pages/shipment/shipment_editor.dart @@ -6,7 +6,7 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/box/model/box_model.dart'; import 'package:fcs/pages/main/model/main_model.dart'; -import 'package:fcs/pages/shipment/model/pickup_model.dart'; +import 'package:fcs/pages/shipment/model/shipment_model.dart'; import 'package:fcs/pages/shipment_address/model/shipment_address_model.dart'; import 'package:fcs/pages/shipment_address/shipping_address_row.dart'; import 'package:fcs/pages/main/util.dart'; @@ -24,15 +24,15 @@ import 'package:flutter/material.dart'; import 'pickup_box_editor.dart'; -class PickUpEditor extends StatefulWidget { - final PickUp pickUp; - PickUpEditor({this.pickUp}); +class ShipmentEditor extends StatefulWidget { + final Shipment pickUp; + ShipmentEditor({this.pickUp}); @override - _PickUpEditorState createState() => _PickUpEditorState(); + _ShipmentEditorState createState() => _ShipmentEditorState(); } -class _PickUpEditorState extends State { +class _ShipmentEditorState extends State { var dateFormatter = new DateFormat('dd MMM yyyy'); final numberFormatter = new NumberFormat("#,###"); MultiImgController multiImgController = MultiImgController(); @@ -53,7 +53,7 @@ class _PickUpEditorState extends State { TextEditingController _pickupDate = new TextEditingController(); TextEditingController _handlingFeeController = new TextEditingController(); - PickUp _pickUp; + Shipment _pickUp; bool _isLoading = false; var now = new DateTime.now(); bool isNew; @@ -88,7 +88,7 @@ class _PickUpEditorState extends State { Cargo(type: 'Medicine', weight: 20), Cargo(type: 'Dangerous Cargo', weight: 30) ]; - _pickUp = PickUp(cargoTypes: _cargoTypes); + _pickUp = Shipment(cargoTypes: _cargoTypes); } var shipmentModel = Provider.of(context, listen: false); @@ -102,7 +102,7 @@ class _PickUpEditorState extends State { @override Widget build(BuildContext context) { - var pickupModel = Provider.of(context); + var pickupModel = Provider.of(context); final fromTimeBox = fcsInput( 'From', diff --git a/lib/pages/shipment/pickup_list.dart b/lib/pages/shipment/shipment_list.dart similarity index 82% rename from lib/pages/shipment/pickup_list.dart rename to lib/pages/shipment/shipment_list.dart index d426113..a1dfd3f 100644 --- a/lib/pages/shipment/pickup_list.dart +++ b/lib/pages/shipment/shipment_list.dart @@ -1,21 +1,21 @@ import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; -import 'package:fcs/pages/shipment/model/pickup_model.dart'; +import 'package:fcs/pages/shipment/model/shipment_model.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:provider/provider.dart'; import 'package:flutter/material.dart'; -import 'pickup_editor.dart'; -import 'pickup_list_row.dart'; +import 'shipment_editor.dart'; +import 'shipment_list_row.dart'; -class PickUpList extends StatefulWidget { +class ShipmentList extends StatefulWidget { @override - _PickUpListState createState() => _PickUpListState(); + _ShipmentListState createState() => _ShipmentListState(); } -class _PickUpListState extends State { +class _ShipmentListState extends State { bool _isLoading = false; @override @@ -30,7 +30,7 @@ class _PickUpListState extends State { @override Widget build(BuildContext context) { - var pickupModel = Provider.of(context); + var pickupModel = Provider.of(context); return LocalProgress( inAsyncCall: _isLoading, child: DefaultTabController( @@ -82,7 +82,7 @@ class _PickUpListState extends State { shrinkWrap: true, itemCount: pickupModel.pickups.length, itemBuilder: (BuildContext context, int index) { - return PickupListRow(pickUp: pickupModel.pickups[index]); + return ShipmentListRow(pickUp: pickupModel.pickups[index]); }), // body: TabBarView( // children: [ @@ -98,11 +98,11 @@ class _PickUpListState extends State { } _newPickup() { - Navigator.of(context).push(BottomUpPageRoute(PickUpEditor())); + Navigator.of(context).push(BottomUpPageRoute(ShipmentEditor())); } Widget _upComing() { - var pickupModel = Provider.of(context); + var pickupModel = Provider.of(context); return Column( children: [ Expanded( @@ -115,7 +115,7 @@ class _PickUpListState extends State { shrinkWrap: true, itemCount: pickupModel.upcoming.length, itemBuilder: (BuildContext context, int index) { - return PickupListRow(pickUp: pickupModel.upcoming[index]); + return ShipmentListRow(pickUp: pickupModel.upcoming[index]); }), ), ], @@ -123,7 +123,7 @@ class _PickUpListState extends State { } Widget _completed() { - var pickupModel = Provider.of(context); + var pickupModel = Provider.of(context); return Column( children: [ Expanded( @@ -136,7 +136,7 @@ class _PickUpListState extends State { shrinkWrap: true, itemCount: pickupModel.completed.length, itemBuilder: (BuildContext context, int index) { - return PickupListRow(pickUp: pickupModel.completed[index]); + return ShipmentListRow(pickUp: pickupModel.completed[index]); }), ), ], @@ -144,7 +144,7 @@ class _PickUpListState extends State { } Widget _canceled() { - var pickupModel = Provider.of(context); + var pickupModel = Provider.of(context); return Column( children: [ Expanded( @@ -157,7 +157,7 @@ class _PickUpListState extends State { shrinkWrap: true, itemCount: pickupModel.canceled.length, itemBuilder: (BuildContext context, int index) { - return PickupListRow(pickUp: pickupModel.canceled[index]); + return ShipmentListRow(pickUp: pickupModel.canceled[index]); }), ), ], diff --git a/lib/pages/shipment/pickup_list_row.dart b/lib/pages/shipment/shipment_list_row.dart similarity index 90% rename from lib/pages/shipment/pickup_list_row.dart rename to lib/pages/shipment/shipment_list_row.dart index 14b9f7d..d8c08f0 100644 --- a/lib/pages/shipment/pickup_list_row.dart +++ b/lib/pages/shipment/shipment_list_row.dart @@ -5,19 +5,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import '../main/util.dart'; -import 'pickup_editor.dart'; +import 'shipment_editor.dart'; -class PickupListRow extends StatefulWidget { - final PickUp pickUp; - const PickupListRow({this.pickUp}); +class ShipmentListRow extends StatefulWidget { + final Shipment pickUp; + const ShipmentListRow({this.pickUp}); @override - _PickupListRowState createState() => _PickupListRowState(); + _ShipmentListRowState createState() => _ShipmentListRowState(); } -class _PickupListRowState extends State { +class _ShipmentListRowState extends State { final double dotSize = 15.0; - PickUp _pickUp = new PickUp(); + Shipment _pickUp = new Shipment(); @override void initState() { @@ -41,7 +41,7 @@ class _PickupListRowState extends State { child: InkWell( onTap: () { Navigator.of(context) - .push(BottomUpPageRoute(PickUpEditor(pickUp: _pickUp))); + .push(BottomUpPageRoute(ShipmentEditor(pickUp: _pickUp))); }, child: Row( children: [