update carton and cargo type

This commit is contained in:
tzw
2025-03-12 17:49:27 +06:30
parent 05e912ea68
commit e208734dfa
32 changed files with 1141 additions and 462 deletions

View File

@@ -1,3 +1,5 @@
// ignore_for_file: use_build_context_synchronously
import 'package:fcs/constants.dart';
import 'package:fcs/domain/entities/cargo_type.dart';
import 'package:fcs/domain/entities/carton.dart';
@@ -24,12 +26,14 @@ import '../fcs_shipment/model/fcs_shipment_model.dart';
import '../widgets/local_button.dart';
import 'carton_package_editor.dart';
import 'mix_carton/mix_carton_editor.dart';
import 'mix_carton_detail_list.dart';
import 'model/carton_model.dart';
import 'package_detail_list.dart';
import 'print_qr_code_page.dart';
class CartonInfo extends StatefulWidget {
final Carton carton;
CartonInfo({required this.carton});
const CartonInfo({super.key, required this.carton});
@override
_CartonInfoState createState() => _CartonInfoState();
@@ -176,14 +180,28 @@ class _CartonInfoState extends State<CartonInfo> {
showLabelLink: true,
subText: Text(numberFormatter.format(_packages.length)),
labelTextKey: "box.package",
onTapLabel: () {},
onTapLabel: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => PackageDetailList(
cartonNumber: _carton.cartonNumber ?? '',
packages: _packages)));
},
);
final mixCartonLengthBox = DisplayText(
showLabelLink: true,
subText: Text(numberFormatter.format(_mixCartons.length)),
labelTextKey: "box.shipment.boxes",
onTapLabel: () {},
onTapLabel: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => MixCartonDetailList(
cartonNumber: _carton.cartonNumber ?? '',
cartons: _mixCartons)));
},
);
final senderBox = userDisplayBox(context,
@@ -315,18 +333,20 @@ class _CartonInfoState extends State<CartonInfo> {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Container(
color: e.key.isEven ? Colors.grey.shade300 : oddColor,
color: e.key.isEven ? Colors.grey.shade300 : oddColor,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
e.value.name ?? "",
style: TextStyle(color: Colors.black, fontSize: 15),
style:
TextStyle(color: Colors.black, fontSize: 15),
),
Text("${removeTrailingZeros((e.value.qty).toDouble())} pc",
Text(
"${removeTrailingZeros((e.value.qty).toDouble())} pc",
textAlign: TextAlign.end,
style:
TextStyle(color: Colors.black, fontSize: 15))
style: TextStyle(
color: Colors.black, fontSize: 15))
],
),
),
@@ -482,10 +502,16 @@ class _CartonInfoState extends State<CartonInfo> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: cartonSizeBox),
Flexible(child: packageLengthBox),
_packages.isEmpty
? const SizedBox()
: Flexible(child: packageLengthBox),
],
),
fromPackage ? const SizedBox() : mixCartonLengthBox,
fromPackage
? const SizedBox()
: _mixCartons.isEmpty
? const SizedBox()
: mixCartonLengthBox,
shipmentBox,
// _packages.isEmpty
// ? const SizedBox()
@@ -541,9 +567,7 @@ class _CartonInfoState extends State<CartonInfo> {
return list.map((p) {
return Container(
padding: EdgeInsets.only(top: 0),
child: Container(
child: Row(children: <Widget>[new Text(p.trackingID ?? "")]),
));
child: Row(children: <Widget>[Text(p.trackingID ?? "")]));
}).toList();
}
@@ -551,9 +575,7 @@ class _CartonInfoState extends State<CartonInfo> {
return list.map((c) {
return Container(
padding: EdgeInsets.only(top: 0),
child: Container(
child: Row(children: <Widget>[new Text(c.cartonNumber ?? '')]),
));
child: Row(children: <Widget>[Text(c.cartonNumber ?? '')]));
}).toList();
}