cleanup code
This commit is contained in:
@@ -35,8 +35,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
_custom = widget.custom!;
|
||||
_productController.text = _custom.name ?? "";
|
||||
_feeController.text = _custom.customDutyFee.toStringAsFixed(2);
|
||||
_shipmentRateController.text =
|
||||
_custom.rate == null ? "" : _custom.rate.toStringAsFixed(2);
|
||||
_shipmentRateController.text = _custom.rate.toStringAsFixed(2);
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,7 @@ class _CustomListState extends State<CustomList> {
|
||||
child: _row(
|
||||
custom.name??"",
|
||||
"Custom Fee \$ " + custom.customDutyFee.toStringAsFixed(2),
|
||||
// ignore: unnecessary_null_comparison
|
||||
custom.rate == null
|
||||
? ""
|
||||
: "Shipment rate \$ " +
|
||||
|
||||
@@ -200,7 +200,7 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
}
|
||||
|
||||
List<Widget> getDiscountWidget(List<DiscountByWeight> discounts) {
|
||||
if (discounts == null) return [];
|
||||
if (discounts.isEmpty) return [];
|
||||
return discounts.map((d) {
|
||||
return Container(
|
||||
child: _row("${d.weight.toStringAsFixed(2)} lb",
|
||||
|
||||
@@ -67,7 +67,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
setState(() {
|
||||
_deliveryFee =
|
||||
effectiveWeight > rate.freeDeliveryWeight ? 0 : rate.deliveryFee;
|
||||
_amount = amount == null ? 0 : amount + _deliveryFee;
|
||||
_amount = amount + _deliveryFee;
|
||||
_shipmentWeight = shipmentWeight.toDouble();
|
||||
});
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
);
|
||||
|
||||
final shipmentWeightBox = DisplayText(
|
||||
text: _shipmentWeight != null ? _shipmentWeight.toStringAsFixed(2) : "0",
|
||||
text: _shipmentWeight.toStringAsFixed(2),
|
||||
labelTextKey: "box.shipment_weight",
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
);
|
||||
|
||||
@@ -49,8 +49,6 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var shipmentRateModel = Provider.of<ShipmentRateModel>(context);
|
||||
|
||||
final minWigBox = InputText(
|
||||
labelTextKey: 'rate.min_weight',
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
|
||||
Reference in New Issue
Block a user