diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index c3fa161..dab65df 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -13,6 +13,7 @@ "btn.ok": "Ok", "feet":"Feet", "inch":"Inch", + "back.button_confirm":"Are you sure you want to continue without saving changes?", "Buttons End ================================================================":"", "Offline Start ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 91dd517..1b26bf1 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -12,6 +12,7 @@ "btn.ok": "အိုကေ", "feet":"ပေ", "inch":"လက်မ", + "back.button_confirm":"Are you sure you want to continue without saving changes?", "Buttons End ================================================================":"", "Offline Start ================================================================":"", diff --git a/lib/pages/carton/carton_cargo_table.dart b/lib/pages/carton/carton_cargo_table.dart index 8778547..140d8d3 100644 --- a/lib/pages/carton/carton_cargo_table.dart +++ b/lib/pages/carton/carton_cargo_table.dart @@ -1,5 +1,6 @@ import 'package:fcs/domain/entities/cargo_type.dart'; import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/my_data_table.dart'; import 'package:flutter/cupertino.dart'; @@ -25,6 +26,8 @@ class CargoTable extends StatefulWidget { class _CargoTableState extends State { double totalWeight = 0; + List _cargos = []; + double remainingWeight = 0; @override Widget build(BuildContext context) { return MyDataTable( @@ -54,12 +57,13 @@ class _CargoTableState extends State { return []; } - double _total = 0; var rows = widget.cargoTypes.map((c) { - _total += c.weight; - return MyDataRow( onSelectChanged: (bool selected) async { + if (this.totalWeight <= 0) { + showMsgDialog(context, "Error", "Please insert total weight"); + return; + } CargoType cargo = await Navigator.push( context, CupertinoPageRoute( @@ -67,6 +71,12 @@ class _CargoTableState extends State { cargo: c, ))); if (widget.onAdd != null) widget.onAdd(cargo); + if (cargo == null) return; + + this._cargos.add(cargo); + if (this.remainingWeight <= 0) return; + this.remainingWeight -= cargo.weight; + print("this.remainingWeight>>>${this.remainingWeight}"); }, cells: [ MyDataCell(new Text( @@ -104,6 +114,7 @@ class _CargoTableState extends State { if (_t == null) return; setState(() { totalWeight = _t; + remainingWeight = _t; }); }, cells: [ diff --git a/lib/pages/carton/carton_editor.dart b/lib/pages/carton/carton_editor.dart index 878ad41..724047a 100644 --- a/lib/pages/carton/carton_editor.dart +++ b/lib/pages/carton/carton_editor.dart @@ -351,7 +351,11 @@ class _CartonEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/carton_size/carton_size_editor.dart b/lib/pages/carton_size/carton_size_editor.dart index 6c4d51d..06eb228 100644 --- a/lib/pages/carton_size/carton_size_editor.dart +++ b/lib/pages/carton_size/carton_size_editor.dart @@ -139,7 +139,11 @@ class _CartonSizeEditorState extends State { leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/contact/contact_editor.dart b/lib/pages/contact/contact_editor.dart index e91085a..a9c8eee 100644 --- a/lib/pages/contact/contact_editor.dart +++ b/lib/pages/contact/contact_editor.dart @@ -81,9 +81,12 @@ class _ContactEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: new Icon(CupertinoIcons.back, color: primaryColor), - onPressed: () => Navigator.of(context).pop(), - ), + icon: new Icon(CupertinoIcons.back, color: primaryColor), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }), shadowColor: Colors.transparent, backgroundColor: Colors.white, title: LocalText( diff --git a/lib/pages/customer/invitation_create.dart b/lib/pages/customer/invitation_create.dart index 1d3c1fc..318686d 100644 --- a/lib/pages/customer/invitation_create.dart +++ b/lib/pages/customer/invitation_create.dart @@ -51,7 +51,11 @@ class _InvitationCreateState extends State { CupertinoIcons.back, color: primaryColor, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), title: LocalText( context, diff --git a/lib/pages/delivery/delivery_info.dart b/lib/pages/delivery/delivery_info.dart index dc0a5c4..2151cba 100644 --- a/lib/pages/delivery/delivery_info.dart +++ b/lib/pages/delivery/delivery_info.dart @@ -237,7 +237,11 @@ class _DeliveryInfoState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/delivery_address/delivery_address_editor.dart b/lib/pages/delivery_address/delivery_address_editor.dart index f25fce8..78ac361 100644 --- a/lib/pages/delivery_address/delivery_address_editor.dart +++ b/lib/pages/delivery_address/delivery_address_editor.dart @@ -106,7 +106,11 @@ class _DeliveryAddressEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: Colors.white, shadowColor: Colors.transparent, diff --git a/lib/pages/discount/discount_editor.dart b/lib/pages/discount/discount_editor.dart index e8d0a15..a680dba 100644 --- a/lib/pages/discount/discount_editor.dart +++ b/lib/pages/discount/discount_editor.dart @@ -40,7 +40,7 @@ class _DiscountEditorState extends State { if (widget.discount != null) { _discount = widget.discount; _codeController.text = _discount.code; - _amountController.text = _discount.amount.toString(); + _amountController.text = _discount.amount.toStringAsFixed(2); _statusController.text = _discount.status; customerName = widget.discount.customerName; customerId = widget.discount.customerId; @@ -97,7 +97,11 @@ class _DiscountEditorState extends State { ), leading: new IconButton( icon: new Icon(CupertinoIcons.back), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: primaryColor, actions: [ diff --git a/lib/pages/discount/discount_list_row.dart b/lib/pages/discount/discount_list_row.dart index 9047f3b..868905d 100644 --- a/lib/pages/discount/discount_list_row.dart +++ b/lib/pages/discount/discount_list_row.dart @@ -80,7 +80,7 @@ class DiscountListRow extends StatelessWidget { child: Row( children: [ new Text( - "${discount.amount ?? ''}", + "${discount.amount.toStringAsFixed(2) ?? ''}", style: new TextStyle(fontSize: 15.0, color: Colors.grey), ), diff --git a/lib/pages/faq/faq_edit_page.dart b/lib/pages/faq/faq_edit_page.dart index 69eb9be..aee3a4c 100644 --- a/lib/pages/faq/faq_edit_page.dart +++ b/lib/pages/faq/faq_edit_page.dart @@ -126,7 +126,11 @@ class _FAQEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: Colors.white, shadowColor: Colors.transparent, diff --git a/lib/pages/fcs_shipment/fcs_shipment_editor.dart b/lib/pages/fcs_shipment/fcs_shipment_editor.dart index 43643af..2c02a43 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_editor.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_editor.dart @@ -59,9 +59,9 @@ class _FcsShipmentEditorState extends State { _consigneeController.text = _shipment.consignee; _portController.text = _shipment.port; _destinationController.text = _shipment.destination; - }else{ - var mainModel = Provider.of(context,listen: false); - _currentShipmentType =mainModel.setting.shipmentTypes[0]; + } else { + var mainModel = Provider.of(context, listen: false); + _currentShipmentType = mainModel.setting.shipmentTypes[0]; } } @@ -93,7 +93,11 @@ class _FcsShipmentEditorState extends State { shadowColor: Colors.transparent, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: Colors.white, title: LocalText( diff --git a/lib/pages/invoice/editor/invoice_editor.dart b/lib/pages/invoice/editor/invoice_editor.dart index 783a4f2..8bab876 100644 --- a/lib/pages/invoice/editor/invoice_editor.dart +++ b/lib/pages/invoice/editor/invoice_editor.dart @@ -315,7 +315,11 @@ class _InvoiceEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: Colors.white, shadowColor: Colors.transparent, diff --git a/lib/pages/package/package_editor.dart b/lib/pages/package/package_editor.dart index 7216f63..0f488f3 100644 --- a/lib/pages/package/package_editor.dart +++ b/lib/pages/package/package_editor.dart @@ -91,7 +91,11 @@ class _PackageEditorPageState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/payment_methods/payment_method_editor.dart b/lib/pages/payment_methods/payment_method_editor.dart index ec9be49..334b0ef 100644 --- a/lib/pages/payment_methods/payment_method_editor.dart +++ b/lib/pages/payment_methods/payment_method_editor.dart @@ -60,7 +60,11 @@ class _PaymentMethodEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), title: LocalText( context, diff --git a/lib/pages/processing/processing_edit_editor.dart b/lib/pages/processing/processing_edit_editor.dart index 839d6a1..858f9bc 100644 --- a/lib/pages/processing/processing_edit_editor.dart +++ b/lib/pages/processing/processing_edit_editor.dart @@ -117,7 +117,11 @@ class _ProcessingEditEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/processing/processing_editor.dart b/lib/pages/processing/processing_editor.dart index 6021019..6b3b5fc 100644 --- a/lib/pages/processing/processing_editor.dart +++ b/lib/pages/processing/processing_editor.dart @@ -171,7 +171,11 @@ class _ProcesingEditorState extends State { leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/profile/profile_currency_edit.dart b/lib/pages/profile/profile_currency_edit.dart index 6d91664..6e8aeb6 100644 --- a/lib/pages/profile/profile_currency_edit.dart +++ b/lib/pages/profile/profile_currency_edit.dart @@ -59,7 +59,11 @@ class _ProfileCurrencyEditState extends State { size: 35, color: primaryColor, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), ), body: Column( diff --git a/lib/pages/profile/profile_edit.dart b/lib/pages/profile/profile_edit.dart index 23f4a37..8cd33f8 100644 --- a/lib/pages/profile/profile_edit.dart +++ b/lib/pages/profile/profile_edit.dart @@ -74,7 +74,11 @@ class _ProfileEditState extends State { size: 35, color: primaryColor, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), ), body: Column( diff --git a/lib/pages/rates/cargo_editor.dart b/lib/pages/rates/cargo_editor.dart index a570b1d..59cf820 100644 --- a/lib/pages/rates/cargo_editor.dart +++ b/lib/pages/rates/cargo_editor.dart @@ -32,7 +32,7 @@ class _CargoEditorState extends State { if (widget.cargo != null) { _cargo = widget.cargo; _descController.text = _cargo.name; - _rateController.text = _cargo.rate.toString(); + _rateController.text = _cargo.rate.toStringAsFixed(2); } else { _isNew = true; } @@ -60,7 +60,11 @@ class _CargoEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: primaryColor, title: Text(AppTranslations.of(context).text("cargo.form.title")), diff --git a/lib/pages/rates/cargo_type_list.dart b/lib/pages/rates/cargo_type_list.dart index 4b4aa14..1e766c3 100644 --- a/lib/pages/rates/cargo_type_list.dart +++ b/lib/pages/rates/cargo_type_list.dart @@ -75,8 +75,8 @@ class _CargoTypeListState extends State { ))); }, child: Container( - child: _row(cargo.name, "\$ " + cargo.rate.toString(), - 'per pound'), + child: _row(cargo.name, + "\$ " + cargo.rate.toStringAsFixed(2), 'per pound'), ), ); }), diff --git a/lib/pages/rates/custom_editor.dart b/lib/pages/rates/custom_editor.dart index 747716d..b97cd9f 100644 --- a/lib/pages/rates/custom_editor.dart +++ b/lib/pages/rates/custom_editor.dart @@ -33,7 +33,7 @@ class _CustomEditorState extends State { if (widget.custom != null) { _custom = widget.custom; _productController.text = _custom.productType; - _feeController.text = _custom.fee.toString(); + _feeController.text = _custom.fee.toStringAsFixed(2); } else { _isNew = true; } @@ -63,7 +63,11 @@ class _CustomEditorState extends State { icon: new Icon( CupertinoIcons.back, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: primaryColor, title: diff --git a/lib/pages/rates/custom_list.dart b/lib/pages/rates/custom_list.dart index 41946e0..cf24223 100644 --- a/lib/pages/rates/custom_list.dart +++ b/lib/pages/rates/custom_list.dart @@ -88,7 +88,7 @@ class _CustomListState extends State { }, child: Container( child: _row( - custom.productType, "\$ " + custom.fee.toString()), + custom.productType, "\$ " + custom.fee.toStringAsFixed(2)), ), ); }), diff --git a/lib/pages/rates/discount_by_weight_editor.dart b/lib/pages/rates/discount_by_weight_editor.dart index 018c942..487d4fa 100644 --- a/lib/pages/rates/discount_by_weight_editor.dart +++ b/lib/pages/rates/discount_by_weight_editor.dart @@ -62,7 +62,11 @@ class _DiscountByWeightEditorState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: primaryColor, title: Text(AppTranslations.of(context).text("discount.new")), diff --git a/lib/pages/rates/shipment_rates.dart b/lib/pages/rates/shipment_rates.dart index aa351a6..8b5c535 100644 --- a/lib/pages/rates/shipment_rates.dart +++ b/lib/pages/rates/shipment_rates.dart @@ -138,10 +138,12 @@ class _ShipmentRatesState extends State { color: Colors.grey, ), _row("Free delivery within Yangon \nfor shipments over", - "${rate.freeDeliveryWeight}", "pounds"), - _row("Delivery fees", "\$ ${rate.deliveryFee}", - "below ${rate.freeDeliveryWeight} pounds"), - _row("Volumetric Ratio", "${rate.volumetricRatio}", + "${rate.freeDeliveryWeight.toStringAsFixed(2)}", "pounds"), + _row("Delivery fees", "\$ ${rate.deliveryFee.toStringAsFixed(2)}", + "below ${rate.freeDeliveryWeight.toStringAsFixed(2)} pounds"), + _row( + "Volumetric Ratio", + "${rate.volumetricRatio.toStringAsFixed(2)}", "in3 per pound"), Divider( color: Colors.grey, @@ -179,7 +181,8 @@ class _ShipmentRatesState extends State { List getCargoWidget(List cargos) { return cargos.map((cargo) { return Container( - child: _row(cargo.name, "\$ " + cargo.rate.toString(), 'per pound'), + child: _row( + cargo.name, "\$ " + cargo.rate.toStringAsFixed(2), 'per pound'), ); }).toList(); } @@ -187,7 +190,7 @@ class _ShipmentRatesState extends State { List getCustonWidget(List customs) { return customs.map((c) { return Container( - child: _row(c.productType, "\$ " + c.fee.toString(), ''), + child: _row(c.productType, "\$ " + c.fee.toStringAsFixed(2), ''), ); }).toList(); } @@ -197,7 +200,7 @@ class _ShipmentRatesState extends State { return discounts.map((d) { return Container( child: _row("${d.weight.toStringAsFixed(2)} lb", - "\$ " + d.discount.toString(), ''), + "\$ " + d.discount.toStringAsFixed(2), ''), ); }).toList(); } diff --git a/lib/pages/rates/shipment_rates_calculate.dart b/lib/pages/rates/shipment_rates_calculate.dart index 7b7b3e4..9af0d95 100644 --- a/lib/pages/rates/shipment_rates_calculate.dart +++ b/lib/pages/rates/shipment_rates_calculate.dart @@ -2,6 +2,7 @@ import 'package:fcs/domain/entities/carton.dart'; import 'package:fcs/domain/entities/cargo_type.dart'; import 'package:fcs/domain/entities/rate.dart'; import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/rates/model/shipment_rate_model.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/input_text.dart'; @@ -46,7 +47,7 @@ class _ShipmentRatesCalState extends State { _lengthController.text = '12'; _widthController.text = '12'; _heightController.text = '12'; - _actualWeightCtl.text = "10"; + _actualWeightCtl.text = "10.00"; _calShipmentWeight(); } @@ -141,7 +142,11 @@ class _ShipmentRatesCalState extends State { centerTitle: true, leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: Colors.white, shadowColor: Colors.transparent, @@ -163,7 +168,7 @@ class _ShipmentRatesCalState extends State { LocalText(context, "rate.delivery_fee", color: primaryColor, fontSize: 16), Text( - ':\$ $_deliveryFee', + ':\$ ${_deliveryFee.toStringAsFixed(2)}', style: TextStyle( color: primaryColor, fontSize: 16, diff --git a/lib/pages/rates/shipment_rates_edit.dart b/lib/pages/rates/shipment_rates_edit.dart index 6fa144d..1595166 100644 --- a/lib/pages/rates/shipment_rates_edit.dart +++ b/lib/pages/rates/shipment_rates_edit.dart @@ -38,8 +38,8 @@ class _ShipmentRatesEditState extends State { Rate rate = shipmentRateModel.rate; _minWeight.text = rate.freeDeliveryWeight?.toStringAsFixed(2) ?? ""; - _deliveryFee.text = rate.deliveryFee?.toString() ?? ""; - _volumetricRatio.text = rate.volumetricRatio?.toString() ?? ""; + _deliveryFee.text = rate.deliveryFee?.toStringAsFixed(2) ?? ""; + _volumetricRatio.text = rate.volumetricRatio?.toStringAsFixed(2) ?? ""; } @override @@ -73,7 +73,11 @@ class _ShipmentRatesEditState extends State { icon: new Icon( CupertinoIcons.back, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), backgroundColor: primaryColor, title: Text(AppTranslations.of(context).text("rate.edit.title")), diff --git a/lib/pages/receiving/receiving_editor.dart b/lib/pages/receiving/receiving_editor.dart index 305ab6a..78bb9a3 100644 --- a/lib/pages/receiving/receiving_editor.dart +++ b/lib/pages/receiving/receiving_editor.dart @@ -149,7 +149,11 @@ class _ReceivingEditorState extends State { leading: new IconButton( icon: new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/shipment/shipment_editor.dart b/lib/pages/shipment/shipment_editor.dart index 5094612..f3c6aa6 100644 --- a/lib/pages/shipment/shipment_editor.dart +++ b/lib/pages/shipment/shipment_editor.dart @@ -165,7 +165,11 @@ class _ShipmentEditorState extends State { CupertinoIcons.back, color: primaryColor, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white, diff --git a/lib/pages/staff/staff_editor.dart b/lib/pages/staff/staff_editor.dart index c21bd1d..1cad728 100644 --- a/lib/pages/staff/staff_editor.dart +++ b/lib/pages/staff/staff_editor.dart @@ -171,10 +171,13 @@ class _StaffEditorState extends State { appBar: AppBar( centerTitle: true, leading: new IconButton( - icon: - new Icon(CupertinoIcons.back, color: primaryColor, size: 30), - onPressed: () => Navigator.of(context).pop(), - ), + icon: new Icon(CupertinoIcons.back, + color: primaryColor, size: 30), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }), shadowColor: Colors.transparent, backgroundColor: Colors.white, title: LocalText( diff --git a/lib/pages/term/term_edit.dart b/lib/pages/term/term_edit.dart index 5a4732a..571b3e0 100644 --- a/lib/pages/term/term_edit.dart +++ b/lib/pages/term/term_edit.dart @@ -76,7 +76,11 @@ class _TermEditState extends State { color: primaryColor, size: 30, ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () { + showConfirmDialog(context, "back.button_confirm", () { + Navigator.of(context).pop(); + }); + }, ), shadowColor: Colors.transparent, backgroundColor: Colors.white,