fix rates
This commit is contained in:
@@ -145,6 +145,14 @@ class _ShipmentRatesState extends State<ShipmentRates> {
|
||||
"Volumetric Ratio",
|
||||
"${rate.volumetricRatio.toStringAsFixed(2)}",
|
||||
"in3 per pound"),
|
||||
_row(
|
||||
"Weight difference discount",
|
||||
"${rate.diffDiscountWeight.toStringAsFixed(2)}",
|
||||
"pounds"),
|
||||
_row(
|
||||
"Weight difference rate",
|
||||
"\$ ${rate.diffWeightRate.toStringAsFixed(2)}",
|
||||
""),
|
||||
Divider(
|
||||
color: Colors.grey,
|
||||
),
|
||||
|
||||
@@ -69,7 +69,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
_deliveryFee =
|
||||
effectiveWeight > rate.freeDeliveryWeight ? 0 : rate.deliveryFee;
|
||||
_amount = amount == null ? 0 : amount + _deliveryFee;
|
||||
_shipmentWeight = shipmentWeight;
|
||||
_shipmentWeight = shipmentWeight.toDouble();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -143,9 +143,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
leading: new IconButton(
|
||||
icon: new Icon(CupertinoIcons.back, color: primaryColor),
|
||||
onPressed: () {
|
||||
showConfirmDialog(context, "back.button_confirm", () {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
backgroundColor: Colors.white,
|
||||
@@ -197,41 +195,4 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_row(String desc, String price, String unit, String value, {bool input}) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text('$desc ', style: TextStyle(fontSize: 15)),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 3.0),
|
||||
child: Text(
|
||||
'$price',
|
||||
style: TextStyle(color: primaryColor, fontSize: 14),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'$unit',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 14),
|
||||
),
|
||||
// TextFormField(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 50,
|
||||
),
|
||||
Container(
|
||||
width: 50,
|
||||
child: TextFormField(
|
||||
initialValue: value,
|
||||
textAlign: TextAlign.end,
|
||||
)),
|
||||
],
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
TextEditingController _minWeight = new TextEditingController();
|
||||
TextEditingController _deliveryFee = new TextEditingController();
|
||||
TextEditingController _volumetricRatio = new TextEditingController();
|
||||
TextEditingController _diffDiscountWeight = new TextEditingController();
|
||||
TextEditingController _diffWeightRate = new TextEditingController();
|
||||
|
||||
Rate rate;
|
||||
|
||||
@override
|
||||
@@ -41,6 +44,8 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
_minWeight.text = rate.freeDeliveryWeight?.toStringAsFixed(2) ?? "";
|
||||
_deliveryFee.text = rate.deliveryFee?.toStringAsFixed(2) ?? "";
|
||||
_volumetricRatio.text = rate.volumetricRatio?.toStringAsFixed(2) ?? "";
|
||||
_diffDiscountWeight.text = rate.diffDiscountWeight?.toStringAsFixed(2) ?? "";
|
||||
_diffWeightRate.text = rate.diffWeightRate?.toStringAsFixed(2) ?? "";
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -62,8 +67,16 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
controller: _deliveryFee);
|
||||
final ratioBox = InputText(
|
||||
labelTextKey: 'rate.volumetric_ratio',
|
||||
iconData: Icons.attach_money,
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
controller: _volumetricRatio);
|
||||
final diffDiscountWeightBox = InputText(
|
||||
labelTextKey: 'rate.diff_discount_weight',
|
||||
iconData: FontAwesomeIcons.weightHanging,
|
||||
controller: _diffDiscountWeight);
|
||||
final diffWeightRateBox = InputText(
|
||||
labelTextKey: 'rate.diff_weight_rate',
|
||||
iconData: Icons.attach_money,
|
||||
controller: _diffWeightRate);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
@@ -97,6 +110,8 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
minWigBox,
|
||||
feeBox,
|
||||
ratioBox,
|
||||
diffDiscountWeightBox,
|
||||
diffWeightRateBox,
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
@@ -121,7 +136,9 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
Rate _rate = new Rate(
|
||||
deliveryFee: double.parse(_deliveryFee.text),
|
||||
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||
volumetricRatio: double.parse(_volumetricRatio.text));
|
||||
volumetricRatio: double.parse(_volumetricRatio.text),
|
||||
diffDiscountWeight: double.parse(_diffDiscountWeight.text),
|
||||
diffWeightRate: double.parse(_diffWeightRate.text));
|
||||
Rate r = new Rate();
|
||||
print('_rate =>$r');
|
||||
await shipmentRateModel.updateRate(_rate);
|
||||
@@ -137,9 +154,12 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
|
||||
|
||||
isDataChanged() {
|
||||
Rate _rate = new Rate(
|
||||
deliveryFee: double.parse(_deliveryFee.text),
|
||||
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||
volumetricRatio: double.parse(_volumetricRatio.text));
|
||||
deliveryFee: double.parse(_deliveryFee.text),
|
||||
freeDeliveryWeight: double.parse(_minWeight.text),
|
||||
volumetricRatio: double.parse(_volumetricRatio.text),
|
||||
diffDiscountWeight: double.parse(_diffDiscountWeight.text),
|
||||
diffWeightRate: double.parse(_diffWeightRate.text),
|
||||
);
|
||||
return rate.isChangedForEdit(_rate);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user