update cartion editor for package

This commit is contained in:
tzw
2024-02-06 17:45:36 +06:30
parent 3767ba76dc
commit 3a91b49a1a
10 changed files with 563 additions and 109 deletions

View File

@@ -19,14 +19,16 @@ import '../widgets/progress.dart';
import '../widgets/step_widget.dart';
import 'cargo_widget.dart';
import 'carton_size_widget.dart';
import 'carton_submit.dart';
import 'model/package_selection_model.dart';
import 'package_selection_widget.dart';
class CartonEditorForPackage extends StatefulWidget {
final User sender;
final User consignee;
final String billToValue;
const CartonEditorForPackage(
{Key? key, required this.sender, required this.consignee})
{Key? key, required this.sender, required this.consignee, required this.billToValue})
: super(key: key);
@override
@@ -44,7 +46,7 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
];
List<Package> _packages = [];
List<CargoType> _cargoTypes = [];
List<CargoType> _customDuties = [];
List<CargoType> _surchareItems = [];
int currentStep = 0;
double _length = 0;
@@ -181,18 +183,18 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
sender: widget.sender,
consignee: widget.consignee,
cargoTypes: _cargoTypes,
customDuties: _customDuties,
surchargeItems: _surchareItems,
onContinue: (cargoTypes, customDuties) {
setState(() {
_cargoTypes = List.from(cargoTypes);
_customDuties = List.from(customDuties);
_surchareItems = List.from(customDuties);
currentStep += 1;
});
},
onPrevious: (cargoTypes, customDuties) {
setState(() {
_cargoTypes = List.from(cargoTypes);
_customDuties = List.from(customDuties);
_surchareItems = List.from(customDuties);
currentStep -= 1;
});
},
@@ -200,24 +202,29 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
);
} else {
return Expanded(
child: Text("Submit"),
// child: MixCartonSubmit(
// cartonSizeType: _cartonSizeType,
// standardSize: _standardSize,
// length: _length,
// width: _width,
// height: _height,
// shipment: _shipment!,
// cartons: _packages,
// onCreate: () {
// _create();
// },
// onPrevious: () {
// setState(() {
// currentStep -= 1;
// });
// },
// ),
child: CartonSubmit(
sender: widget.sender,
consingee: widget.consignee,
billToValue: widget.billToValue,
cartonSizeType: _cartonSizeType,
standardSize: _standardSize,
length: _length,
width: _width,
height: _height,
deliveryType: _selectedDeliveryType,
shipment: _shipment!,
packages: _packages,
cargoTypes: _cargoTypes,
surchareItems: _surchareItems,
onCreate: () {
_create();
},
onPrevious: () {
setState(() {
currentStep -= 1;
});
},
),
);
}
}