update cargo type input for carton

This commit is contained in:
tzw
2025-04-03 11:41:04 +06:30
parent 01cecc70a7
commit 30c27340ca
4 changed files with 10 additions and 7 deletions

View File

@@ -18,8 +18,8 @@ import 'surcharge_item_addition.dart';
typedef OnPrevious = Function(List<CargoType> cargoTypes,
List<CargoType> customDuties, double totalWeight);
typedef OnContinue = Function(
List<CargoType> cargoTypes, List<CargoType> customDuties);
typedef OnContinue = Function(List<CargoType> cargoTypes,
List<CargoType> customDuties, double totalWeight);
class CargoWidget extends StatefulWidget {
final User sender;
@@ -408,7 +408,8 @@ class _CargoWidgetState extends State<CargoWidget> {
context, "Error", "Please add the right cargo type weight");
return;
}
widget.onContinue!(_cargoTypes, _surchareItems);
widget.onContinue!(
_cargoTypes, _surchareItems, double.tryParse(totalCtl.text) ?? 0);
}
},
);

View File

@@ -255,8 +255,9 @@ class _CartonPackageEditorState extends State<CartonPackageEditor> {
cargoTypes: _cargoTypes,
surchargeItems: _surchareItems,
totalWeight: _totalWeight,
onContinue: (cargoTypes, customDuties) {
onContinue: (cargoTypes, customDuties, totalWeight) {
setState(() {
_totalWeight = totalWeight;
_cargoTypes = List.from(cargoTypes);
_surchareItems = List.from(customDuties);
currentStep += 1;

View File

@@ -190,8 +190,9 @@ class _CartonPackageFormState extends State<CartonPackageForm> {
cargoTypes: _cargoTypes,
surchargeItems: _surchareItems,
totalWeight: _totalWeight,
onContinue: (cargoTypes, customDuties) {
onContinue: (cargoTypes, customDuties, totalWeight) {
setState(() {
_totalWeight = totalWeight;
_cargoTypes = List.from(cargoTypes);
_surchareItems = List.from(customDuties);
currentStep += 1;