update cartion editor for package

This commit is contained in:
tzw
2024-02-06 17:45:36 +06:30
parent 3767ba76dc
commit 3a91b49a1a
10 changed files with 563 additions and 109 deletions

View File

@@ -8,6 +8,7 @@ import '../../../domain/entities/carton.dart';
import '../../../domain/entities/carton_size.dart';
import '../../../domain/entities/fcs_shipment.dart';
import '../../../helpers/theme.dart';
import '../../main/util.dart';
import '../../widgets/local_text.dart';
import '../../widgets/previous_button.dart';
import '../../widgets/submit_text_widget.dart';
@@ -47,6 +48,7 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
final NumberFormat numberFormatter = NumberFormat("#,###");
Map<String?, double> _mapCargosByWeight = {};
Map<String?, double> _mapCargosByCustomDutyFee = {};
double totalWeight = 0;
@override
void initState() {
@@ -69,6 +71,9 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
_mapCargosByWeight[key] = total;
});
totalWeight =
_mapCargosByWeight.entries.fold(0, (sum, value) => sum + value.value);
// get cargos by custom duty fee
Map<String?, List<CargoType>> _cargosByCustomDutyFee =
groupCargos(_cargoTypes.where((e) => e.isCutomDuty).toList());
@@ -104,7 +109,7 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
padding: const EdgeInsets.only(top: 10),
child: SubmitTextWidget(
labelKey: 'box.carton.type',
text: 'Mix Carton',
text: carton_mix_carton,
subText: boxDimension,
),
);
@@ -159,9 +164,18 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
padding: const EdgeInsets.only(top: 10),
child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
Padding(
padding: const EdgeInsets.only(left: 5, bottom: 5),
child: LocalText(context, 'box.cargo.type',
color: primaryColor, fontSize: 16, fontWeight: FontWeight.normal),
padding: const EdgeInsets.only(left: 5, bottom: 5, right: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
LocalText(context, 'box.cargo.type',
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.normal),
Text("${removeTrailingZeros(totalWeight)} lb",
style: TextStyle(color: Colors.black, fontSize: 15))
],
),
),
Container(
decoration: BoxDecoration(
@@ -185,7 +199,7 @@ class _MixCartonSubmitState extends State<MixCartonSubmit> {
style:
TextStyle(color: Colors.black, fontSize: 15),
),
Text("${numberFormatter.format(e.value)} lb",
Text("${removeTrailingZeros(e.value)} lb",
style: TextStyle(
color: Colors.black, fontSize: 15))
],