This commit is contained in:
Phaung Phaung
2021-09-10 12:02:08 +06:30
parent a144c945b6
commit c06ae00b68
35 changed files with 190 additions and 223 deletions

View File

@@ -12,7 +12,7 @@ import 'package:provider/provider.dart';
import 'model/shipment_rate_model.dart';
class CustomEditor extends StatefulWidget {
final CargoType custom;
final CargoType? custom;
CustomEditor({this.custom});
@override
@@ -32,7 +32,7 @@ class _CustomEditorState extends State<CustomEditor> {
void initState() {
super.initState();
if (widget.custom != null) {
_custom = widget.custom;
_custom = widget.custom!;
_productController.text = _custom.name;
_feeController.text = _custom.customDutyFee.toStringAsFixed(2);
_shipmentRateController.text =
@@ -83,7 +83,7 @@ class _CustomEditorState extends State<CustomEditor> {
),
backgroundColor: primaryColor,
title:
Text(AppTranslations.of(context).text("rate.custom.form.title")),
Text(AppTranslations.of(context)!.text("rate.custom.form.title")),
actions: [
IconButton(
icon: Icon(Icons.delete),
@@ -129,7 +129,7 @@ class _CustomEditorState extends State<CustomEditor> {
if (_isNew) {
await shipmentRateModel.addCustomDuty(_customduty);
} else {
_customduty.id = widget.custom.id;
_customduty.id = this._custom.id;
await shipmentRateModel.updateCustomDuty(_customduty);
}
Navigator.pop(context);
@@ -154,7 +154,7 @@ class _CustomEditorState extends State<CustomEditor> {
try {
var shipmentRateModel =
Provider.of<ShipmentRateModel>(context, listen: false);
await shipmentRateModel.deleteCustomDuty(widget.custom.id);
await shipmentRateModel.deleteCustomDuty(this._custom.id);
Navigator.pop(context);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
@@ -175,7 +175,7 @@ class _CustomEditorState extends State<CustomEditor> {
name: _productController.text,
customDutyFee: double.parse(_feeController.text),
rate: double.parse(_shipmentRateController.text));
return widget.custom.isChangedForEditCustomDuty(_customduty);
return this._custom.isChangedForEditCustomDuty(_customduty);
}
}
}