fix rates
This commit is contained in:
@@ -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