This commit is contained in:
PhyoThandar
2020-10-20 18:45:18 +06:30
parent 4884311d47
commit 3cf530d2cb
5 changed files with 140 additions and 66 deletions

View File

@@ -23,16 +23,19 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
TextEditingController _discountController = new TextEditingController();
bool _isLoading = false;
bool _isNew = false;
bool _isNew;
DiscountByWeight _discountByWeight = new DiscountByWeight();
@override
void initState() {
super.initState();
if (widget.discountByWeight != null) {
_discountByWeight = widget.discountByWeight;
_discountByWeight = widget.discountByWeight;
_weightController.text = _discountByWeight.weight.toString();
_discountController.text = _discountByWeight.discount.toString();
_isNew = false;
} else {
_isNew = true;
}
}
@@ -131,7 +134,8 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
try {
var shipmentRateModel =
Provider.of<ShipmentRateModel>(context, listen: false);
await shipmentRateModel.deleteDiscountByWeight(widget.discountByWeight.id);
await shipmentRateModel
.deleteDiscountByWeight(widget.discountByWeight.id);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());