update carton form and info

This commit is contained in:
tzw
2024-02-13 11:02:46 +06:30
parent 1ec130bf09
commit 252be38912
7 changed files with 42 additions and 35 deletions

View File

@@ -334,7 +334,7 @@ class _CargoWidgetState extends State<CargoWidget> {
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(),

View File

@@ -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),

View File

@@ -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),

View File

@@ -174,7 +174,7 @@ class _CartonSelectionWidgetState extends State<CartonSelectionWidget> {
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,

View File

@@ -279,7 +279,8 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
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),

View File

@@ -321,7 +321,7 @@ class _TypeWidgetState extends State<TypeWidget> {
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,

View File

@@ -221,7 +221,7 @@ class _PackageSelectionWidgetState extends State<PackageSelectionWidget> {
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(