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: [ children: [
const SizedBox(height: 8), const SizedBox(height: 8),
userRow, userRow,
LocalTitle(textKey: "box.input_cargo_weight", topPadding: 10), LocalTitle(textKey: "box.input_cargo_weight", topPadding: 5),
cargosBox, cargosBox,
const SizedBox(height: 15), const SizedBox(height: 15),
Divider(), Divider(),

View File

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

View File

@@ -336,7 +336,8 @@ class CartonSubmit extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: ListView( child: ListView(
padding: const EdgeInsets.all(20), padding:
const EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 20),
children: [ children: [
cartonType, cartonType,
const SizedBox(height: 10), const SizedBox(height: 10),

View File

@@ -174,7 +174,7 @@ class _CartonSelectionWidgetState extends State<CartonSelectionWidget> {
padding: EdgeInsets.only(left: 10, right: 10), padding: EdgeInsets.only(left: 10, right: 10),
child: Column( child: Column(
children: [ children: [
const SizedBox(height: 8), const SizedBox(height: 5),
LocalTitle(textKey: "box.select.cartion"), LocalTitle(textKey: "box.select.cartion"),
const SizedBox(height: 10), const SizedBox(height: 10),
searchBox, searchBox,

View File

@@ -279,7 +279,8 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
children: [ children: [
Expanded( Expanded(
child: ListView( child: ListView(
padding: const EdgeInsets.all(20), padding:
const EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 20),
children: [ children: [
cartonType, cartonType,
const SizedBox(height: 10), const SizedBox(height: 10),

View File

@@ -321,7 +321,7 @@ class _TypeWidgetState extends State<TypeWidget> {
child: ListView( child: ListView(
padding: EdgeInsets.only(left: 10, right: 10), padding: EdgeInsets.only(left: 10, right: 10),
children: [ children: [
const SizedBox(height: 8), const SizedBox(height: 5),
LocalTitle(textKey: "box.select_carton_size"), LocalTitle(textKey: "box.select_carton_size"),
const SizedBox(height: 8), const SizedBox(height: 8),
cartonSizedBox, cartonSizedBox,

View File

@@ -221,7 +221,7 @@ class _PackageSelectionWidgetState extends State<PackageSelectionWidget> {
children: [ children: [
const SizedBox(height: 8), const SizedBox(height: 8),
userRow, userRow,
LocalTitle(textKey: "box.select.package", topPadding: 10), LocalTitle(textKey: "box.select.package", topPadding: 5),
const SizedBox(height: 10), const SizedBox(height: 10),
searchBox, searchBox,
Expanded( Expanded(