add two decimal and add confirm dialog if press back button
This commit is contained in:
@@ -32,7 +32,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
||||
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<CargoEditor> {
|
||||
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")),
|
||||
|
||||
@@ -75,8 +75,8 @@ class _CargoTypeListState extends State<CargoTypeList> {
|
||||
)));
|
||||
},
|
||||
child: Container(
|
||||
child: _row(cargo.name, "\$ " + cargo.rate.toString(),
|
||||
'per pound'),
|
||||
child: _row(cargo.name,
|
||||
"\$ " + cargo.rate.toStringAsFixed(2), 'per pound'),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -33,7 +33,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
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<CustomEditor> {
|
||||
icon: new Icon(
|
||||
CupertinoIcons.back,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
onPressed: () {
|
||||
showConfirmDialog(context, "back.button_confirm", () {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
},
|
||||
),
|
||||
backgroundColor: primaryColor,
|
||||
title:
|
||||
|
||||
@@ -88,7 +88,7 @@ class _CustomListState extends State<CustomList> {
|
||||
},
|
||||
child: Container(
|
||||
child: _row(
|
||||
custom.productType, "\$ " + custom.fee.toString()),
|
||||
custom.productType, "\$ " + custom.fee.toStringAsFixed(2)),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -62,7 +62,11 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
||||
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")),
|
||||
|
||||
@@ -138,10 +138,12 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
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<ShipmentRates> {
|
||||
List<Widget> getCargoWidget(List<CargoType> 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<ShipmentRates> {
|
||||
List<Widget> getCustonWidget(List<CustomDuty> 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<ShipmentRates> {
|
||||
return discounts.map((d) {
|
||||
return Container(
|
||||
child: _row("${d.weight.toStringAsFixed(2)} lb",
|
||||
"\$ " + d.discount.toString(), ''),
|
||||
"\$ " + d.discount.toStringAsFixed(2), ''),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@@ -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<ShipmentRatesCal> {
|
||||
_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<ShipmentRatesCal> {
|
||||
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<ShipmentRatesCal> {
|
||||
LocalText(context, "rate.delivery_fee",
|
||||
color: primaryColor, fontSize: 16),
|
||||
Text(
|
||||
':\$ $_deliveryFee',
|
||||
':\$ ${_deliveryFee.toStringAsFixed(2)}',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontSize: 16,
|
||||
|
||||
@@ -38,8 +38,8 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
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<ShipmentRatesEdit> {
|
||||
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")),
|
||||
|
||||
Reference in New Issue
Block a user