update crgo type input for carton

This commit is contained in:
tzw
2025-03-24 18:23:17 +06:30
parent 9371c6b1a3
commit 3d4bc43de4
4 changed files with 321 additions and 290 deletions

View File

@@ -168,7 +168,7 @@ class Carton {
var _types = cargoTypes.where((t) => t.weight != 0).toList(); var _types = cargoTypes.where((t) => t.weight != 0).toList();
var _cargoTypes = _types.map((c) => c.toMapForCarton()).toList(); var _cargoTypes = _types.map((c) => c.toMapForCarton()).toList();
var _packagesIds = packages.map((c) => c.id).toList(); // var _packagesIds = packages.map((c) => c.id).toList();
var _surchareItems = var _surchareItems =
surchareItems.map((c) => c.toMapForSurcharge()).toList(); surchareItems.map((c) => c.toMapForSurcharge()).toList();
@@ -184,7 +184,7 @@ class Carton {
'length': length, 'length': length,
'width': width, 'width': width,
'height': height, 'height': height,
'package_ids': _packagesIds, // 'package_ids': _packagesIds,
'cargo_types': _cargoTypes, 'cargo_types': _cargoTypes,
'surcharge_items': _surchareItems, 'surcharge_items': _surchareItems,
}; };

View File

@@ -47,14 +47,18 @@ class _CargoWidgetState extends State<CargoWidget> {
List<CargoType> _cargoTypes = []; List<CargoType> _cargoTypes = [];
List<CargoType> _surchareItems = []; List<CargoType> _surchareItems = [];
TextEditingController totalCtl = TextEditingController(); TextEditingController totalCtl = TextEditingController();
List<TextEditingController> cargoTypeControllers = []; List<TextEditingController> cargoTypeControllers = [];
List<TextEditingController> surchargeControllers = []; List<TextEditingController> surchargeControllers = [];
List<CargoType> _mixCargoTypes = []; bool get hasValueTotalWeight =>
List<TextEditingController> mixCargoTypeControllers = [];
bool get isKnownTotalWeight =>
totalCtl.text.isNotEmpty && totalCtl.text != '0'; totalCtl.text.isNotEmpty && totalCtl.text != '0';
bool get hasValueCargoes =>
_cargoTypes.isNotEmpty && _cargoTypes.every((e) => e.weight != 0);
double get actualTotalWeight =>
_cargoTypes.fold(0, (sum, value) => sum + value.weight);
String? error;
@override @override
void initState() { void initState() {
@@ -63,25 +67,16 @@ class _CargoWidgetState extends State<CargoWidget> {
} }
_init() { _init() {
totalCtl.addListener(totalInputChangeListener);
// for cargo types // for cargo types
if (widget.cargoTypes.isNotEmpty) { if (widget.cargoTypes.isNotEmpty) {
List<CargoType> allCargoes = List.from(widget.cargoTypes); _cargoTypes = List.from(widget.cargoTypes);
_cargoTypes = allCargoes.where((e) => !e.isMixCargo).toList();
for (var e in _cargoTypes) { for (var e in _cargoTypes) {
var editor = TextEditingController(); var editor = TextEditingController();
editor.text = removeTrailingZeros(e.weight); editor.text = removeTrailingZeros(e.weight);
editor.addListener(inputChangeListener); editor.addListener(inputChangeListener);
cargoTypeControllers.add(editor); cargoTypeControllers.add(editor);
} }
_mixCargoTypes = allCargoes.where((e) => e.isMixCargo).toList(); onUpdated();
for (var e in _mixCargoTypes) {
var editor = TextEditingController();
editor.text = removeTrailingZeros(e.weight);
editor.addListener(inputChangeListener);
mixCargoTypeControllers.add(editor);
}
_calculateTotalWeght();
} else { } else {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
_openCargoTypeSelection(); _openCargoTypeSelection();
@@ -94,7 +89,7 @@ class _CargoWidgetState extends State<CargoWidget> {
for (var e in _surchareItems) { for (var e in _surchareItems) {
var editor = TextEditingController(); var editor = TextEditingController();
editor.text = e.qty.toString(); editor.text = e.qty.toString();
editor.addListener(inputChangeListenerForSurchage); editor.addListener(inputChangeListener);
surchargeControllers.add(editor); surchargeControllers.add(editor);
} }
} }
@@ -104,21 +99,12 @@ class _CargoWidgetState extends State<CargoWidget> {
} }
} }
totalInputChangeListener() {
print("Listen isKnownTotalWeight:$isKnownTotalWeight");
setState(() {});
}
inputChangeListenerForSurchage() {
setState(() {});
}
_openCargoTypeSelection() async { _openCargoTypeSelection() async {
List<CargoType>? cargoes = await showDialog( List<CargoType>? cargoes = await showDialog(
context: context, builder: (_) => const CargoTypeAdditionDialog()); context: context, builder: (_) => const CargoTypeAdditionDialog());
if (cargoes == null) return; if (cargoes == null) return;
_cargoTypes = cargoes.where((e) => !e.isMixCargo).toList(); _cargoTypes = cargoes;
_mixCargoTypes = cargoes.where((e) => e.isMixCargo).toList(); _cargoTypes.sort((a, b) => (a == b ? 0 : (a.isMixCargo ? 1 : -1)));
for (var e in _cargoTypes) { for (var e in _cargoTypes) {
var editor = TextEditingController(); var editor = TextEditingController();
@@ -127,63 +113,60 @@ class _CargoWidgetState extends State<CargoWidget> {
cargoTypeControllers.add(editor); cargoTypeControllers.add(editor);
} }
for (var e in _mixCargoTypes) {
var editor = TextEditingController();
editor.text = '0';
editor.addListener(inputChangeListener);
mixCargoTypeControllers.add(editor);
}
_calculateTotalWeght();
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
} }
} }
_calculateTotalWeght() {
print("_calculateTotalWeght isKnownTotalWeight:$isKnownTotalWeight");
double notMixTotal =
_cargoTypes.fold(0, (sum, value) => sum + value.weight);
double mixTotal =
_mixCargoTypes.fold(0, (sum, value) => sum + value.weight);
double total = notMixTotal + mixTotal;
if (isKnownTotalWeight) {
} else {
totalCtl.text = removeTrailingZeros(total);
}
}
// bool isFieldEmpty(int index) {
// return cargoTypeControllers[index].text.isEmpty;
// }
// List<int> getEmptyFields() {
// List<int> emptyFields = [];
// for (int i = 0; i < cargoTypeControllers.length; i++) {
// if (isFieldEmpty(i)) {
// emptyFields.add(i);
// }
// }
// return emptyFields;
// }
inputChangeListener() { inputChangeListener() {
setState(() {});
}
List<int> getEmptyFields() {
List<int> emptyFields = [];
for (int i = 0; i < cargoTypeControllers.length; i++) {
if (cargoTypeControllers[i].text.trim().isEmpty ||
cargoTypeControllers[i].text.trim() == "0") {
emptyFields.add(i);
}
}
return emptyFields;
}
void onUpdated() {
if (!hasValueTotalWeight && hasValueCargoes) {
totalCtl.text = removeTrailingZeros(actualTotalWeight);
error = null;
} else {
// auto populate remaining value
double totalWeight = (double.tryParse(totalCtl.text) ?? 0);
if (actualTotalWeight > totalWeight) {
error = "Exceed total weight";
} else {
error = null;
double remainingWeight =
(totalWeight - actualTotalWeight).clamp(0, totalWeight);
List<int> emptyFieldIndexes = getEmptyFields();
if (emptyFieldIndexes.isNotEmpty) {
if (emptyFieldIndexes.length == 1) {
_cargoTypes.asMap().entries.forEach((e) { _cargoTypes.asMap().entries.forEach((e) {
_cargoTypes[e.key].weight = if (e.value.weight == 0) {
double.tryParse(cargoTypeControllers[e.key].text) ?? 0; e.value.weight = remainingWeight;
}); cargoTypeControllers[e.key].text =
_mixCargoTypes.asMap().entries.forEach((e) { removeTrailingZeros(e.value.weight);
_mixCargoTypes[e.key].weight = }
double.tryParse(mixCargoTypeControllers[e.key].text) ?? 0;
});
double notMixTotal =
_cargoTypes.fold(0, (sum, value) => sum + value.weight);
double mixTotal =
_mixCargoTypes.fold(0, (sum, value) => sum + value.weight);
double total = notMixTotal + mixTotal;
setState(() {
totalCtl.text = removeTrailingZeros(total);
}); });
} }
}
}
}
if (mounted) {
setState(() {});
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -218,35 +201,29 @@ class _CargoWidgetState extends State<CargoWidget> {
color: primaryColor, color: primaryColor,
), ),
onPressed: () async { onPressed: () async {
List<CargoType> allCargoTypes = _cargoTypes + _mixCargoTypes;
CargoType? cargoType = await Navigator.push( CargoType? cargoType = await Navigator.push(
context, context,
CupertinoPageRoute( CupertinoPageRoute(
builder: (context) => builder: (context) =>
CargoTypeAddition(cargoTypes: allCargoTypes))); CargoTypeAddition(cargoTypes: _cargoTypes)));
if (cargoType == null) return; if (cargoType == null) return;
if (cargoType.isMixCargo) {
_mixCargoTypes.add(cargoType);
mixCargoTypeControllers.clear();
for (var e in _mixCargoTypes) { if (!cargoType.isMixCargo) {
var editor = TextEditingController();
editor.text = removeTrailingZeros(e.weight);
editor.addListener(inputChangeListener);
mixCargoTypeControllers.add(editor);
}
} else {
_cargoTypes.add(cargoType); _cargoTypes.add(cargoType);
cargoTypeControllers.clear(); }
_cargoTypes.sort((a, b) => (a == b ? 0 : (a.isMixCargo ? 1 : -1)));
if (cargoType.isMixCargo) {
_cargoTypes.add(cargoType);
}
cargoTypeControllers.clear();
for (var e in _cargoTypes) { for (var e in _cargoTypes) {
var editor = TextEditingController(); var editor = TextEditingController();
editor.text = removeTrailingZeros(e.weight); editor.text = removeTrailingZeros(e.weight);
editor.addListener(inputChangeListener); editor.addListener(inputChangeListener);
cargoTypeControllers.add(editor); cargoTypeControllers.add(editor);
} }
}
_calculateTotalWeght();
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
} }
@@ -254,34 +231,34 @@ class _CargoWidgetState extends State<CargoWidget> {
); );
final cargosBox = Padding( final cargosBox = Padding(
padding: const EdgeInsets.only(top: 10), padding: const EdgeInsets.only(top: 5),
child: Wrap( child: Wrap(
alignment: WrapAlignment.spaceBetween, alignment: WrapAlignment.spaceBetween,
runSpacing: 15, runSpacing: 25,
children: _cargoTypes.asMap().entries.map((e) { children: _cargoTypes.asMap().entries.map((e) {
var key = e.key; var key = e.key;
var c = e.value; var c = e.value;
return SizedBox( return SizedBox(
width: MediaQuery.of(context).size.width / 2.3, width: MediaQuery.of(context).size.width / 2.3,
child: Row( child: Column(
children: [
Row(
children: [ children: [
InkResponse( InkResponse(
radius: 23, radius: 25,
onTap: () { onTap: () {
_cargoTypes.removeAt(key);
double totalWeight = double totalWeight =
double.tryParse(totalCtl.text) ?? 0; double.tryParse(totalCtl.text) ?? 0;
double removeWeight =
(double.tryParse(cargoTypeControllers[key].text) ??
0);
if (totalWeight >= removeWeight) { if (actualTotalWeight > totalWeight) {
double result = totalWeight - removeWeight; error = "Exceed total weight";
} else {
double result = totalWeight - c.weight;
totalCtl.text = removeTrailingZeros(result); totalCtl.text = removeTrailingZeros(result);
} }
cargoTypeControllers[key].clear(); _cargoTypes.removeAt(key);
cargoTypeControllers.removeAt(key);
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
@@ -293,66 +270,36 @@ class _CargoWidgetState extends State<CargoWidget> {
child: inputTextFieldWidget(context, child: inputTextFieldWidget(context,
lableText: c.name ?? "", lableText: c.name ?? "",
controller: cargoTypeControllers[key], controller: cargoTypeControllers[key],
onFieldSubmitted: (value) {
_cargoTypes[e.key].weight =
double.tryParse(value) ?? 0;
onUpdated();
},
suffixIcon: InkResponse( suffixIcon: InkResponse(
radius: 23,
onTap: () {},
child: Icon(Ionicons.md_refresh_circle,
color: labelColor))),
),
],
),
);
}).toList()),
);
final mixCargosBox = Wrap(
alignment: WrapAlignment.spaceBetween,
runSpacing: 15,
children: _mixCargoTypes.asMap().entries.map((e) {
var key = e.key;
var c = e.value;
return SizedBox(
width: MediaQuery.of(context).size.width / 2.3,
child: Column(
children: [
Row(
children: [
InkResponse(
radius: 23, radius: 23,
onTap: () { onTap: () {
_mixCargoTypes.removeAt(key);
double totalWeight = double totalWeight =
double.tryParse(totalCtl.text) ?? 0; (double.tryParse(totalCtl.text) ?? 0);
double removeWeight = (double.tryParse(
mixCargoTypeControllers[key].text) ??
0);
if (totalWeight >= removeWeight) { var list = _cargoTypes
double result = totalWeight - removeWeight; .where((e) => e.id != c.id)
totalCtl.text = removeTrailingZeros(result); .toList();
} double resetValue = totalWeight -
(list.fold(0,
(sum, value) => sum + value.weight));
setState(() {
e.value.weight = resetValue;
cargoTypeControllers[e.key].text =
removeTrailingZeros(resetValue);
});
mixCargoTypeControllers[key].clear(); onUpdated();
if (mounted) {
setState(() {});
}
}, },
child: Icon(Feather.minus_circle,
color: labelColor, size: 20)),
const SizedBox(width: 10),
Flexible(
child: inputTextFieldWidget(context,
lableText: c.name ?? "",
controller: mixCargoTypeControllers[key],
suffixIcon: InkResponse(
radius: 23,
onTap: () {},
child: Icon(Ionicons.md_refresh_circle, child: Icon(Ionicons.md_refresh_circle,
color: labelColor, size: 22))), color: labelColor, size: 22))),
), ),
InkResponse( c.isMixCargo
? InkResponse(
radius: 23, radius: 23,
onTap: () async { onTap: () async {
List<CargoType>? cargoes = await showDialog( List<CargoType>? cargoes = await showDialog(
@@ -364,8 +311,9 @@ class _CargoWidgetState extends State<CargoWidget> {
c.mixCargoes = List.from(cargoes); c.mixCargoes = List.from(cargoes);
}); });
}, },
child: child: Icon(Icons.add_circle,
Icon(Icons.add_circle, color: labelColor, size: 22)) color: labelColor, size: 22))
: const SizedBox()
], ],
), ),
c.mixCargoes.isEmpty c.mixCargoes.isEmpty
@@ -400,7 +348,8 @@ class _CargoWidgetState extends State<CargoWidget> {
], ],
), ),
); );
}).toList()); }).toList()),
);
final totalWeightBox = Row( final totalWeightBox = Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@@ -421,33 +370,33 @@ class _CargoWidgetState extends State<CargoWidget> {
Flexible( Flexible(
child: inputTextFieldWidget(context, child: inputTextFieldWidget(context,
lableText: "Total", lableText: "Total",
controller: totalCtl, controller: totalCtl, onFieldSubmitted: (neValue) {
// onChanged: (neValue) { if (hasValueCargoes) {
// List<int> emptyFields = getEmptyFields(); double totalWeight = double.tryParse(neValue) ?? 0;
// if (emptyFields.length == 1) { if (totalWeight < actualTotalWeight) {
// double totalWeight = double.tryParse(neValue) ?? 0; setState(() {
error = "Invalid total weight";
// _cargoTypes.asMap().entries.forEach((e) { });
// _cargoTypes[e.key].weight = } else {
// double.tryParse(cargoTypeControllers[e.key].text) ?? setState(() {
// 0; error = null;
// }); });
// double result = _cargoTypes.fold( }
// 0, (sum, value) => sum + value.weight); } else {
onUpdated();
// if (totalWeight >= result) { }
// double remaining = totalWeight - result; },
// setState(() {
// cargoTypeControllers[emptyFields.first].text =
// removeTrailingZeros(remaining);
// });
// }
// }
// },
suffixIcon: InkResponse( suffixIcon: InkResponse(
radius: 23, radius: 23,
onTap: () {
setState(() {
totalCtl.text =
removeTrailingZeros(actualTotalWeight);
error = null;
});
},
child: Icon(Ionicons.md_refresh_circle, child: Icon(Ionicons.md_refresh_circle,
color: labelColor))), color: labelColor, size: 22))),
), ),
], ],
)), )),
@@ -485,10 +434,10 @@ class _CargoWidgetState extends State<CargoWidget> {
); );
final subChargeItemsBox = Padding( final subChargeItemsBox = Padding(
padding: const EdgeInsets.only(top: 10), padding: const EdgeInsets.only(top: 5),
child: Wrap( child: Wrap(
alignment: WrapAlignment.spaceBetween, alignment: WrapAlignment.spaceBetween,
runSpacing: 15, runSpacing: 25,
children: _surchareItems.asMap().entries.map((e) { children: _surchareItems.asMap().entries.map((e) {
var key = e.key; var key = e.key;
var c = e.value; var c = e.value;
@@ -532,18 +481,14 @@ class _CargoWidgetState extends State<CargoWidget> {
context, "Error", "Please insert surcharge item quantity"); context, "Error", "Please insert surcharge item quantity");
return; return;
} }
widget.onContinue!(_cargoTypes, _surchareItems);
var allCargoes = _cargoTypes + _mixCargoTypes;
widget.onContinue!(allCargoes, _surchareItems);
} }
}, },
); );
final previousBtn = PreviousButton(onTap: () { final previousBtn = PreviousButton(onTap: () {
if (widget.onPrevious != null) { if (widget.onPrevious != null) {
var allCargoes = _cargoTypes + _mixCargoTypes; widget.onPrevious!(_cargoTypes, _surchareItems);
widget.onPrevious!(allCargoes, _surchareItems);
} }
}); });
@@ -558,18 +503,15 @@ class _CargoWidgetState extends State<CargoWidget> {
userRow, userRow,
cargoTitle, cargoTitle,
cargosBox, cargosBox,
_mixCargoTypes.isNotEmpty && _cargoTypes.isNotEmpty const SizedBox(height: 15),
? Padding( Divider(),
padding: const EdgeInsets.symmetric( const SizedBox(height: 5),
horizontal: 100, vertical: 25), error != null
child: Divider(color: Colors.grey.shade300), ? Text(
error!,
style: TextStyle(color: dangerColor),
) )
: const SizedBox(), : const SizedBox(),
mixCargosBox,
Padding(
padding: const EdgeInsets.symmetric(vertical: 25),
child: Divider(color: Colors.grey.shade300),
),
totalWeightBox, totalWeightBox,
subchargeItemTitleBox, subchargeItemTitleBox,
subChargeItemsBox, subChargeItemsBox,
@@ -599,6 +541,7 @@ class _CargoWidgetState extends State<CargoWidget> {
{required String lableText, {required String lableText,
TextEditingController? controller, TextEditingController? controller,
Function(String)? onChanged, Function(String)? onChanged,
Function(String)? onFieldSubmitted,
bool readOnly = false, bool readOnly = false,
Widget? suffixIcon}) { Widget? suffixIcon}) {
return TextFormField( return TextFormField(
@@ -607,6 +550,7 @@ class _CargoWidgetState extends State<CargoWidget> {
cursorColor: primaryColor, cursorColor: primaryColor,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
onChanged: onChanged, onChanged: onChanged,
onFieldSubmitted: onFieldSubmitted,
readOnly: readOnly, readOnly: readOnly,
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: suffixIcon, suffixIcon: suffixIcon,

View File

@@ -294,7 +294,7 @@ class _CartonInfoState extends State<CartonInfo> {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 2), padding: const EdgeInsets.symmetric(vertical: 2),
child: Container( child: Container(
color: e.key.isEven ? Colors.grey.shade300 : oddColor, color: e.key.isEven ? Colors.grey.shade200 : oddColor,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -325,7 +325,9 @@ class _CartonInfoState extends State<CartonInfo> {
vertical: 2), vertical: 2),
child: Text( child: Text(
"- ${c.name}", "- ${c.name}",
style: TextStyle(fontSize: 14), style: TextStyle(
fontSize: 14,
color: labelColor),
), ),
); );
}).toList()), }).toList()),
@@ -357,7 +359,7 @@ class _CartonInfoState extends State<CartonInfo> {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 2), padding: const EdgeInsets.symmetric(vertical: 2),
child: Container( child: Container(
color: e.key.isEven ? Colors.grey.shade300 : oddColor, color: e.key.isEven ? Colors.grey.shade200 : oddColor,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [

View File

@@ -264,37 +264,120 @@ class CartonSubmit extends StatelessWidget {
children: cargoTypes.map((e) { children: cargoTypes.map((e) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 3), padding: const EdgeInsets.symmetric(vertical: 3),
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
e.name ?? "", e.name ?? "",
style: style: TextStyle(
TextStyle(color: Colors.black, fontSize: 15), color: Colors.black, fontSize: 15),
), ),
Text("${removeTrailingZeros(e.weight)} lb", Text("${removeTrailingZeros(e.weight)} lb",
style: TextStyle( style: TextStyle(
color: Colors.black, fontSize: 15)) color: Colors.black, fontSize: 15))
], ],
), ),
e.isMixCargo
? Padding(
padding: const EdgeInsets.only(left: 20),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: e.mixCargoes.map((c) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 2),
child: Text(
"- ${c.name}",
style: TextStyle(
fontSize: 14,
color: labelColor),
),
); );
}).toList()), }).toList()),
const SizedBox(height: 10), )
: const SizedBox()
],
),
);
}).toList()),
// const SizedBox(height: 10),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: surchareItems.map((e) {
// return Padding(
// padding: const EdgeInsets.symmetric(vertical: 3),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// e.name ?? "",
// style: TextStyle(color: labelColor, fontSize: 15),
// ),
// Text("${numberFormatter.format(e.qty)} pc",
// style:
// TextStyle(color: labelColor, fontSize: 15))
// ],
// ),
// );
// }).toList()),
],
),
),
),
]),
);
final surChargeItemsBox = Padding(
padding: const EdgeInsets.only(top: 10),
child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
Padding(
padding: const EdgeInsets.only(left: 5, bottom: 5, right: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocalText(context, 'box.input_surcharge_item',
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.normal),
],
),
),
Container(
decoration: BoxDecoration(
border: Border.all(color: primaryColor),
borderRadius: BorderRadius.circular(5),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: surchareItems.map((e) { children: surchareItems.map((e) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 3), padding: const EdgeInsets.symmetric(vertical: 3),
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
e.name ?? "", e.name ?? "",
style: TextStyle(color: labelColor, fontSize: 15), style: TextStyle(
color: Colors.black, fontSize: 15),
),
Text(
"${removeTrailingZeros((e.qty).toDouble())} pc",
textAlign: TextAlign.end,
style: TextStyle(
color: Colors.black, fontSize: 15))
],
), ),
Text("${numberFormatter.format(e.qty)} pc",
style:
TextStyle(color: labelColor, fontSize: 15))
], ],
), ),
); );
@@ -368,6 +451,8 @@ class CartonSubmit extends StatelessWidget {
packages.isNotEmpty ? packagesBox : const SizedBox(), packages.isNotEmpty ? packagesBox : const SizedBox(),
const SizedBox(height: 10), const SizedBox(height: 10),
cargosBox, cargosBox,
const SizedBox(height: 10),
surChargeItemsBox,
const SizedBox(height: 20), const SizedBox(height: 20),
], ],
), ),