From 252be38912fa35c49504741347552fdd4b7b9c2d Mon Sep 17 00:00:00 2001 From: tzw Date: Tue, 13 Feb 2024 11:02:46 +0630 Subject: [PATCH] update carton form and info --- lib/pages/carton/cargo_widget.dart | 2 +- lib/pages/carton/carton_info.dart | 63 ++++++++++--------- lib/pages/carton/carton_submit.dart | 3 +- .../mix_carton/carton_selection_widget.dart | 2 +- .../carton/mix_carton/mix_carton_submit.dart | 3 +- lib/pages/carton/mix_carton/type_widget.dart | 2 +- .../carton/package_selection_widget.dart | 2 +- 7 files changed, 42 insertions(+), 35 deletions(-) diff --git a/lib/pages/carton/cargo_widget.dart b/lib/pages/carton/cargo_widget.dart index 212a815..decb010 100644 --- a/lib/pages/carton/cargo_widget.dart +++ b/lib/pages/carton/cargo_widget.dart @@ -334,7 +334,7 @@ class _CargoWidgetState extends State { children: [ const SizedBox(height: 8), userRow, - LocalTitle(textKey: "box.input_cargo_weight", topPadding: 10), + LocalTitle(textKey: "box.input_cargo_weight", topPadding: 5), cargosBox, const SizedBox(height: 15), Divider(), diff --git a/lib/pages/carton/carton_info.dart b/lib/pages/carton/carton_info.dart index 3eb6393..64cfe69 100644 --- a/lib/pages/carton/carton_info.dart +++ b/lib/pages/carton/carton_info.dart @@ -53,33 +53,38 @@ class _CartonInfoState extends State { } _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() - .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() + .getPackagesByIds(_carton.packageIDs); + } - if (_carton.cartonType == carton_mix_carton) { - _mixCartons = await context - .read() - .getCartonsByIds(_carton.mixCartonIDs); - } + if (_carton.cartonType == carton_mix_carton) { + _mixCartons = await context + .read() + .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 { 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 { 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 { //), 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 { onPressed: _gotoEditor), ]), body: Container( - padding: const EdgeInsets.all(10.0), + padding: const EdgeInsets.only(left: 20,right: 20), child: ListView(children: [ Row(children: [ Flexible(child: cartonTypeBox), diff --git a/lib/pages/carton/carton_submit.dart b/lib/pages/carton/carton_submit.dart index 681896d..9aa71ad 100644 --- a/lib/pages/carton/carton_submit.dart +++ b/lib/pages/carton/carton_submit.dart @@ -336,7 +336,8 @@ class CartonSubmit extends StatelessWidget { children: [ Expanded( child: ListView( - padding: const EdgeInsets.all(20), + padding: + const EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 20), children: [ cartonType, const SizedBox(height: 10), diff --git a/lib/pages/carton/mix_carton/carton_selection_widget.dart b/lib/pages/carton/mix_carton/carton_selection_widget.dart index dbfcff6..2fc36b8 100644 --- a/lib/pages/carton/mix_carton/carton_selection_widget.dart +++ b/lib/pages/carton/mix_carton/carton_selection_widget.dart @@ -174,7 +174,7 @@ class _CartonSelectionWidgetState extends State { padding: EdgeInsets.only(left: 10, right: 10), child: Column( children: [ - const SizedBox(height: 8), + const SizedBox(height: 5), LocalTitle(textKey: "box.select.cartion"), const SizedBox(height: 10), searchBox, diff --git a/lib/pages/carton/mix_carton/mix_carton_submit.dart b/lib/pages/carton/mix_carton/mix_carton_submit.dart index 456ca16..145da68 100644 --- a/lib/pages/carton/mix_carton/mix_carton_submit.dart +++ b/lib/pages/carton/mix_carton/mix_carton_submit.dart @@ -279,7 +279,8 @@ class _MixCartonSubmitState extends State { children: [ Expanded( child: ListView( - padding: const EdgeInsets.all(20), + padding: + const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 20), children: [ cartonType, const SizedBox(height: 10), diff --git a/lib/pages/carton/mix_carton/type_widget.dart b/lib/pages/carton/mix_carton/type_widget.dart index 3eccba4..4484c68 100644 --- a/lib/pages/carton/mix_carton/type_widget.dart +++ b/lib/pages/carton/mix_carton/type_widget.dart @@ -321,7 +321,7 @@ class _TypeWidgetState extends State { child: ListView( padding: EdgeInsets.only(left: 10, right: 10), children: [ - const SizedBox(height: 8), + const SizedBox(height: 5), LocalTitle(textKey: "box.select_carton_size"), const SizedBox(height: 8), cartonSizedBox, diff --git a/lib/pages/carton/package_selection_widget.dart b/lib/pages/carton/package_selection_widget.dart index 2d46594..6785a06 100644 --- a/lib/pages/carton/package_selection_widget.dart +++ b/lib/pages/carton/package_selection_widget.dart @@ -221,7 +221,7 @@ class _PackageSelectionWidgetState extends State { children: [ const SizedBox(height: 8), userRow, - LocalTitle(textKey: "box.select.package", topPadding: 10), + LocalTitle(textKey: "box.select.package", topPadding: 5), const SizedBox(height: 10), searchBox, Expanded(