diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index b6bf53a..bf1d8ed 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -384,11 +384,15 @@ "invoice.box.cargo_type": "Cargo types", "invoice.cargo_type":"Cargo types", "invoice.box.number":"Carton number", - "invoice.box.length":"Length", - "invoice.box.width":"Width", - "invoice.boc.height":"Height", + "invoice.box.length":"L", + "invoice.box.width":"W", + "invoice.boc.height":"H", "invoice.discount_value": "Discount", "invoice.net_amount":"Net Amount", + "invoice.customer_info":"Customer information", + "invoice.pdf": "Invoice PDF", + "invoice.total_custom_fee":"Total custom fee", + "invoice.shipment_weight":"Shipment weight", "Invoices End ================================================================":"", "Discount Start ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 36f5bf5..3dda664 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -384,11 +384,15 @@ "invoice.description": "ငွေတောင်းခံလွှာအကြောင်းအရာ", "invoice.cargo_type":"Cargo Types", "invoice.box.number":"Box နံပါတ်", - "invoice.box.length":"အလျား", - "invoice.box.width":"အနံ", - "invoice.box.height":"အမြင့်", + "invoice.box.length":"L", + "invoice.box.width":"W", + "invoice.box.height":"H", "invoice.discount_value": "လျှော့စျေး", "invoice.net_amount":"Net Amount", + "invoice.customer_info":"Customer information", + "invoice.pdf": "Invoice PDF", + "invoice.total_custom_fee":"အခွန်စုစုပေါင်း", + "invoice.shipment_weight":"Shipment weight", "Invoices End ================================================================":"", "Discount Start ================================================================":"", diff --git a/lib/pages/box/box_editor.dart b/lib/pages/box/box_editor.dart index b283184..022b40c 100644 --- a/lib/pages/box/box_editor.dart +++ b/lib/pages/box/box_editor.dart @@ -402,10 +402,10 @@ class _BoxEditorState extends State { return InkWell( onTap: () async { Cargo cargo = await Navigator.push( - context, - BottomUpPageRoute(CargoTypeEditor( - cargo: c.value, - ))); + context, + CupertinoPageRoute( + builder: (context) => CargoTypeEditor(cargo: c.value)), + ); _addCargo(cargo); }, child: Container( @@ -631,7 +631,11 @@ class _BoxEditorState extends State { ), onPressed: () async { Cargo cargo = await Navigator.push( - context, BottomUpPageRoute(CargoTypeEditor())); + context, + CupertinoPageRoute( + builder: (context) => CargoTypeEditor()), + ); + _addCargo(cargo); }), ), @@ -652,9 +656,10 @@ class _BoxEditorState extends State { onTap: () async { DeliveryAddress d = await Navigator.push( context, - BottomUpPageRoute(DeliveryAddressSelection( - deliveryAddress: _deliveryAddress, - )), + CupertinoPageRoute( + builder: (context) => DeliveryAddressSelection( + deliveryAddress: _deliveryAddress, + )), ); if (d == null) return; setState(() { diff --git a/lib/pages/box/box_info.dart b/lib/pages/box/box_info.dart index 63607d7..c5442f5 100644 --- a/lib/pages/box/box_info.dart +++ b/lib/pages/box/box_info.dart @@ -545,7 +545,7 @@ class _BoxInfoState extends State { _gotoEditor() async { Navigator.push( context, - BottomUpPageRoute(BoxEditor(box: widget.box)), + CupertinoPageRoute(builder: (context) => BoxEditor(box: widget.box)), ); } } diff --git a/lib/pages/box/box_list.dart b/lib/pages/box/box_list.dart index 2672313..c035366 100644 --- a/lib/pages/box/box_list.dart +++ b/lib/pages/box/box_list.dart @@ -86,7 +86,7 @@ class _BoxListState extends State { _newPickup() { Navigator.push( context, - BottomUpPageRoute(BoxEditor()), + CupertinoPageRoute(builder: (context) => BoxEditor()), ); } diff --git a/lib/pages/box/box_list_row.dart b/lib/pages/box/box_list_row.dart index 6e08f8d..a4ba0c3 100644 --- a/lib/pages/box/box_list_row.dart +++ b/lib/pages/box/box_list_row.dart @@ -1,10 +1,8 @@ import 'package:fcs/domain/entities/box.dart'; import 'package:fcs/pages/main/util.dart'; -import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; - -import 'box_editor.dart'; import 'box_info.dart'; class BoxListRow extends StatefulWidget { @@ -35,7 +33,7 @@ class _BoxListRowState extends State { onTap: () { Navigator.push( context, - BottomUpPageRoute(BoxInfo(box: _box)), + CupertinoPageRoute(builder: (context) => BoxInfo(box: _box)), ); }, child: Row( diff --git a/lib/pages/box/cargo_type_editor.dart b/lib/pages/box/cargo_type_editor.dart index fe82800..2cba854 100644 --- a/lib/pages/box/cargo_type_editor.dart +++ b/lib/pages/box/cargo_type_editor.dart @@ -6,6 +6,7 @@ import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_dropdown.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; @@ -81,7 +82,8 @@ class _CargoTypeEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: + new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, diff --git a/lib/pages/buying_instruction/buying_online.dart b/lib/pages/buying_instruction/buying_online.dart index b029846..fbbbc00 100644 --- a/lib/pages/buying_instruction/buying_online.dart +++ b/lib/pages/buying_instruction/buying_online.dart @@ -4,6 +4,7 @@ import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/local_text.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -67,7 +68,7 @@ class _BuyingOnlinePagetate extends State centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, ), onPressed: () => Navigator.of(context).pop(), diff --git a/lib/pages/chat/message_detail.dart b/lib/pages/chat/message_detail.dart index 14f884b..0cd5221 100644 --- a/lib/pages/chat/message_detail.dart +++ b/lib/pages/chat/message_detail.dart @@ -176,7 +176,8 @@ class MessageDetail extends StatelessWidget { Provider.of(context, listen: false); Package p = await packageModel.getPackage(message.messageID); if (p == null) return; - Navigator.push(context, BottomUpPageRoute(PackageInfo(package: p))); + Navigator.push(context, + CupertinoPageRoute(builder: (context) => PackageInfo(package: p))); } if (message.messageType == message_type_profile && message.messageID != null && @@ -184,13 +185,14 @@ class MessageDetail extends StatelessWidget { MainModel mainModel = Provider.of(context, listen: false); if (mainModel.user.isCustomer()) { - Navigator.push(context, BottomUpPageRoute(Profile())); + Navigator.push( + context, CupertinoPageRoute(builder: (context) => Profile())); } else { CustomerModel customerModel = Provider.of(context, listen: false); User user = await customerModel.getUser(message.messageID); - Navigator.of(context) - .push(BottomUpPageRoute(CustomerEditor(customer: user))); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => CustomerEditor(customer: user))); } } } diff --git a/lib/pages/contact/contact_page.dart b/lib/pages/contact/contact_page.dart index 9ae62cf..e63e971 100644 --- a/lib/pages/contact/contact_page.dart +++ b/lib/pages/contact/contact_page.dart @@ -30,7 +30,7 @@ class _ContactPageState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, ), onPressed: () => Navigator.of(context).pop(), diff --git a/lib/pages/customer/customer_editor.dart b/lib/pages/customer/customer_editor.dart index 4a64df0..141866c 100644 --- a/lib/pages/customer/customer_editor.dart +++ b/lib/pages/customer/customer_editor.dart @@ -5,6 +5,7 @@ import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -51,7 +52,7 @@ class _CustomerEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, size: 30, ), diff --git a/lib/pages/customer/customer_list.dart b/lib/pages/customer/customer_list.dart index d1321cd..d3dcefa 100644 --- a/lib/pages/customer/customer_list.dart +++ b/lib/pages/customer/customer_list.dart @@ -59,7 +59,7 @@ class _CustomerListState extends State { ), floatingActionButton: FloatingActionButton.extended( onPressed: () { - Navigator.of(context).push(BottomUpPageRoute(InvitationCreate())); + Navigator.of(context).push(CupertinoPageRoute(builder: (context) => InvitationCreate())); }, icon: Icon(Icons.add), label: LocalText(context, "invitation.new", color: Colors.white), @@ -204,7 +204,7 @@ class _CustomerListState extends State { _select(User customer) { Navigator.of(context) - .push(BottomUpPageRoute(CustomerEditor(customer: customer))); + .push(CupertinoPageRoute(builder: (context) => CustomerEditor(customer: customer))); } _gotoMsg(User customer) { @@ -212,7 +212,7 @@ class _CustomerListState extends State { Provider.of(context, listen: false); messageModel.initQuery(customer.id); Navigator.of(context) - .push(BottomUpPageRoute(MessageDetail( + .push(CupertinoPageRoute(builder: (context) => MessageDetail( receiverID: customer.id, receiverName: customer.name, messageModel: messageModel, diff --git a/lib/pages/customer/invitation_create.dart b/lib/pages/customer/invitation_create.dart index ea85bc8..1d3c1fc 100644 --- a/lib/pages/customer/invitation_create.dart +++ b/lib/pages/customer/invitation_create.dart @@ -5,6 +5,7 @@ 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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -47,7 +48,7 @@ class _InvitationCreateState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, ), onPressed: () => Navigator.of(context).pop(), diff --git a/lib/pages/customer/invitation_editor.dart b/lib/pages/customer/invitation_editor.dart index 6c333c2..837f704 100644 --- a/lib/pages/customer/invitation_editor.dart +++ b/lib/pages/customer/invitation_editor.dart @@ -4,6 +4,7 @@ import 'package:fcs/pages/customer/model/customer_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -49,7 +50,7 @@ class _InvitationEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, size: 30, ), diff --git a/lib/pages/delivery/delivery_list_row.dart b/lib/pages/delivery/delivery_list_row.dart index ac18963..0941bbf 100644 --- a/lib/pages/delivery/delivery_list_row.dart +++ b/lib/pages/delivery/delivery_list_row.dart @@ -2,6 +2,7 @@ import 'package:fcs/domain/entities/box.dart'; import 'package:fcs/pages/box/box_editor.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -34,12 +35,12 @@ class _DeliveryListRowState extends State { if (widget.isReadOnly) { // Navigator.push( // context, - // BottomUpPageRoute(PackageInfo(package: _box)), + // CupertinoPageRoute(builder: (context) => PackageInfo(package: _box)), // ); } else { Navigator.push( context, - BottomUpPageRoute(BoxEditor(box: _box)), + CupertinoPageRoute(builder: (context) => BoxEditor(box: _box)), ); } }, diff --git a/lib/pages/delivery_address/delivery_address_editor.dart b/lib/pages/delivery_address/delivery_address_editor.dart index 7c29891..234671b 100644 --- a/lib/pages/delivery_address/delivery_address_editor.dart +++ b/lib/pages/delivery_address/delivery_address_editor.dart @@ -5,6 +5,7 @@ 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/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -104,7 +105,7 @@ class _DeliveryAddressEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/delivery_address/delivery_address_list.dart b/lib/pages/delivery_address/delivery_address_list.dart index ba569df..7684067 100644 --- a/lib/pages/delivery_address/delivery_address_list.dart +++ b/lib/pages/delivery_address/delivery_address_list.dart @@ -5,6 +5,7 @@ import 'package:fcs/pages/main/util.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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -40,7 +41,7 @@ class _DeliveryAddressListState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.pop(context), ), backgroundColor: primaryColor, @@ -53,8 +54,8 @@ class _DeliveryAddressListState extends State { ), floatingActionButton: FloatingActionButton.extended( onPressed: () { - Navigator.of(context) - .push(BottomUpPageRoute(DeliveryAddressEditor())); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => DeliveryAddressEditor())); }, icon: Icon(Icons.add), label: LocalText(context, "delivery_address.new_address", @@ -100,8 +101,9 @@ class _DeliveryAddressListState extends State { _edit(BuildContext context, DeliveryAddress deliveryAddress) { Navigator.push( context, - BottomUpPageRoute( - DeliveryAddressEditor(deliveryAddress: deliveryAddress)), + CupertinoPageRoute( + builder: (context) => + DeliveryAddressEditor(deliveryAddress: deliveryAddress)), ); } diff --git a/lib/pages/discount/discount_editor.dart b/lib/pages/discount/discount_editor.dart index 454e823..65a0967 100644 --- a/lib/pages/discount/discount_editor.dart +++ b/lib/pages/discount/discount_editor.dart @@ -5,6 +5,7 @@ import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -72,7 +73,7 @@ class _DiscountEditorState extends State { AppTranslations.of(context).text("discount.form"), ), leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/discount/discount_list.dart b/lib/pages/discount/discount_list.dart index e9e636a..aa42881 100644 --- a/lib/pages/discount/discount_list.dart +++ b/lib/pages/discount/discount_list.dart @@ -11,6 +11,9 @@ import 'package:provider/provider.dart'; import 'discount_editor.dart'; class DiscountList extends StatefulWidget { + final bool selected; + + const DiscountList({Key key, this.selected}) : super(key: key); @override _DiscountListState createState() => _DiscountListState(); } @@ -50,12 +53,15 @@ class _DiscountListState extends State { var discount = discountModel.discounts[index]; return InkWell( onTap: () { - Navigator.push( - context, - BottomUpPageRoute(DiscountEditor( - discount: discount, - )), - ); + widget.selected + ? Navigator.pop(context, discount) + : Navigator.push( + context, + CupertinoPageRoute( + builder: (context) => DiscountEditor( + discount: discount, + )), + ); }, child: Padding( padding: const EdgeInsets.all(10.0), @@ -119,7 +125,7 @@ class _DiscountListState extends State { onPressed: () { Navigator.push( context, - BottomUpPageRoute(DiscountEditor()), + CupertinoPageRoute(builder: (context) => DiscountEditor()), ); }, icon: Icon(Icons.add), diff --git a/lib/pages/faq/faq_list_page.dart b/lib/pages/faq/faq_list_page.dart index d546784..a515677 100644 --- a/lib/pages/faq/faq_list_page.dart +++ b/lib/pages/faq/faq_list_page.dart @@ -46,7 +46,8 @@ class _FAQListPageState extends State floatingActionButton: isEditable ? FloatingActionButton.extended( onPressed: () { - Navigator.of(context).push(BottomUpPageRoute(FAQEditor())); + Navigator.of(context).push( + CupertinoPageRoute(builder: (context) => FAQEditor())); }, icon: Icon(Icons.add), label: LocalText(context, "faq.add.title", color: Colors.white), @@ -171,9 +172,11 @@ class _FAQListPageState extends State _selectLinkPage(String linkPage) { if (linkPage == page_payment_methods) { - Navigator.of(context).push(BottomUpPageRoute(PaymentMethodPage())); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => PaymentMethodPage())); } else if (linkPage == page_buying_instructions) { - Navigator.of(context).push(BottomUpPageRoute(BuyingOnlinePage())); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => BuyingOnlinePage())); } } } diff --git a/lib/pages/fcs_shipment/fcs_shipment_editor.dart b/lib/pages/fcs_shipment/fcs_shipment_editor.dart index c221035..4d700bf 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_editor.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_editor.dart @@ -11,6 +11,7 @@ import 'package:fcs/pages/widgets/local_button.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/popupmenu.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -89,7 +90,7 @@ class _FcsShipmentEditorState extends State { centerTitle: true, shadowColor: Colors.transparent, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor), + icon: new Icon(CupertinoIcons.back, color: primaryColor), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: Colors.white, diff --git a/lib/pages/fcs_shipment/fcs_shipment_list.dart b/lib/pages/fcs_shipment/fcs_shipment_list.dart index 28396aa..8303721 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_list.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_list.dart @@ -77,6 +77,7 @@ class _FcsShipmentListState extends State { } _newShipment() { - Navigator.of(context).push(BottomUpPageRoute(FcsShipmentEditor())); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => FcsShipmentEditor())); } } diff --git a/lib/pages/fcs_shipment/fcs_shipment_list_row.dart b/lib/pages/fcs_shipment/fcs_shipment_list_row.dart index 5c5c14e..9d0495e 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_list_row.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_list_row.dart @@ -2,6 +2,7 @@ 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'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:intl/intl.dart'; @@ -19,8 +20,8 @@ class FcsShipmentListRow extends StatelessWidget { padding: EdgeInsets.only(left: 15, right: 15), child: InkWell( onTap: () { - Navigator.of(context) - .push(BottomUpPageRoute(FcsShipmentEditor(shipment: shipment))); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => FcsShipmentEditor(shipment: shipment))); }, child: Row( children: [ diff --git a/lib/pages/invoice/box_addition.dart b/lib/pages/invoice/box_addition.dart index f577288..4a8aef5 100644 --- a/lib/pages/invoice/box_addition.dart +++ b/lib/pages/invoice/box_addition.dart @@ -3,6 +3,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/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -40,7 +41,7 @@ class _BoxAdditionState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/invoice/invoce_list.dart b/lib/pages/invoice/invoce_list.dart index 4ae1884..620bd22 100644 --- a/lib/pages/invoice/invoce_list.dart +++ b/lib/pages/invoice/invoce_list.dart @@ -2,8 +2,10 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; +import 'package:fcs/pages/invoice/invoice_shipment_list.dart'; import 'package:fcs/pages/invoice/model/invoice_model.dart'; import 'package:fcs/pages/package_search/package_serach.dart'; +import 'package:fcs/pages/shipment/shipment_list.dart'; import 'package:fcs/pages/user_search/user_serach.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/local_text.dart'; @@ -92,48 +94,7 @@ class _InvoiceListState extends State { } _newInvoice() { - Navigator.of(context).push(BottomUpPageRoute(InvoiceEditor())); - } - - Widget _pending() { - var invoiceModel = 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: invoiceModel.pending.length, - itemBuilder: (BuildContext context, int index) { - return InvoiceListRow(invoice: invoiceModel.pending[index]); - }), - ), - ], - ); - } - - Widget _paided() { - var invoiceModel = 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: invoiceModel.paided.length, - itemBuilder: (BuildContext context, int index) { - return InvoiceListRow(invoice: invoiceModel.paided[index]); - }), - ), - ], - ); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => InvoiceShipmentList())); } } diff --git a/lib/pages/invoice/invoice_customer_list.dart b/lib/pages/invoice/invoice_customer_list.dart new file mode 100644 index 0000000..5a92f12 --- /dev/null +++ b/lib/pages/invoice/invoice_customer_list.dart @@ -0,0 +1,148 @@ +import 'package:fcs/domain/entities/user.dart'; +import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/customer/customer_editor.dart'; +import 'package:fcs/pages/customer/model/customer_model.dart'; +import 'package:fcs/pages/invoice/invoice_editor.dart'; +import 'package:fcs/pages/widgets/local_text.dart'; +import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; + +class InvoiceCustomerList extends StatefulWidget { + @override + _InvoiceCustomerListState createState() => _InvoiceCustomerListState(); +} + +class _InvoiceCustomerListState extends State { + var dateFormatter = new DateFormat('dd MMM yyyy - hh:mm:ss a'); + final double dotSize = 15.0; + bool _isLoading = false; + + @override + Widget build(BuildContext context) { + var customerModel = Provider.of(context); + + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(CupertinoIcons.back), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: primaryColor, + title: LocalText( + context, + "customer.list.title", + fontSize: 20, + color: Colors.white, + ), + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: ListView.separated( + separatorBuilder: (context, index) => Divider( + color: Colors.grey, + ), + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemCount: customerModel.customers.length, + itemBuilder: (BuildContext context, int index) { + User customer = customerModel.customers[index]; + return _item(customer); + }), + ), + ], + ), + ), + ); + } + + Widget _item(User customer) { + return InkWell( + onTap: () { + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => InvoiceEditor(customer: customer))); + }, + child: Padding( + padding: const EdgeInsets.only(left: 12.0, right: 12), + child: Row( + children: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0), + child: new Row( + children: [ + InkWell( + onTap: () => _select(customer), + child: Padding( + padding: const EdgeInsets.all(5.0), + child: Container( + padding: const EdgeInsets.only( + left: 10.0, right: 10, top: 6, bottom: 6), + decoration: BoxDecoration( + color: primaryColor, + borderRadius: + BorderRadius.all(Radius.circular(35.0))), + child: Text( + customer.initial, + style: TextStyle(fontSize: 30, color: Colors.white), + ), + ), + ), + ), + new Expanded( + child: Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 2.0), + child: new Text( + customer.name, + style: new TextStyle( + fontSize: 20.0, color: primaryColor), + ), + ), + Padding( + padding: const EdgeInsets.only(top: 2.0), + child: new Text( + customer.getLastMessage, + style: new TextStyle( + fontSize: 15.0, color: Colors.grey), + ), + ), + ], + ), + ), + ), + ], + ), + ), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Padding( + padding: const EdgeInsets.only(right: 5), + child: Text(customer.getLastMessageTime), + ), + ], + ), + ], + ), + ), + ); + } + + _select(User customer) { + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => CustomerEditor(customer: customer))); + } +} diff --git a/lib/pages/invoice/invoice_editor.dart b/lib/pages/invoice/invoice_editor.dart index 51af84d..eea50b8 100644 --- a/lib/pages/invoice/invoice_editor.dart +++ b/lib/pages/invoice/invoice_editor.dart @@ -1,20 +1,24 @@ import 'package:fcs/domain/entities/box.dart'; import 'package:fcs/domain/entities/cargo.dart'; +import 'package:fcs/domain/entities/custom.dart'; import 'package:fcs/domain/entities/discount.dart'; import 'package:fcs/domain/entities/invoice.dart'; import 'package:fcs/domain/entities/payment_method.dart'; import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.dart'; +import 'package:fcs/pages/discount/discount_list.dart'; import 'package:fcs/pages/discount/model/discount_model.dart'; import 'package:fcs/pages/main/model/language_model.dart'; import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/payment_methods/model/payment_method_model.dart'; +import 'package:fcs/pages/rates/custom_list.dart'; import 'package:fcs/pages/user_search/user_serach.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/discount_dropdown.dart'; import 'package:fcs/pages/widgets/display_text.dart'; +import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/local_dropdown.dart'; import 'package:fcs/pages/widgets/local_text.dart'; @@ -23,6 +27,7 @@ import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/my_data_table.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -33,7 +38,8 @@ import 'box_addition.dart'; class InvoiceEditor extends StatefulWidget { final Invoice invoice; - InvoiceEditor({this.invoice}); + final User customer; + InvoiceEditor({this.invoice, this.customer}); @override _InvoiceEditorState createState() => _InvoiceEditorState(); @@ -62,14 +68,17 @@ class _InvoiceEditorState extends State { bool isSwitched = false; int deliveryfee = 0; int customFee = 10; + int handlingFee = 0; double total = 0; Discount _discount; bool isNew = false; Discount selectedDiscount; int selectedDiscountAmt; PaymentMethod paymentMethod; + double volumetricRatio = 0; List selectedBoxes = []; + List customs = []; List _cargoTypes = [ Cargo(type: 'General Cargo', weight: 33, price: 6), @@ -84,6 +93,10 @@ class _InvoiceEditorState extends State { @override void initState() { super.initState(); + + volumetricRatio = + Provider.of(context, listen: false).setting.volumetricRatio; + if (widget.invoice != null) { _invoice = widget.invoice; _invoiceNumberController.text = _invoice.invoiceNumber; @@ -107,6 +120,10 @@ class _InvoiceEditorState extends State { _customFeeController.text = '0'; _descriptionController.text = ''; _balanceController.text = '0'; + } + + if (widget.customer != null) { + user = widget.customer; setState(() { isNew = true; }); @@ -171,17 +188,33 @@ class _InvoiceEditorState extends State { var discountModel = Provider.of(context); var paymentMethodModel = Provider.of(context); - final discountBox = Container( - child: DiscountDropdown( - callback: (v) { - setState(() { - selectedDiscount = v; - }); - }, - iconData: Entypo.price_ribbon, - selectedValue: selectedDiscount, - values: discountModel.discounts, - )); + final nameBox = DisplayText( + iconData: Feather.user, + labelTextKey: 'invoice.customer_name', + text: user != null ? user.name : ''); + + final statusBox = DisplayText( + text: _statusController.text, + iconData: Icons.av_timer, + labelTextKey: 'invoice.status'); + + final fcsIDBox = Row( + children: [ + Expanded( + child: DisplayText( + text: user != null ? user.fcsID : "", + labelTextKey: "box.fcs.id", + icon: FcsIDIcon(), + )), + IconButton( + icon: Icon(Icons.search, color: primaryColor), + onPressed: () => searchUser(context, callbackUserSelect: (u) { + setState(() { + this.user = u; + }); + })), + ], + ); return LocalProgress( inAsyncCall: _isLoading, @@ -189,7 +222,7 @@ class _InvoiceEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor), + icon: new Icon(CupertinoIcons.back, color: primaryColor), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: Colors.white, @@ -201,7 +234,7 @@ class _InvoiceEditorState extends State { padding: const EdgeInsets.all(8.0), child: ListView( children: [ - LocalTitle(textKey: "package.create.name"), + LocalTitle(textKey: "invoice.customer_info"), DisplayText( labelTextKey: 'invoice.date', iconData: Icons.date_range, @@ -212,73 +245,27 @@ class _InvoiceEditorState extends State { labelTextKey: 'invoice.number', iconData: FontAwesomeIcons.fileInvoice, text: _invoiceNumberController.text), - widget.invoice == null - ? Row( - children: [ - Expanded( - child: DisplayText( - text: user != null ? user.name : "", - labelTextKey: "invoice.customer_name", - iconData: Feather.user, - )), - IconButton( - icon: Icon(Icons.search, color: primaryColor), - onPressed: () => - searchUser(context, callbackUserSelect: (u) { - setState(() { - this.user = u; - }); - })), - ], - ) - : DisplayText( - text: _nameController.text, - iconData: Feather.user, - labelTextKey: 'invoice.customer_name'), - InputText( - controller: _handlingFeeController, - iconData: FontAwesomeIcons.moneyBill, - labelTextKey: 'invoice.handling_fee'), - SizedBox(height: 15), - discountBox, - widget.invoice == null - ? Container() - : DisplayText( - text: _statusController.text, - iconData: Icons.av_timer, - labelTextKey: 'invoice.status'), - SizedBox(height: 30), + fcsIDBox, + nameBox, + isNew ? statusBox : Container(), + SizedBox(height: 20), LocalTitle(textKey: "invoice.box_info"), - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: MyDataTable( - headingRowHeight: 40, - // columnSpacing: 20, - columns: [ - MyDataColumn( - label: Text(''), - ), - MyDataColumn( - label: LocalText( - context, - "invoice.box.number", - color: Colors.grey, - ), - ), - MyDataColumn( - label: Text( - getLocalString(context, "invoice.box.length") + - ' x ' + - getLocalString(context, "invoice.box.width") + - ' x ' + - getLocalString(context, "invoice.box.height"), - ), - ), - ], - rows: getBoxRow(context), - ), - ), - SizedBox(height: 40), + Center(child: Column(children: getCartonRows(context))), + SizedBox(height: 20), + LocalTitle( + textKey: "invoice.custom_fee", + trailing: IconButton( + icon: Icon(Icons.add_circle, color: primaryColor), + onPressed: () async { + Custom custom = await Navigator.of(context).push( + CupertinoPageRoute( + builder: (context) => CustomList())); + setState(() { + if (custom != null) customs.add(custom); + }); + })), + Column(children: getCustomFeeRows(context)), + SizedBox(height: 20), LocalTitle(textKey: "invoice.cargo_type"), Column(children: getCargoTableByBox(context)), SizedBox(height: 20), @@ -295,7 +282,10 @@ class _InvoiceEditorState extends State { Container( width: 150.0, child: DropdownButtonFormField( - icon: Icon(Icons.edit), + icon: Icon( + Icons.edit, + color: primaryColor, + ), value: paymentMethod, items: paymentMethodModel.paymentMethods .map((e) => DropdownMenuItem( @@ -307,31 +297,12 @@ class _InvoiceEditorState extends State { ], ), ), - SizedBox(height: 30), - !isNew - ? Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Row( - children: [ - Icon(Icons.receipt, color: primaryColor), - SizedBox(width: 10), - LocalText( - context, - "invoice.payment_attachment", - color: Colors.grey, - fontSize: 20, - fontWeight: FontWeight.w700, - ), - ], - ), - ), - Spacer(), - Icon(Icons.add, color: primaryColor), - ], - ) - : Container(), + SizedBox(height: 20), + LocalTitle( + textKey: "invoice.payment_attachment", + trailing: IconButton( + icon: Icon(Icons.add_circle, color: primaryColor), + onPressed: () async {})), widget.invoice == null ? fcsButton( context, getLocalString(context, 'invoice.btn_create')) @@ -355,6 +326,168 @@ class _InvoiceEditorState extends State { ); } + getCartonRows(BuildContext context) { + List dataRow = []; + + dataRow = _boxes.map((box) { + return Container( + height: 50, + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: + const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0), + child: Row( + children: [ + Container( + width: 33, + child: Checkbox( + value: true, onChanged: (v) {}, activeColor: primaryColor), + ), + Expanded(flex: 1, child: Text(box.packageNumber)), + Expanded( + flex: 1, + child: Text( + box.length == null + ? "" + : box.length.toString() + + ' x ' + + box.length.toString() + + ' x ' + + box.height.toString(), + textAlign: TextAlign.center)), + Expanded( + flex: 2, + child: Center( + child: Text( + box.getShipmentWeight(volumetricRatio).toString()))), + ], + ), + ); + }).toList(); + + dataRow.insert( + 0, + Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 5.0, bottom: 15.0), + child: Row( + children: [ + Container(width: 33), + Expanded( + flex: 1, + child: Center( + child: LocalText( + context, + "invoice.box.number", + color: Colors.grey, + ), + )), + Expanded( + flex: 1, + child: Center( + child: Text('L x W x H', + style: TextStyle(color: Colors.grey)))), + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + "invoice.shipment_weight", + color: Colors.grey, + ), + )), + ], + ), + )); + + return dataRow; + } + + getCustomFeeRows(BuildContext context) { + customFee = 0; + List dataRow = []; + + dataRow = customs.map((custom) { + customFee += custom.fee; + return Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: + const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0), + child: Row( + children: [ + Expanded(flex: 2, child: Text('${custom.productType}')), + Expanded( + flex: 1, + child: Text('\$ ${custom.fee}', textAlign: TextAlign.center)), + Expanded( + child: IconButton( + icon: Icon(Icons.remove_circle, color: primaryColor), + onPressed: () { + customs.remove(custom); + })) + ], + ), + ); + }).toList(); + + dataRow.insert( + 0, + Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 15.0, bottom: 15.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Text('Product', style: TextStyle(color: Colors.grey))), + Expanded( + flex: 1, + child: Text('Fee', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey))), + Expanded(flex: 1, child: Container()) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 15.0, bottom: 15.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.total_custom_fee', + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + Expanded( + flex: 1, + child: Center( + child: Text('\$ $customFee', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.bold)))), + Expanded( + child: Container(), + ) + ], + ), + )); + return dataRow; + } + getCargoTableByBox(BuildContext context) { var discountModel = Provider.of(context); total = 0; @@ -430,8 +563,9 @@ class _InvoiceEditorState extends State { child: Row( children: [ Expanded( - flex: 2, - child: Center( + flex: 1, + child: Container( + alignment: Alignment.centerRight, child: LocalText( context, 'invoice.total', @@ -439,6 +573,7 @@ class _InvoiceEditorState extends State { ), ), ), + SizedBox(width: 40), Expanded( child: Text( '\$ $total', @@ -452,12 +587,13 @@ class _InvoiceEditorState extends State { dataRow.insert( dataRow.length, Container( - padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 10), + padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 0), child: Row( children: [ Expanded( - flex: 2, - child: Center( + flex: 1, + child: Container( + alignment: Alignment.centerRight, child: LocalText( context, 'invoice.discount_value', @@ -465,9 +601,20 @@ class _InvoiceEditorState extends State { ), ), ), + new IconButton( + icon: Icon(Icons.search, color: primaryColor), + onPressed: () async { + Discount discount = await Navigator.of(context).push( + CupertinoPageRoute( + builder: (context) => + DiscountList(selected: true))); + setState(() { + if (discount != null) _discount = discount; + }); + }), Expanded( child: Text( - '\$ ${_discount != null ? _discount.amount.toInt() : 0}', + '\$ ( ${_discount != null ? _discount.amount.toInt() : 0} )', textAlign: TextAlign.end, style: TextStyle( fontSize: 15, @@ -481,18 +628,21 @@ class _InvoiceEditorState extends State { dataRow.length, Container( padding: const EdgeInsets.only( - left: 5.0, right: 5.0, top: 20.0, bottom: 0.0), + left: 5.0, right: 5.0, top: 10.0, bottom: 0.0), child: Row( children: [ Expanded( - flex: 2, - child: Center( - child: LocalText( - context, - 'invoice.custom_fee', - color: Colors.black, - ), - )), + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: LocalText( + context, + 'invoice.custom_fee', + color: Colors.black, + ), + ), + ), + SizedBox(width: 40), Expanded( child: Text('\$ ${customFee}', textAlign: TextAlign.end, @@ -505,6 +655,37 @@ class _InvoiceEditorState extends State { ), )); + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only(left: 5.0, right: 5.0, top: 20.0), + child: Row( + children: [ + Expanded( + flex: 1, + child: Container( + alignment: Alignment.centerRight, + child: LocalText( + context, + 'invoice.handling_fee', + color: Colors.black, + ), + ), + ), + new IconButton( + icon: Icon(Icons.edit, color: primaryColor), + onPressed: () async {}), + Expanded( + child: Text('\$ $handlingFee', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + ))) + ], + ), + )); + dataRow.insert( dataRow.length, Container( @@ -629,8 +810,9 @@ class _InvoiceEditorState extends State { getTotalBalance(total) { double balance = 0; double custom = customFee != 0 ? customFee.toDouble() : 0; + double discount = _discount != null ? _discount.amount.toDouble() : 0; double deliveryFee = deliveryfee != 0 ? deliveryfee.toDouble() : 0; - balance = (total + custom + deliveryFee) - 100.0; + balance = (total + custom + deliveryFee) - discount; return balance; } diff --git a/lib/pages/invoice/invoice_info.dart b/lib/pages/invoice/invoice_info.dart new file mode 100644 index 0000000..6d243ab --- /dev/null +++ b/lib/pages/invoice/invoice_info.dart @@ -0,0 +1,809 @@ +import 'package:fcs/domain/entities/box.dart'; +import 'package:fcs/domain/entities/cargo.dart'; +import 'package:fcs/domain/entities/custom.dart'; +import 'package:fcs/domain/entities/discount.dart'; +import 'package:fcs/domain/entities/invoice.dart'; +import 'package:fcs/domain/entities/payment_method.dart'; +import 'package:fcs/domain/entities/user.dart'; +import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/localization/app_translations.dart'; +import 'package:fcs/pages/discount/discount_list.dart'; +import 'package:fcs/pages/discount/model/discount_model.dart'; +import 'package:fcs/pages/invoice/invoice_editor.dart'; +import 'package:fcs/pages/main/model/language_model.dart'; +import 'package:fcs/pages/main/model/main_model.dart'; +import 'package:fcs/pages/main/util.dart'; +import 'package:fcs/pages/payment_methods/model/payment_method_model.dart'; +import 'package:fcs/pages/rates/custom_list.dart'; +import 'package:fcs/pages/user_search/user_serach.dart'; +import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:fcs/pages/widgets/discount_dropdown.dart'; +import 'package:fcs/pages/widgets/display_text.dart'; +import 'package:fcs/pages/widgets/fcs_id_icon.dart'; +import 'package:fcs/pages/widgets/input_text.dart'; +import 'package:fcs/pages/widgets/local_dropdown.dart'; +import 'package:fcs/pages/widgets/local_text.dart'; +import 'package:fcs/pages/widgets/local_title.dart'; +import 'package:fcs/pages/widgets/multi_img_controller.dart'; +import 'package:fcs/pages/widgets/multi_img_file.dart'; +import 'package:fcs/pages/widgets/my_data_table.dart'; +import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:intl/intl.dart'; +import 'package:provider/provider.dart'; + +import 'box_addition.dart'; + +class InvoiceInfoPage extends StatefulWidget { + final Invoice invoice; + InvoiceInfoPage({this.invoice}); + + @override + _InvoiceInfoPageState createState() => _InvoiceInfoPageState(); +} + +class _InvoiceInfoPageState extends State { + User user; + + var dateFormatter = new DateFormat('dd MMM yyyy'); + TextEditingController _invoiceNumberController = new TextEditingController(); + TextEditingController _dateController = new TextEditingController(); + TextEditingController _nameController = new TextEditingController(); + TextEditingController _phoneController = new TextEditingController(); + TextEditingController _discountController = new TextEditingController(); + TextEditingController _amountController = new TextEditingController(); + TextEditingController _statusController = new TextEditingController(); + TextEditingController _handlingFeeController = new TextEditingController(); + TextEditingController _customFeeController = new TextEditingController(); + MultiImgController multiImgController = MultiImgController(); + TextEditingController _descriptionController = new TextEditingController(); + TextEditingController _balanceController = new TextEditingController(); + + Invoice _invoice; + bool _isLoading = false; + List _boxes = []; + bool isSwitched = false; + int deliveryfee = 0; + int customFee = 0; + double total = 0; + Discount _discount; + bool isNew = false; + Discount selectedDiscount; + int selectedDiscountAmt; + PaymentMethod paymentMethod; + double volumetricRatio = 0; + + List selectedBoxes = []; + List customs = []; + + List _cargoTypes = [ + Cargo(type: 'General Cargo', weight: 33, price: 6), + Cargo(type: 'Medicine', weight: 33, price: 7), + Cargo(type: 'Dangerous Cargo', weight: 33, price: 8) + ]; + + List _receipts = [ + "assets/buying_online_with_first_last_name.png", + ]; + + @override + void initState() { + super.initState(); + volumetricRatio = + Provider.of(context, listen: false).setting.volumetricRatio; + + if (widget.invoice != null) { + _invoice = widget.invoice; + _invoiceNumberController.text = _invoice.invoiceNumber; + _dateController.text = dateFormatter.format(_invoice.invoiceDate); + _nameController.text = _invoice.customerName; + _phoneController.text = _invoice.customerPhoneNumber; + // _amountController.text = _invoice.getAmount.toString(); + _amountController.text = _invoice.amount.toString(); + _statusController.text = _invoice.status.toString(); + _handlingFeeController.text = '0'; + _customFeeController.text = '0'; + // multiImgController.setImageUrls = _receipts; + _descriptionController.text = 'For Electronics goods'; + _balanceController.text = + (_invoice.amount - _invoice.receipts[0].amount).toString(); + // _boxes = _invoice.packages; + } else { + _dateController.text = dateFormatter.format(DateTime.now()); + _amountController.text = '0'; + _handlingFeeController.text = '0'; + _customFeeController.text = '0'; + _descriptionController.text = ''; + _balanceController.text = '0'; + setState(() { + isNew = true; + }); + } + + _boxes = [ + Box( + shipmentNumber: "A202", + receiverNumber: "3", + receiverName: "Ko Myo Min", + boxNumber: "1", + rate: 7, + packageType: "General", + weight: 75, + status: "Packed", + receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon', + cargoDesc: "Clothes", + arrivedDate: DateTime(2020, 6, 1), + width: 10, + height: 10, + length: 10, + // packages: packages, + // statusHistory: statusHistory, + cargoTypes: [ + Cargo(type: 'General Cargo', weight: 25), + Cargo(type: 'Medicine', weight: 20), + Cargo(type: 'Dangerous Cargo', weight: 30) + ]), + Box( + shipmentNumber: "A202", + receiverNumber: "3", + receiverName: "Ko Myo Min", + boxNumber: "2", + rate: 7, + packageType: "General", + weight: 75, + status: "Packed", + cargoDesc: "Clothes", + arrivedDate: DateTime(2020, 6, 1), + width: 10, + height: 10, + length: 10, + // statusHistory: statusHistory, + // packages: packages, + receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon', + cargoTypes: [ + Cargo(type: 'General Cargo', weight: 25), + Cargo(type: 'Medicine', weight: 20), + Cargo(type: 'Dangerous Cargo', weight: 30) + ]) + ]; + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + var mainModel = Provider.of(context); + var discountModel = Provider.of(context); + var paymentMethodModel = Provider.of(context); + + final nameBox = DisplayText( + iconData: Feather.user, + labelTextKey: 'invoice.customer_name', + text: user != null ? user.name : ''); + + final fcsIDBox = Row( + children: [ + Expanded( + child: DisplayText( + text: user != null ? user.fcsID : "", + labelTextKey: "box.fcs.id", + icon: FcsIDIcon(), + )), + IconButton( + icon: Icon(Icons.search, color: primaryColor), + onPressed: () => searchUser(context, callbackUserSelect: (u) { + setState(() { + this.user = u; + }); + })), + ], + ); + + final statusBox = DisplayText( + text: _statusController.text, + iconData: Icons.av_timer, + labelTextKey: 'invoice.status'); + + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(CupertinoIcons.back, color: primaryColor), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: Colors.white, + shadowColor: Colors.transparent, + title: LocalText(context, 'invoice.form.title', + color: primaryColor, fontSize: 20), + actions: [ + new IconButton( + icon: Icon( + Icons.delete, + color: primaryColor, + ), + onPressed: () {}), + new IconButton( + icon: Icon( + Icons.edit, + color: primaryColor, + ), + onPressed: () { + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => InvoiceEditor(invoice: _invoice))); + }) + ], + ), + body: Padding( + padding: const EdgeInsets.all(8.0), + child: ListView( + children: [ + LocalTitle(textKey: "invoice.customer_info"), + DisplayText( + labelTextKey: 'invoice.date', + iconData: Icons.date_range, + text: _dateController.text), + widget.invoice == null + ? Container() + : DisplayText( + labelTextKey: 'invoice.number', + iconData: FontAwesomeIcons.fileInvoice, + text: _invoiceNumberController.text), + fcsIDBox, + nameBox, + statusBox, + LocalTitle(textKey: "invoice.box_info"), + Center(child: Column(children: getCartonRows(context))), + SizedBox(height: 20), + LocalTitle(textKey: "invoice.custom_fee"), + Column(children: getCustomFeeRows(context)), + SizedBox(height: 20), + LocalTitle(textKey: "invoice.cargo_type"), + Column(children: getCargoTableByBox(context)), + SizedBox(height: 20), + Container( + padding: EdgeInsets.only(top: 5, left: 18), + child: Row( + children: [ + Expanded( + child: LocalText(context, 'invoice.payment_method', + fontSize: 16, + color: Colors.grey, + fontWeight: FontWeight.bold), + ), + Text( + '${paymentMethod != null ? paymentMethod.accountName : "KBZ Bank"}', + style: TextStyle(fontSize: 16)), + ], + ), + ), + SizedBox(height: 30), + !isNew + ? LocalTitle(textKey: "invoice.payment_attachment") + : Container(), + ], + ), + ), + ), + ); + } + + getCartonRows(BuildContext context) { + List dataRow = []; + + dataRow = _boxes.map((box) { + return Container( + height: 50, + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: + const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0), + child: Row( + children: [ + Expanded(flex: 2, child: Text(box.packageNumber)), + Expanded( + flex: 1, + child: Text( + box.length == null + ? "" + : box.length.toString() + + ' x ' + + box.length.toString() + + ' x ' + + box.height.toString(), + textAlign: TextAlign.center)), + Expanded( + flex: 2, + child: Center( + child: Text( + box.getShipmentWeight(volumetricRatio).toString()))), + ], + ), + ); + }).toList(); + + dataRow.insert( + 0, + Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 5.0, bottom: 15.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: LocalText( + context, + "invoice.box.number", + color: Colors.grey, + )), + Expanded( + flex: 1, + child: + Text('L x W x H', style: TextStyle(color: Colors.grey))), + Expanded( + flex: 2, + child: LocalText( + context, + "invoice.shipment_weight", + color: Colors.grey, + )), + ], + ), + )); + + return dataRow; + } + + getCustomFeeRows(BuildContext context) { + customFee = 0; + List dataRow = []; + + dataRow = customs.map((custom) { + customFee += custom.fee; + return Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: + const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0), + child: Row( + children: [ + Expanded(flex: 2, child: Text('${custom.productType}')), + Expanded( + flex: 1, + child: Text('\$ ${custom.fee}', textAlign: TextAlign.center)), + Expanded(child: SizedBox(height: 40)) + ], + ), + ); + }).toList(); + + dataRow.insert( + 0, + Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 15.0, bottom: 15.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Text('Product', style: TextStyle(color: Colors.grey))), + Expanded( + flex: 1, + child: Text('Fee', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey))), + Expanded(flex: 1, child: Container()) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 15.0, bottom: 15.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.total_custom_fee', + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + Expanded( + flex: 1, + child: Center( + child: Text('\$ $customFee', + textAlign: TextAlign.center, + style: TextStyle(fontWeight: FontWeight.bold)))), + Expanded( + child: Container(), + ) + ], + ), + )); + return dataRow; + } + + getCargoTableByBox(BuildContext context) { + total = 0; + List dataRow = _cargoTypes.map((cargo) { + var amount = cargo.weight * cargo.price; + total += amount; + return Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 15.0, bottom: 15.0), + child: Row( + children: [ + Expanded(flex: 2, child: Text('${cargo.type}')), + Expanded( + flex: 2, + child: Text('${cargo.weight} x ${cargo.price}', + textAlign: TextAlign.center)), + Expanded( + child: Text('\$ $amount', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + ))) + ], + ), + ); + }).toList(); + dataRow.insert( + 0, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 15.0, bottom: 15.0), + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + child: Row( + children: [ + Expanded( + flex: 2, + child: Text(getLocalString(context, 'invoice.box.cargo_type'), + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.grey))), + Expanded( + flex: 2, + child: Text( + getLocalString(context, 'cargo.weight') + + ' x ' + + getLocalString(context, 'cargo.rate'), + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.grey))), + Expanded( + child: Text(getLocalString(context, 'invoice.amount'), + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Colors.grey))) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.total', + color: Colors.black, + ), + ), + ), + Expanded( + child: Text( + '\$ $total', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), + textAlign: TextAlign.end, + )) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only(left: 5.0, right: 5.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.discount_value', + color: Colors.black, + ), + ), + ), + Expanded( + child: Text( + '\$ ${_discount != null ? _discount.amount.toInt() : 0}', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + ))) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 10.0, bottom: 0.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.custom_fee', + color: Colors.black, + ), + )), + Expanded( + child: Text('\$ $customFee', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + )), + ), + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 20.0, bottom: 0.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.handling_fee', + color: Colors.black, + ), + )), + Expanded( + child: Text('\$ $customFee', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + )), + ), + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.delivery_fee', + color: Colors.black, + ), + ), + ), + Expanded( + child: Text('\$ $deliveryfee', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 15, + fontWeight: FontWeight.bold, + ))) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + child: Row( + children: [ + Expanded(child: Text('')), + Expanded( + flex: 2, + child: Divider( + thickness: 3, + )), + ], + ))); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.net_amount', + color: Colors.black, + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + ), + Expanded( + child: Text('\$ ${getTotalBalance(total)}', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: primaryColor))) + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 10.0, bottom: 10.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'invoice.balance', + color: Colors.black, + fontSize: 15, + fontWeight: FontWeight.bold, + ), + ), + ), + Expanded( + child: Text('\$ ${getTotalBalance(total)}', + textAlign: TextAlign.end, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: primaryColor))) + ], + ), + )); + + return dataRow; + } + + getTotalBalance(total) { + double balance = 0; + double custom = customFee != 0 ? customFee.toDouble() : 0; + double deliveryFee = deliveryfee != 0 ? deliveryfee.toDouble() : 0; + double discount = _discount != null ? _discount.amount.toDouble() : 0; + balance = (total + custom + deliveryFee) - discount; + return balance; + } + + List getBoxRow(BuildContext context) { + return _boxes.map((p) { + p.cargoTypes.map((cargo) { + _cargoTypes.asMap().map((index, _cargo) { + if (_cargo.type == cargo.type) { + setState(() { + _cargoTypes[index].weight += cargo.weight; + }); + } + }); + }); + return MyDataRow( + onSelectChanged: (bool selected) {}, + cells: [ + MyDataCell(Checkbox( + value: true, + onChanged: (value) { + selectedBoxes.add(p); + }, + )), + MyDataCell(new Text( + p.boxNumber == null + ? "" + : '${p.shipmentNumber}-${p.receiverNumber} #${p.boxNumber}', + style: textStyle, + )), + MyDataCell(new Text( + p.length == null + ? "" + : p.length.toString() + + ' x ' + + p.length.toString() + + ' x ' + + p.height.toString(), + style: textStyle, + )), + ], + ); + }).toList(); + } + + List getCargoDataRow(BuildContext context) { + return _cargoTypes.asMap().entries.map((c) { + var cargo = c.value; + var amt = cargo.weight * cargo.price; + return MyDataRow( + onSelectChanged: (bool selected) {}, + cells: [ + MyDataCell(new Text( + cargo.type, + style: textStyle, + )), + MyDataCell(new Text( + cargo.weight.toString() + ' x ' + cargo.price.toString(), + style: textStyle, + )), + MyDataCell(new Text( + "\$$amt", + style: textStyle, + )), + ], + ); + }).toList() + // .insert(_cargoTypes.length,MyDataRow(cells: [ + // MyDataCell(new Text('')), + // MyDataCell(new Text('Total')), + // MyDataCell(new Text( + // "\$5000", + // style: textStyle, + // )), + // ]) + // ) + ; + } +} diff --git a/lib/pages/invoice/invoice_list_row.dart b/lib/pages/invoice/invoice_list_row.dart index 2015c07..5266ff4 100644 --- a/lib/pages/invoice/invoice_list_row.dart +++ b/lib/pages/invoice/invoice_list_row.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:fcs/domain/entities/invoice.dart'; import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/invoice/invoice_info.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -78,12 +79,14 @@ class _InvoiceListRowState extends State { child: InkWell( onTap: () { owner - ? Navigator.of(context).push( - BottomUpPageRoute(InvoiceEditor(invoice: _invoice))) - : Navigator.of(context) - .push(BottomUpPageRoute(PaymentPDFScreen( - path: pdfPath, - ))); + ? Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => PaymentPDFScreen( + path: pdfPath, + ))) + : Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => PaymentPDFScreen( + path: pdfPath, + ))); }, child: new Row( children: [ @@ -147,8 +150,9 @@ class _InvoiceListRowState extends State { ], ), onPressed: () { - Navigator.of(context).push( - BottomUpPageRoute(PaymentPage(invoice: _invoice))); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => + PaymentPage(invoice: _invoice))); }, )), ) @@ -178,18 +182,19 @@ class _InvoiceListRowState extends State { CupertinoActionSheetAction( child: Row( children: [ - Icon(Icons.file_download), Padding( padding: const EdgeInsets.only(left: 8.0), child: Text( - 'Download', + 'See detail', style: TextStyle(fontSize: 16, color: Colors.black), ), ), ], ), onPressed: () { - Navigator.pop(context); + //to go invoice info page + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => InvoiceInfoPage(invoice: _invoice))); }, ) ], diff --git a/lib/pages/invoice/invoice_shipment_list.dart b/lib/pages/invoice/invoice_shipment_list.dart new file mode 100644 index 0000000..748170a --- /dev/null +++ b/lib/pages/invoice/invoice_shipment_list.dart @@ -0,0 +1,76 @@ +import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/localization/app_translations.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/local_text.dart'; +import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:provider/provider.dart'; + +import 'package:flutter/material.dart'; + +import 'invoice_shipment_list_row.dart'; + +class InvoiceShipmentList extends StatefulWidget { + @override + _InvoiceShipmentListState createState() => _InvoiceShipmentListState(); +} + +class _InvoiceShipmentListState extends State { + bool _isLoading = false; + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @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(CupertinoIcons.back), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: primaryColor, + title: LocalText(context, "shipment", + fontSize: 18, color: Colors.white), + actions: [ + IconButton( + icon: Icon( + Icons.search, + color: Colors.white, + ), + iconSize: 30, + // onPressed: () => showPlacesSearch(context), + ), + ], + ), + 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 InvoiceShipmentListRow( + pickUp: pickupModel.pickups[index]); + }), + ), + ), + ); + } +} diff --git a/lib/pages/invoice/invoice_shipment_list_row.dart b/lib/pages/invoice/invoice_shipment_list_row.dart new file mode 100644 index 0000000..1ff356b --- /dev/null +++ b/lib/pages/invoice/invoice_shipment_list_row.dart @@ -0,0 +1,116 @@ +import 'package:fcs/domain/entities/pickup.dart'; +import 'package:fcs/helpers/theme.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; + +import '../main/util.dart'; +import 'invoice_customer_list.dart'; + +class InvoiceShipmentListRow extends StatefulWidget { + final Shipment pickUp; + const InvoiceShipmentListRow({this.pickUp}); + + @override + _InvoiceShipmentListRowState createState() => _InvoiceShipmentListRowState(); +} + +class _InvoiceShipmentListRowState extends State { + final double dotSize = 15.0; + Shipment _pickUp = new Shipment(); + + @override + void initState() { + super.initState(); + if (widget.pickUp != null) { + _pickUp = widget.pickUp; + } + } + + @override + Widget build(BuildContext context) { + print('_pickup $_pickUp'); + return Container( + padding: EdgeInsets.only(left: 15, right: 15), + child: InkWell( + onTap: () { + Navigator.of(context).push( + CupertinoPageRoute(builder: (context) => InvoiceCustomerList())); + }, + child: Row( + children: [ + Expanded( + child: new Padding( + padding: const EdgeInsets.symmetric(vertical: 16.0), + child: new Row( + children: [ + Padding( + padding: EdgeInsets.all(5.0), + child: Icon( + SimpleLineIcons.direction, + color: primaryColor, + )), + new Expanded( + child: new Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(left: 8.0), + child: new Text( + _pickUp.id == null ? '' : _pickUp.id, + style: new TextStyle( + fontSize: 15.0, color: Colors.black), + ), + ), + Padding( + padding: const EdgeInsets.only(left: 10.0, top: 10), + child: new Text( + _pickUp.id == null + ? '' + : "Last ${_pickUp.last} days", + style: new TextStyle( + fontSize: 15.0, color: Colors.grey), + ), + ) + ], + ), + ), + ], + ), + ), + ), + Column( + children: [ + Padding( + padding: const EdgeInsets.all(0), + child: getStatus(_pickUp.status), + ), + Padding( + padding: const EdgeInsets.only(left: 8.0, top: 5, bottom: 5), + child: Row( + children: [ + new Text( + _pickUp.weight == null + ? '' + : _pickUp.weight.toString() + 'lb - ', + style: + new TextStyle(fontSize: 15.0, color: Colors.grey), + ), + new Text( + _pickUp.numberOfPackage == null + ? "" + : _pickUp.numberOfPackage.toString() + ' packages', + style: + new TextStyle(fontSize: 15.0, color: Colors.grey), + ), + ], + ), + ), + ], + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/invoice/payment_page.dart b/lib/pages/invoice/payment_page.dart index 78c8adc..5753e2c 100644 --- a/lib/pages/invoice/payment_page.dart +++ b/lib/pages/invoice/payment_page.dart @@ -2,12 +2,15 @@ import 'package:fcs/domain/entities/invoice.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/localization/app_translations.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/local_title.dart'; import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/my_data_table.dart'; import 'package:fcs/pages/widgets/number_cell.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -23,28 +26,18 @@ class PaymentPage extends StatefulWidget { } class _PaymentPageState extends State { - TextEditingController _addressEditingController = new TextEditingController(); - TextEditingController _fromTimeEditingController = - new TextEditingController(); - TextEditingController _toTimeEditingController = new TextEditingController(); - TextEditingController _noOfPackageEditingController = - new TextEditingController(); - TextEditingController _weightEditingController = new TextEditingController(); - MultiImgController multiImgController = MultiImgController(); + TextEditingController _amountController = new TextEditingController(); var dateFormatter = new DateFormat('dd MMM yyyy'); Invoice _invoice = new Invoice(); bool _isLoading = false; - List _receipts = [ - "assets/buying_online_with_first_last_name.png", - ]; + bool isNew; @override void initState() { if (widget.invoice != null) { _invoice = widget.invoice; - // multiImgController.setImageUrls = _receipts; } super.initState(); } @@ -58,7 +51,16 @@ class _PaymentPageState extends State { @override Widget build(BuildContext context) { - final saveBox = fcsButton(context, getLocalString(context, 'btn.save')); + final amountBox = InputText( + labelTextKey: 'pm.amount', + controller: _amountController, + iconData: FontAwesomeIcons.moneyBill); + + final receiptFileBox = Row(children: [ + LocalText(context, 'pm.attachment', fontSize: 16, color: Colors.grey), + IconButton( + icon: Icon(Icons.attachment, color: primaryColor), onPressed: () {}) + ]); return LocalProgress( inAsyncCall: _isLoading, @@ -66,122 +68,123 @@ class _PaymentPageState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, title: Text(AppTranslations.of(context).text("pm_.title")), + actions: [ + IconButton(icon: Icon(Icons.cloud_upload), onPressed: () {}) + ], ), body: ListView( - padding: const EdgeInsets.all(15.0), + padding: const EdgeInsets.all(10.0), children: [ - Container( - child: Row( - children: [ - LocalText(context, 'pm.total.amount', - color: Colors.black, fontSize: 16), - Text( - ' \$ ${_invoice.amount}', - style: TextStyle( - color: primaryColor, - fontSize: 16, - fontWeight: FontWeight.bold), - ) - ], - )), - Container( - padding: const EdgeInsets.only(top: 15.0), - child: Row( - children: [ - LocalText(context, 'pm.remaining_balance', - color: Colors.black, fontSize: 16), - Text( - ' \$ ${_invoice.amount - _invoice.receipts[0].amount}', - style: TextStyle( - color: primaryColor, - fontSize: 16, - fontWeight: FontWeight.bold), - ) - ], - )), + amountBox, + SizedBox(height: 10), + receiptFileBox, SizedBox(height: 10), Divider(), SizedBox(height: 10), - LocalText(context, 'pm.attachment', - color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold), - Padding( - padding: EdgeInsets.only(left: 20, top: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding: EdgeInsets.only(top: 8), - child: Text( - '${dateFormatter.format(_invoice.receipts[0].date)} ', - style: TextStyle(color: Colors.black, fontSize: 16), - ), - ), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 10), - child: MultiImageFile( - enabled: true, - controller: multiImgController, - title: "Receipt File", - )), - ), - ], - ), + LocalTitle(textKey: "pm.receipt"), + Column( + children: getCustomFeeRows(context), ), SizedBox(height: 25), - Divider(), - SizedBox(height: 10), - LocalText(context, 'pm.receipt', - color: primaryColor, fontSize: 16, fontWeight: FontWeight.bold), - Container( - child: MyDataTable( - headingRowHeight: 40, - columnSpacing: 20, - columns: [ - MyDataColumn( - label: LocalText( - context, - "pm.date", - color: Colors.grey, - ), - ), - MyDataColumn( - label: LocalText( - context, - "pm.amount", - color: Colors.grey, - ), - ), - ], - rows: getPackageRow(context), - ), - ), - SizedBox(height: 25), - // saveBox, - // SizedBox(height: 10), ], ), ), ); } - List getPackageRow(BuildContext context) { - return _invoice.receipts.map((r) { - return MyDataRow( - onSelectChanged: (bool selected) {}, - cells: [ - MyDataCell( - new Text(dateFormatter.format(r.date), style: textStyle), - ), - MyDataCell(NumberCell(r.amount)) - ], + getCustomFeeRows(BuildContext context) { + List dataRow = []; + + dataRow = _invoice.receipts.asMap().entries.map((receipt) { + var r = receipt.value; + var k = receipt.key + 1; + return Container( + height: 50, + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: + const EdgeInsets.only(left: 5.0, right: 5.0, top: 5.0, bottom: 5.0), + child: Row( + children: [ + Expanded(flex: 2, child: Text(dateFormatter.format(r.date))), + Expanded( + flex: 2, + child: Center(child: Text('receipt' + k.toString() + '.png'))), + Expanded(flex: 1, child: Center(child: Text('pending'))), + Expanded(flex: 1, child: Center(child: Text('\$ ${r.amount}'))), + ], + ), ); }).toList(); + + dataRow.insert( + 0, + Container( + decoration: BoxDecoration( + border: Border(bottom: BorderSide(color: Colors.grey))), + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 10.0, bottom: 15.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Text('Product', style: TextStyle(color: Colors.grey))), + Expanded( + flex: 2, + child: Text('File', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey))), + Expanded( + flex: 1, + child: Text('Status', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey))), + Expanded( + flex: 1, + child: Text('Fee', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.grey))), + ], + ), + )); + + dataRow.insert( + dataRow.length, + Container( + padding: const EdgeInsets.only( + left: 5.0, right: 5.0, top: 15.0, bottom: 15.0), + child: Row( + children: [ + Expanded( + flex: 2, + child: Center( + child: LocalText( + context, + 'pm.remaining_balance', + color: Colors.black, + fontWeight: FontWeight.bold, + ), + ), + ), + Expanded( + flex: 2, + child: Container(), + ), + Expanded( + flex: 1, + child: Center( + child: Text('\$ 300', + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.bold, fontSize: 16.0)))), + ], + ), + )); + return dataRow; } } diff --git a/lib/pages/invoice/payment_pdf_screen.dart b/lib/pages/invoice/payment_pdf_screen.dart index 2d59119..ce8f1e6 100644 --- a/lib/pages/invoice/payment_pdf_screen.dart +++ b/lib/pages/invoice/payment_pdf_screen.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/widgets/local_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_pdfview/flutter_pdfview.dart'; @@ -29,8 +30,18 @@ class _PaymentPDFScreenState extends State return Scaffold( appBar: AppBar( backgroundColor: primaryColor, - title: Text("Invoice File"), + title: LocalText(context, 'invoice.pdf', + color: Colors.white, fontSize: 20), + leading: new IconButton( + icon: new Icon(CupertinoIcons.back), + onPressed: () { + Navigator.of(context).pop(); + }), actions: [ + IconButton( + icon: Icon(Icons.file_download), + onPressed: () {}, + ), IconButton( icon: Icon(Icons.share), onPressed: () {}, diff --git a/lib/pages/main/home_page.dart b/lib/pages/main/home_page.dart index e204808..33b4c32 100644 --- a/lib/pages/main/home_page.dart +++ b/lib/pages/main/home_page.dart @@ -256,8 +256,9 @@ class _HomePageState extends State { final shipmentCostBtn = TaskButton("rate", icon: FontAwesomeIcons.calculator, - btnCallback: () => - Navigator.of(context).push(BottomUpPageRoute(ShipmentRates()))); + btnCallback: () => Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => ShipmentRates(), + ))); final fcsShipmentBtn = TaskButton("FCSshipment.title", icon: Ionicons.ios_airplane, @@ -373,7 +374,7 @@ class _HomePageState extends State { ); final signinBtn = FlatButton( onPressed: () { - Navigator.of(context).push(BottomUpPageRoute(SigninPage())); + Navigator.of(context).push(CupertinoPageRoute(builder: (context) => SigninPage())); }, child: Text( "Sign In", @@ -530,10 +531,11 @@ class _HomePageState extends State { } Navigator.push( context, - BottomUpPageRoute(PackageInfo( - package: package, - isSearchResult: true, - )), + CupertinoPageRoute( + builder: (context) => PackageInfo( + package: package, + isSearchResult: true, + )), ); } catch (e) { showMsgDialog(context, "Error", e.toString()); diff --git a/lib/pages/main/welcome_page.dart b/lib/pages/main/welcome_page.dart index 0098891..1e3c769 100644 --- a/lib/pages/main/welcome_page.dart +++ b/lib/pages/main/welcome_page.dart @@ -86,8 +86,8 @@ class _WelcomePageState extends State { ), FlatButton( onPressed: () { - Navigator.of(context) - .push(BottomUpPageRoute(SigninPage())); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => SigninPage())); }, child: Text( getLocalString(context, "welcome.signin"), diff --git a/lib/pages/market/market_editor.dart b/lib/pages/market/market_editor.dart index a54097c..9ab9717 100644 --- a/lib/pages/market/market_editor.dart +++ b/lib/pages/market/market_editor.dart @@ -5,6 +5,7 @@ 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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -60,7 +61,7 @@ class _MarketEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, diff --git a/lib/pages/package/package_editor.dart b/lib/pages/package/package_editor.dart index 06bbf07..d54a79b 100644 --- a/lib/pages/package/package_editor.dart +++ b/lib/pages/package/package_editor.dart @@ -13,6 +13,7 @@ import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:intl/intl.dart'; @@ -90,7 +91,7 @@ class _PackageEditorPageState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, @@ -210,7 +211,7 @@ class _PackageEditorPageState extends State { _manageMarket() { Navigator.push( context, - BottomUpPageRoute(MarketEditor()), + CupertinoPageRoute(builder: (context) => MarketEditor()), ); } diff --git a/lib/pages/package/package_info.dart b/lib/pages/package/package_info.dart index d28b718..54bde2b 100644 --- a/lib/pages/package/package_info.dart +++ b/lib/pages/package/package_info.dart @@ -15,6 +15,7 @@ import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/status_tree.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:intl/intl.dart'; @@ -115,9 +116,10 @@ class _PackageInfoState extends State { ? () async { DeliveryAddress d = await Navigator.push( context, - BottomUpPageRoute(DeliveryAddressSelection( - deliveryAddress: _deliveryAddress, - )), + CupertinoPageRoute( + builder: (context) => DeliveryAddressSelection( + deliveryAddress: _deliveryAddress, + )), ); if (d == null) return; _changeDeliverayAddress(d); @@ -131,7 +133,7 @@ class _PackageInfoState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, diff --git a/lib/pages/package/package_list.dart b/lib/pages/package/package_list.dart index 55db795..8bce68e 100644 --- a/lib/pages/package/package_list.dart +++ b/lib/pages/package/package_list.dart @@ -137,7 +137,7 @@ class _PackageListState extends State { if (_package == null) return; Navigator.push( context, - BottomUpPageRoute(PackageInfo(package: _package)), + CupertinoPageRoute(builder: (context) => PackageInfo(package: _package)), ); } } diff --git a/lib/pages/package/package_list_row.dart b/lib/pages/package/package_list_row.dart index 89ba4a2..c8908f7 100644 --- a/lib/pages/package/package_list_row.dart +++ b/lib/pages/package/package_list_row.dart @@ -2,6 +2,7 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/pages/package/package_info.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -28,7 +29,7 @@ class PackageListRow extends StatelessWidget { } Navigator.push( context, - BottomUpPageRoute(PackageInfo(package: package)), + CupertinoPageRoute(builder: (context) => PackageInfo(package: package)), ); }, child: Row( diff --git a/lib/pages/package/package_new.dart b/lib/pages/package/package_new.dart index 664db99..8bda98b 100644 --- a/lib/pages/package/package_new.dart +++ b/lib/pages/package/package_new.dart @@ -10,6 +10,7 @@ import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -81,7 +82,7 @@ class _PackageNewState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, @@ -171,7 +172,7 @@ class _PackageNewState extends State { _addPackage() async { Package package = await Navigator.push( context, - BottomUpPageRoute(TrackingIDPage()), + CupertinoPageRoute(builder: (context) => TrackingIDPage()), ); if (package != null) { diff --git a/lib/pages/package/tracking_id_page.dart b/lib/pages/package/tracking_id_page.dart index 2918b5e..26db8ae 100644 --- a/lib/pages/package/tracking_id_page.dart +++ b/lib/pages/package/tracking_id_page.dart @@ -10,6 +10,7 @@ import 'package:fcs/pages/widgets/bottom_up_page_route.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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -146,7 +147,7 @@ class _TrackingIDPageState extends State { _manageMarket() { Navigator.push( context, - BottomUpPageRoute(MarketEditor()), + CupertinoPageRoute(builder: (context) => MarketEditor()), ); } diff --git a/lib/pages/payment_methods/payment_method_editor.dart b/lib/pages/payment_methods/payment_method_editor.dart index 8563725..ec9be49 100644 --- a/lib/pages/payment_methods/payment_method_editor.dart +++ b/lib/pages/payment_methods/payment_method_editor.dart @@ -6,6 +6,7 @@ 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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:provider/provider.dart'; @@ -58,7 +59,7 @@ class _PaymentMethodEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor), + icon: new Icon(CupertinoIcons.back, color: primaryColor), onPressed: () => Navigator.of(context).pop(), ), title: LocalText( diff --git a/lib/pages/payment_methods/payment_method_page.dart b/lib/pages/payment_methods/payment_method_page.dart index 09e3807..7598793 100644 --- a/lib/pages/payment_methods/payment_method_page.dart +++ b/lib/pages/payment_methods/payment_method_page.dart @@ -9,6 +9,7 @@ import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_icons/flutter_icons.dart'; @@ -35,7 +36,7 @@ class _PaymentMethodPageState extends State { appBar: AppBar( leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, ), onPressed: () => Navigator.of(context).pop(), @@ -69,7 +70,8 @@ class _PaymentMethodPageState extends State { onPressed: () { Navigator.push( context, - BottomUpPageRoute(PaymentMethodEditor()), + CupertinoPageRoute( + builder: (context) => PaymentMethodEditor()), ); }, icon: Icon(Icons.add), @@ -95,9 +97,10 @@ class _PaymentMethodPageState extends State { ? () { Navigator.push( context, - BottomUpPageRoute(PaymentMethodEditor( - paymentMethod: method, - )), + CupertinoPageRoute( + builder: (context) => PaymentMethodEditor( + paymentMethod: method, + )), ); } : null, diff --git a/lib/pages/processing/processing_editor.dart b/lib/pages/processing/processing_editor.dart index cdcb374..e521dc3 100644 --- a/lib/pages/processing/processing_editor.dart +++ b/lib/pages/processing/processing_editor.dart @@ -16,6 +16,7 @@ import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:intl/intl.dart'; @@ -116,7 +117,7 @@ class _ProcessingEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, @@ -223,7 +224,7 @@ class _ProcessingEditorState extends State { _manageMarket() { Navigator.push( context, - BottomUpPageRoute(MarketEditor()), + CupertinoPageRoute(builder: (context) => MarketEditor()), ); } diff --git a/lib/pages/processing/processing_info.dart b/lib/pages/processing/processing_info.dart index aa748e7..9e4104d 100644 --- a/lib/pages/processing/processing_info.dart +++ b/lib/pages/processing/processing_info.dart @@ -10,6 +10,7 @@ import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/status_tree.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:intl/intl.dart'; @@ -100,7 +101,7 @@ class _ProcessingInfoState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, @@ -177,9 +178,10 @@ class _ProcessingInfoState extends State { _gotoEditor() async { bool deleted = await Navigator.push( context, - BottomUpPageRoute(ProcessingEditor( - package: widget.package, - ))); + CupertinoPageRoute( + builder: (context) => ProcessingEditor( + package: widget.package, + ))); if (deleted ?? false) { Navigator.pop(context); } else { diff --git a/lib/pages/processing/processing_list.dart b/lib/pages/processing/processing_list.dart index c6e79db..61517eb 100644 --- a/lib/pages/processing/processing_list.dart +++ b/lib/pages/processing/processing_list.dart @@ -90,7 +90,8 @@ class _ProcessingListState extends State { if (_package == null) return; Navigator.push( context, - BottomUpPageRoute(ProcessingInfo(package: _package)), + CupertinoPageRoute( + builder: (context) => ProcessingInfo(package: _package)), ); } } diff --git a/lib/pages/processing/processing_list_row.dart b/lib/pages/processing/processing_list_row.dart index 7a1f299..9f1f414 100644 --- a/lib/pages/processing/processing_list_row.dart +++ b/lib/pages/processing/processing_list_row.dart @@ -2,6 +2,7 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/pages/package/package_info.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -30,7 +31,8 @@ class ProcessingListRow extends StatelessWidget { } Navigator.push( context, - BottomUpPageRoute(ProcessingInfo(package: package)), + CupertinoPageRoute( + builder: (context) => ProcessingInfo(package: package)), ); }, child: Row( diff --git a/lib/pages/profile/profile_page.dart b/lib/pages/profile/profile_page.dart index 306d6e6..398739b 100644 --- a/lib/pages/profile/profile_page.dart +++ b/lib/pages/profile/profile_page.dart @@ -182,7 +182,9 @@ class _ProfileState extends State { deliveryAddress: deliveryAddressModel.defalutAddress, onTap: () { Navigator.push( - context, BottomUpPageRoute(DeliveryAddressList())); + context, + CupertinoPageRoute( + builder: (context) => DeliveryAddressList())); }, ), getPrivilegeBox(context), diff --git a/lib/pages/rates/cargo_editor.dart b/lib/pages/rates/cargo_editor.dart index e050f61..b100f59 100644 --- a/lib/pages/rates/cargo_editor.dart +++ b/lib/pages/rates/cargo_editor.dart @@ -4,6 +4,7 @@ import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class CargoEditor extends StatefulWidget { @@ -52,9 +53,7 @@ class _CargoEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon( - Icons.close, - ), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/rates/custom_editor.dart b/lib/pages/rates/custom_editor.dart index e8ba5b8..afeb965 100644 --- a/lib/pages/rates/custom_editor.dart +++ b/lib/pages/rates/custom_editor.dart @@ -4,6 +4,7 @@ import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -54,7 +55,7 @@ class _CustomEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, ), onPressed: () => Navigator.of(context).pop(), ), diff --git a/lib/pages/rates/custom_list.dart b/lib/pages/rates/custom_list.dart new file mode 100644 index 0000000..7907352 --- /dev/null +++ b/lib/pages/rates/custom_list.dart @@ -0,0 +1,86 @@ +import 'package:fcs/domain/entities/custom.dart'; +import 'package:fcs/domain/vo/delivery_address.dart'; +import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/delivery_address/delivery_address_editor.dart'; +import 'package:fcs/pages/main/util.dart'; +import 'package:fcs/pages/rates/custom_editor.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/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import 'custom_row.dart'; +import 'model/shipment_rate_model.dart'; + +class CustomList extends StatefulWidget { + const CustomList({Key key}) : super(key: key); + @override + _CustomListState createState() => _CustomListState(); +} + +class _CustomListState extends State { + bool _isLoading = false; + + @override + void initState() { + super.initState(); + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + var shipmentRateModel = Provider.of(context); + + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(CupertinoIcons.back), + onPressed: () => Navigator.pop(context), + ), + backgroundColor: primaryColor, + title: LocalText( + context, + "Customs", + fontSize: 20, + color: Colors.white, + ), + ), + body: Padding( + padding: const EdgeInsets.all(8.0), + child: ListView.separated( + separatorBuilder: (c, i) => Divider( + color: primaryColor, + ), + itemCount: shipmentRateModel.customs.length, + itemBuilder: (context, index) { + return _row(context, shipmentRateModel.customs[index]); + }), + )), + ); + } + + _row(BuildContext context, Custom custom) { + return InkWell( + onTap: () => Navigator.pop(context, custom), + child: Row( + children: [ + Expanded( + child: CustomRow( + key: ValueKey(custom.id), + custom: custom, + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/rates/custom_row.dart b/lib/pages/rates/custom_row.dart new file mode 100644 index 0000000..c3602b7 --- /dev/null +++ b/lib/pages/rates/custom_row.dart @@ -0,0 +1,66 @@ +import 'package:fcs/domain/entities/custom.dart'; +import 'package:fcs/domain/vo/delivery_address.dart'; +import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/widgets/local_text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; + +typedef SelectionCallback(Custom custom); + +class CustomRow extends StatelessWidget { + final Custom custom; + final SelectionCallback selectionCallback; + const CustomRow( + {Key key, this.custom, this.selectionCallback}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: selectionCallback == null + ? null + : () => this.selectionCallback(custom), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + line(context, custom.productType, + iconData: MaterialCommunityIcons.account, + color: primaryColor, + fontSize: 16), + line(context, custom.fee.toString(), + iconData: Icons.phone, color: primaryColor, fontSize: 16), + + ], + ), + ), + ], + ), + ); + } + + Widget line(BuildContext context, String text, + {IconData iconData, Color color, double fontSize}) { + return Row( + children: [ + iconData == null + ? SizedBox(width: 40) + : Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8), + child: Icon(iconData, color: Colors.black38), + ), + Flexible( + child: TextLocalStyle( + context, + text ?? "", + fontSize: fontSize ?? 14, + color: color, + ), + ), + ], + ); + } +} diff --git a/lib/pages/rates/discount_by_weight_editor.dart b/lib/pages/rates/discount_by_weight_editor.dart index f7edf0a..ffc59c1 100644 --- a/lib/pages/rates/discount_by_weight_editor.dart +++ b/lib/pages/rates/discount_by_weight_editor.dart @@ -4,6 +4,7 @@ import 'package:fcs/localization/app_translations.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -39,8 +40,7 @@ class _DiscountByWeightEditorState extends State { @override Widget build(BuildContext context) { - - final weightBox = InputText( + final weightBox = InputText( labelTextKey: 'rate.discount.weight', iconData: FontAwesomeIcons.weightHanging, controller: _weightController); @@ -55,9 +55,7 @@ class _DiscountByWeightEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon( - Icons.close, - ), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/rates/shipment_rates.dart b/lib/pages/rates/shipment_rates.dart index 64659bd..b562e4a 100644 --- a/lib/pages/rates/shipment_rates.dart +++ b/lib/pages/rates/shipment_rates.dart @@ -7,6 +7,7 @@ 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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -44,9 +45,7 @@ class _ShipmentRatesState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon( - Icons.close, - ), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, @@ -129,12 +128,12 @@ class _ShipmentRatesState extends State { // .push(MaterialPageRoute(builder: (_) => Term())); // }), fcsButton(context, "Estimate shipping cost", callack: () { - Navigator.of(context) - .push(BottomUpPageRoute(ShipmentRatesCal())); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => ShipmentRatesCal())); }), fcsButton(context, "Edit", callack: () { - Navigator.of(context) - .push(BottomUpPageRoute(ShipmentRatesEdit())); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => ShipmentRatesEdit())); }), SizedBox(height: 10) ], diff --git a/lib/pages/rates/shipment_rates_calculate.dart b/lib/pages/rates/shipment_rates_calculate.dart index 1b8eac0..202426b 100644 --- a/lib/pages/rates/shipment_rates_calculate.dart +++ b/lib/pages/rates/shipment_rates_calculate.dart @@ -2,6 +2,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/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:provider/provider.dart'; import 'package:flutter/material.dart'; @@ -37,9 +38,7 @@ class _ShipmentRatesCalState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon( - Icons.close, - ), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/rates/shipment_rates_edit.dart b/lib/pages/rates/shipment_rates_edit.dart index 70afcfe..51d119e 100644 --- a/lib/pages/rates/shipment_rates_edit.dart +++ b/lib/pages/rates/shipment_rates_edit.dart @@ -9,6 +9,7 @@ import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/input_text.dart'; import 'package:fcs/pages/widgets/my_data_table.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; @@ -69,7 +70,7 @@ class _ShipmentRatesEditState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, ), onPressed: () => Navigator.of(context).pop(), ), @@ -136,7 +137,8 @@ class _ShipmentRatesEditState extends State { onPressed: () { Navigator.push( context, - BottomUpPageRoute(CargoEditor()), + CupertinoPageRoute( + builder: (context) => CargoEditor()), ); }, label: Text( @@ -199,7 +201,8 @@ class _ShipmentRatesEditState extends State { onPressed: () { Navigator.push( context, - BottomUpPageRoute(CustomEditor()), + CupertinoPageRoute( + builder: (context) => CustomEditor()), ); }, label: Text( @@ -263,7 +266,9 @@ class _ShipmentRatesEditState extends State { onPressed: () { Navigator.push( context, - BottomUpPageRoute(DiscountByWeightEditor()), + CupertinoPageRoute( + builder: (context) => + DiscountByWeightEditor()), ); }, label: Text( @@ -297,7 +302,7 @@ class _ShipmentRatesEditState extends State { onSelectChanged: (selected) { Navigator.push( context, - BottomUpPageRoute(CargoEditor(rate: r)), + CupertinoPageRoute(builder: (context) => CargoEditor(rate: r)), ); }, cells: [ @@ -325,7 +330,7 @@ class _ShipmentRatesEditState extends State { onSelectChanged: (selected) { Navigator.push( context, - BottomUpPageRoute(CustomEditor(custom: c)), + CupertinoPageRoute(builder: (context) => CustomEditor(custom: c)), ); }, cells: [ @@ -353,7 +358,7 @@ class _ShipmentRatesEditState extends State { onSelectChanged: (selected) { // Navigator.push( // context, - // BottomUpPageRoute(CargoEditor(rate: r)), + // CupertinoPageRoute(builder: (context) => CargoEditor(rate: r)), // ); }, cells: [ diff --git a/lib/pages/receiving/receiving_editor.dart b/lib/pages/receiving/receiving_editor.dart index c9334ec..f8c59d3 100644 --- a/lib/pages/receiving/receiving_editor.dart +++ b/lib/pages/receiving/receiving_editor.dart @@ -13,6 +13,7 @@ import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -136,7 +137,7 @@ class _ReceivingEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, diff --git a/lib/pages/receiving/receiving_info.dart b/lib/pages/receiving/receiving_info.dart index 916bd74..67eda8d 100644 --- a/lib/pages/receiving/receiving_info.dart +++ b/lib/pages/receiving/receiving_info.dart @@ -12,6 +12,7 @@ import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/multi_img_file.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/status_tree.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:intl/intl.dart'; @@ -90,7 +91,7 @@ class _ReceivingInfoState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, @@ -144,9 +145,10 @@ class _ReceivingInfoState extends State { _edit() async { await Navigator.push( context, - BottomUpPageRoute(ReceivingEditor( - package: widget.package, - )), + CupertinoPageRoute( + builder: (context) => ReceivingEditor( + package: widget.package, + )), ); PackageModel packageModel = Provider.of(context, listen: false); diff --git a/lib/pages/receiving/receiving_list.dart b/lib/pages/receiving/receiving_list.dart index 733f04a..7bd2c02 100644 --- a/lib/pages/receiving/receiving_list.dart +++ b/lib/pages/receiving/receiving_list.dart @@ -98,7 +98,7 @@ class _ReceivingListState extends State { _newReceiving() { Navigator.push( context, - BottomUpPageRoute(ReceivingEditor()), + CupertinoPageRoute(builder: (context) => ReceivingEditor()), ); } @@ -108,7 +108,8 @@ class _ReceivingListState extends State { if (_package == null) return; Navigator.push( context, - BottomUpPageRoute(ReceivingInfo(package: _package)), + CupertinoPageRoute( + builder: (context) => ReceivingInfo(package: _package)), ); } } diff --git a/lib/pages/receiving/receiving_list_row.dart b/lib/pages/receiving/receiving_list_row.dart index 5f8812c..a6ab0b0 100644 --- a/lib/pages/receiving/receiving_list_row.dart +++ b/lib/pages/receiving/receiving_list_row.dart @@ -1,6 +1,7 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; @@ -29,7 +30,8 @@ class ReceivingListRow extends StatelessWidget { } Navigator.push( context, - BottomUpPageRoute(ReceivingInfo(package: package)), + CupertinoPageRoute( + builder: (context) => ReceivingInfo(package: package)), ); }, child: Row( diff --git a/lib/pages/shipment/shipment_box_editor.dart b/lib/pages/shipment/shipment_box_editor.dart index 5116a4c..1e4d6cf 100644 --- a/lib/pages/shipment/shipment_box_editor.dart +++ b/lib/pages/shipment/shipment_box_editor.dart @@ -15,6 +15,7 @@ import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_title.dart'; import 'package:fcs/pages/widgets/my_data_table.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:provider/provider.dart'; @@ -118,7 +119,7 @@ class _ShipmentBoxEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, ), onPressed: () => Navigator.of(context).pop(), @@ -145,7 +146,9 @@ class _ShipmentBoxEditorState extends State { ), onPressed: () async { Cargo cargo = await Navigator.push( - context, BottomUpPageRoute(CargoTypeEditor())); + context, + CupertinoPageRoute( + builder: (context) => CargoTypeEditor())); _addCargo(cargo); }), ), @@ -182,9 +185,10 @@ class _ShipmentBoxEditorState extends State { onTap: () async { DeliveryAddress d = await Navigator.push( context, - BottomUpPageRoute(DeliveryAddressSelection( - deliveryAddress: _deliveryAddress, - )), + CupertinoPageRoute( + builder: (context) => DeliveryAddressSelection( + deliveryAddress: _deliveryAddress, + )), ); if (d == null) return; setState(() { @@ -210,9 +214,10 @@ class _ShipmentBoxEditorState extends State { onSelectChanged: (bool selected) async { Cargo cargo = await Navigator.push( context, - BottomUpPageRoute(CargoTypeEditor( - cargo: c, - ))); + CupertinoPageRoute( + builder: (context) => CargoTypeEditor( + cargo: c, + ))); _addCargo(cargo); }, cells: [ diff --git a/lib/pages/shipment/shipment_editor.dart b/lib/pages/shipment/shipment_editor.dart index 16320de..310806d 100644 --- a/lib/pages/shipment/shipment_editor.dart +++ b/lib/pages/shipment/shipment_editor.dart @@ -22,6 +22,7 @@ import 'package:fcs/pages/widgets/local_title.dart'; import 'package:fcs/pages/widgets/multi_img_controller.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:fcs/pages/widgets/title_with_add_button.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -154,9 +155,10 @@ class _ShipmentEditorState extends State { onTap: () async { DeliveryAddress d = await Navigator.push( context, - BottomUpPageRoute(DeliveryAddressSelection( - deliveryAddress: _pickupAddress, - )), + CupertinoPageRoute( + builder: (context) => DeliveryAddressSelection( + deliveryAddress: _pickupAddress, + )), ); if (d == null) return; setState(() { @@ -187,7 +189,7 @@ class _ShipmentEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, ), onPressed: () => Navigator.of(context).pop(), @@ -234,7 +236,8 @@ class _ShipmentEditorState extends State { onPressed: () { Navigator.push( context, - BottomUpPageRoute(ShipmentBoxEditor()), + CupertinoPageRoute( + builder: (context) => ShipmentBoxEditor()), ); }, ), @@ -256,8 +259,8 @@ class _ShipmentEditorState extends State { return boxes.asMap().entries.map((_box) { return InkWell( onTap: () { - Navigator.of(context) - .push(BottomUpPageRoute(ShipmentBoxEditor(box: _box.value))); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => ShipmentBoxEditor(box: _box.value))); }, child: BoxRow(box: _box.value), ); diff --git a/lib/pages/shipment/shipment_list.dart b/lib/pages/shipment/shipment_list.dart index 60d8bae..ec766db 100644 --- a/lib/pages/shipment/shipment_list.dart +++ b/lib/pages/shipment/shipment_list.dart @@ -83,6 +83,7 @@ class _ShipmentListState extends State { } _newPickup() { - Navigator.of(context).push(BottomUpPageRoute(ShipmentEditor())); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => ShipmentEditor())); } } diff --git a/lib/pages/shipment/shipment_list_row.dart b/lib/pages/shipment/shipment_list_row.dart index 0a0046c..4f167a3 100644 --- a/lib/pages/shipment/shipment_list_row.dart +++ b/lib/pages/shipment/shipment_list_row.dart @@ -1,6 +1,7 @@ import 'package:fcs/domain/entities/pickup.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; @@ -41,7 +42,7 @@ class _ShipmentListRowState extends State { child: InkWell( onTap: () { Navigator.of(context) - .push(BottomUpPageRoute(ShipmentEditor(shipment: _pickUp))); + .push(CupertinoPageRoute(builder: (context) => ShipmentEditor(shipment: _pickUp))); }, child: Row( children: [ diff --git a/lib/pages/signin/invitation_request_page.dart b/lib/pages/signin/invitation_request_page.dart index ddbc5f5..5e94f6d 100644 --- a/lib/pages/signin/invitation_request_page.dart +++ b/lib/pages/signin/invitation_request_page.dart @@ -2,6 +2,7 @@ import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; @@ -31,7 +32,7 @@ class _RequestInvitationPageState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/signin/signin_logic.dart b/lib/pages/signin/signin_logic.dart index ec3b891..bdde97a 100644 --- a/lib/pages/signin/signin_logic.dart +++ b/lib/pages/signin/signin_logic.dart @@ -4,6 +4,7 @@ import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/signin/invitation_request_page.dart'; import 'package:fcs/pages/signin/signup_page.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; @@ -21,11 +22,12 @@ navigateAfterAuthVerified(BuildContext context) async { await Provider.of(context, listen: false).hasInvite(); if (!invited) { await Navigator.of(context).pushAndRemoveUntil( - BottomUpPageRoute(RequestInvitationPage()), (r) => false); + CupertinoPageRoute(builder: (context) => RequestInvitationPage()), + (r) => false); return; } } - await Navigator.of(context) - .pushAndRemoveUntil(BottomUpPageRoute(SignupPage()), (r) => false); + await Navigator.of(context).pushAndRemoveUntil( + CupertinoPageRoute(builder: (context) => SignupPage()), (r) => false); } } diff --git a/lib/pages/signin/signin_page.dart b/lib/pages/signin/signin_page.dart index 0b78445..3e3470d 100644 --- a/lib/pages/signin/signin_page.dart +++ b/lib/pages/signin/signin_page.dart @@ -6,6 +6,7 @@ import 'package:fcs/pages/signin/signin_logic.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/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -44,7 +45,7 @@ class _SigninPageState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, @@ -174,8 +175,8 @@ class _SigninPageState extends State { AuthResult auth = await context.read().sendSms(phoneNumber); if (auth.authStatus == AuthStatus.SMS_SENT) { - await Navigator.of(context) - .push(BottomUpPageRoute(SmsCodePage(phoneNumber: phoneNumber))); + await Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => SmsCodePage(phoneNumber: phoneNumber))); Navigator.pop(context); } else if (auth.authStatus == AuthStatus.AUTH_VERIFIED) { await navigateAfterAuthVerified(context); diff --git a/lib/pages/signin/signup_page.dart b/lib/pages/signin/signup_page.dart index 725349e..4f96e6e 100644 --- a/lib/pages/signin/signup_page.dart +++ b/lib/pages/signin/signup_page.dart @@ -2,6 +2,7 @@ import 'package:fcs/pages/main/model/main_model.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -32,7 +33,9 @@ class _SignupPageState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon( + CupertinoIcons.back, + ), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/signin/sms_code_page.dart b/lib/pages/signin/sms_code_page.dart index 073d899..dfe677c 100644 --- a/lib/pages/signin/sms_code_page.dart +++ b/lib/pages/signin/sms_code_page.dart @@ -7,6 +7,7 @@ import 'package:fcs/pages/signin/signin_logic.dart'; import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pin_input_text_field/pin_input_text_field.dart'; import 'package:provider/provider.dart'; @@ -68,7 +69,7 @@ class _SmsCodePageState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.of(context).pop(), ), backgroundColor: primaryColor, diff --git a/lib/pages/staff/staff_editor.dart b/lib/pages/staff/staff_editor.dart index b86baf0..c21bd1d 100644 --- a/lib/pages/staff/staff_editor.dart +++ b/lib/pages/staff/staff_editor.dart @@ -8,6 +8,7 @@ import 'package:fcs/pages/staff/model/staff_model.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -170,7 +171,8 @@ class _StaffEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close, color: primaryColor, size: 30), + icon: + new Icon(CupertinoIcons.back, color: primaryColor, size: 30), onPressed: () => Navigator.of(context).pop(), ), shadowColor: Colors.transparent, diff --git a/lib/pages/staff/staff_list.dart b/lib/pages/staff/staff_list.dart index fbae2b2..a799876 100644 --- a/lib/pages/staff/staff_list.dart +++ b/lib/pages/staff/staff_list.dart @@ -45,7 +45,8 @@ class _StaffListState extends State { ), floatingActionButton: FloatingActionButton.extended( onPressed: () { - Navigator.of(context).push(BottomUpPageRoute(StaffEditor())); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => StaffEditor())); }, icon: Icon(Icons.add), label: LocalText(context, "staff.new", color: Colors.white), @@ -72,8 +73,8 @@ class _StaffListState extends State { children: [ InkWell( onTap: () { - Navigator.of(context) - .push(BottomUpPageRoute(StaffEditor(staff: user))); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => StaffEditor(staff: user))); }, child: Row( children: [ diff --git a/lib/pages/term/term_page.dart b/lib/pages/term/term_page.dart index b95c6c4..b8913b3 100644 --- a/lib/pages/term/term_page.dart +++ b/lib/pages/term/term_page.dart @@ -59,7 +59,7 @@ class _TermPageState extends State { centerTitle: true, leading: new IconButton( icon: new Icon( - Icons.close, + CupertinoIcons.back, color: primaryColor, ), onPressed: () => Navigator.of(context).pop(), diff --git a/lib/pages/widgets/bottom_widgets.dart b/lib/pages/widgets/bottom_widgets.dart index 94c6805..e5c9710 100644 --- a/lib/pages/widgets/bottom_widgets.dart +++ b/lib/pages/widgets/bottom_widgets.dart @@ -15,14 +15,16 @@ class BottomWidgets extends StatelessWidget { children: [ InkWell( onTap: () { - Navigator.of(context).push(BottomUpPageRoute(ContactPage())); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => ContactPage())); }, child: _buildSmallButton( context, "contact.btn", SimpleLineIcons.support), ), InkWell( onTap: () { - Navigator.of(context).push(BottomUpPageRoute(TermPage())); + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => TermPage())); }, child: _buildSmallButton(context, "term.btn", Icons.info_outline), ), diff --git a/lib/pages/widgets/delivery_address_selection.dart b/lib/pages/widgets/delivery_address_selection.dart index 54cd4cc..73d5fb8 100644 --- a/lib/pages/widgets/delivery_address_selection.dart +++ b/lib/pages/widgets/delivery_address_selection.dart @@ -5,6 +5,7 @@ import 'package:fcs/pages/delivery_address/delivery_address_row.dart'; import 'package:fcs/pages/delivery_address/model/delivery_address_model.dart'; import 'package:fcs/pages/widgets/bottom_up_page_route.dart'; import 'package:fcs/pages/widgets/local_text.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -22,7 +23,7 @@ class DeliveryAddressSelection extends StatelessWidget { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(Icons.close), + icon: new Icon(CupertinoIcons.back), onPressed: () => Navigator.pop(context), ), backgroundColor: primaryColor, @@ -35,8 +36,8 @@ class DeliveryAddressSelection extends StatelessWidget { ), floatingActionButton: FloatingActionButton.extended( onPressed: () { - Navigator.of(context) - .push(BottomUpPageRoute(DeliveryAddressEditor())); + Navigator.of(context).push(CupertinoPageRoute( + builder: (context) => DeliveryAddressEditor())); }, icon: Icon(Icons.add), label: LocalText(context, "delivery_address.new_address",