update carton form and info
This commit is contained in:
@@ -53,33 +53,38 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
}
|
||||
|
||||
_init() async {
|
||||
_carton.billTo = billToConsignee;
|
||||
_carton.cartonSizeType = customCarton;
|
||||
_carton.cartonType = carton_from_packages;
|
||||
multiImgController.setImageUrls = _carton.photos;
|
||||
_cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
|
||||
_surchareItems = _carton.cargoTypes.where((e) => e.isCutomDuty).toList();
|
||||
if (_carton.cartonType == carton_from_packages) {
|
||||
_carton.deliveryType = delivery_caton;
|
||||
_packages = await context
|
||||
.read<PackageModel>()
|
||||
.getPackagesByIds(_carton.packageIDs);
|
||||
}
|
||||
try {
|
||||
_isLoading = true;
|
||||
_carton.billTo = billToConsignee;
|
||||
_carton.cartonSizeType = customCarton;
|
||||
_carton.cartonType = carton_from_packages;
|
||||
multiImgController.setImageUrls = _carton.photos;
|
||||
_cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
|
||||
_surchareItems = _carton.cargoTypes.where((e) => e.isCutomDuty).toList();
|
||||
if (_carton.cartonType == carton_from_packages) {
|
||||
_carton.deliveryType = delivery_caton;
|
||||
_packages = await context
|
||||
.read<PackageModel>()
|
||||
.getPackagesByIds(_carton.packageIDs);
|
||||
}
|
||||
|
||||
if (_carton.cartonType == carton_mix_carton) {
|
||||
_mixCartons = await context
|
||||
.read<CartonModel>()
|
||||
.getCartonsByIds(_carton.mixCartonIDs);
|
||||
}
|
||||
if (_carton.cartonType == carton_mix_carton) {
|
||||
_mixCartons = await context
|
||||
.read<CartonModel>()
|
||||
.getCartonsByIds(_carton.mixCartonIDs);
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
_carton.cartonType = "Carton for packages";
|
||||
totalWeight =
|
||||
_carton.cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
||||
totalSurchargeCount =
|
||||
_surchareItems.fold(0, (sum, value) => sum + value.qty);
|
||||
} finally {
|
||||
_isLoading = false;
|
||||
}
|
||||
_carton.cartonType = "Carton for packages";
|
||||
totalWeight =
|
||||
_carton.cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
||||
totalSurchargeCount =
|
||||
_surchareItems.fold(0, (sum, value) => sum + value.qty);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -187,14 +192,14 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 100),
|
||||
padding: EdgeInsets.only(right: 50),
|
||||
child: Text("${removeTrailingZeros(totalWeight)} lb",
|
||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 100),
|
||||
padding: const EdgeInsets.only(right: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
@@ -235,7 +240,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 100),
|
||||
padding: EdgeInsets.only(right: 50),
|
||||
child: Text("${removeTrailingZeros(totalSurchargeCount)} pcs",
|
||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||
],
|
||||
@@ -243,7 +248,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
//),
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 100),
|
||||
padding: const EdgeInsets.only(right: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
@@ -346,7 +351,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
onPressed: _gotoEditor),
|
||||
]),
|
||||
body: Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
padding: const EdgeInsets.only(left: 20,right: 20),
|
||||
child: ListView(children: <Widget>[
|
||||
Row(children: [
|
||||
Flexible(child: cartonTypeBox),
|
||||
|
||||
Reference in New Issue
Block a user