update carton from packages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'package:fcs/domain/entities/custom_duty.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/localization/app_translations.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
@@ -12,7 +12,7 @@ import 'package:provider/provider.dart';
|
||||
import 'model/shipment_rate_model.dart';
|
||||
|
||||
class CustomEditor extends StatefulWidget {
|
||||
final CustomDuty custom;
|
||||
final CargoType custom;
|
||||
CustomEditor({this.custom});
|
||||
|
||||
@override
|
||||
@@ -25,7 +25,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
TextEditingController _shipmentRateController = new TextEditingController();
|
||||
|
||||
bool _isLoading = false;
|
||||
CustomDuty _custom = new CustomDuty();
|
||||
CargoType _custom = new CargoType();
|
||||
bool _isNew = false;
|
||||
|
||||
@override
|
||||
@@ -33,11 +33,10 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
super.initState();
|
||||
if (widget.custom != null) {
|
||||
_custom = widget.custom;
|
||||
_productController.text = _custom.productType;
|
||||
_feeController.text = _custom.fee.toStringAsFixed(2);
|
||||
_shipmentRateController.text = _custom.shipmentRate == null
|
||||
? ""
|
||||
: _custom.shipmentRate.toStringAsFixed(2);
|
||||
_productController.text = _custom.name;
|
||||
_feeController.text = _custom.customDutyFee.toStringAsFixed(2);
|
||||
_shipmentRateController.text =
|
||||
_custom.rate == null ? "" : _custom.rate.toStringAsFixed(2);
|
||||
} else {
|
||||
_isNew = true;
|
||||
}
|
||||
@@ -123,11 +122,10 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
try {
|
||||
var shipmentRateModel =
|
||||
Provider.of<ShipmentRateModel>(context, listen: false);
|
||||
CustomDuty _customduty = CustomDuty(
|
||||
productType: _productController.text,
|
||||
fee: double.parse(_feeController.text),
|
||||
shipmentRate: double.parse(_shipmentRateController.text));
|
||||
print('_customduty => $_customduty');
|
||||
CargoType _customduty = CargoType(
|
||||
name: _productController.text,
|
||||
customDutyFee: double.parse(_feeController.text),
|
||||
rate: double.parse(_shipmentRateController.text));
|
||||
if (_isNew) {
|
||||
await shipmentRateModel.addCustomDuty(_customduty);
|
||||
} else {
|
||||
@@ -173,12 +171,11 @@ class _CustomEditorState extends State<CustomEditor> {
|
||||
_feeController.text != "" ||
|
||||
_shipmentRateController.text != "";
|
||||
} else {
|
||||
CustomDuty _customduty = CustomDuty(
|
||||
productType: _productController.text,
|
||||
fee: double.parse(_feeController.text),
|
||||
// shipmentRate: double.parse(_shipmentRateController.text)
|
||||
);
|
||||
return widget.custom.isChangedForEdit(_customduty);
|
||||
CargoType _customduty = CargoType(
|
||||
name: _productController.text,
|
||||
customDutyFee: double.parse(_feeController.text),
|
||||
rate: double.parse(_shipmentRateController.text));
|
||||
return widget.custom.isChangedForEditCustomDuty(_customduty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user