This commit is contained in:
tzw
2024-02-09 17:11:03 +06:30
3 changed files with 67 additions and 54 deletions

View File

@@ -36,8 +36,10 @@ class Carton {
String? mixCartonNumber; String? mixCartonNumber;
String? cartonSizeID; String? cartonSizeID;
String? cartonSizeName; String? cartonSizeName;
String? cartonSizeType;
String? cartonStandardSize;
double cartonWeight; double cartonWeight;
String? billTo; String? billTo;
bool isSelected; bool isSelected;
int rate; int rate;
@@ -49,6 +51,7 @@ class Carton {
String? remark; String? remark;
DateTime? arrivedDate; DateTime? arrivedDate;
String? cartonNumber; String? cartonNumber;
String? deliveryCarton;
List<String> packageIDs; List<String> packageIDs;
List<Package> packages; List<Package> packages;
@@ -159,6 +162,9 @@ class Carton {
this.deliveryAddress, this.deliveryAddress,
this.cartonSizeID, this.cartonSizeID,
this.cartonSizeName, this.cartonSizeName,
this.cartonSizeType,
this.cartonStandardSize,
this.deliveryCarton,
this.mixBoxType, this.mixBoxType,
this.mixCartons = const [], this.mixCartons = const [],
this.mixCartonIDs = const [], this.mixCartonIDs = const [],

View File

@@ -39,47 +39,40 @@ class _CartonImageUploaState extends State<CartonImageUploadEditor> {
labelColor: primaryColor, labelColor: primaryColor,
arrowColor: primaryColor, arrowColor: primaryColor,
actions: [] actions: []
// isEdiable
// ? <Widget>[
// IconButton(
// icon: Icon(Icons.edit, color: primaryColor),
// onPressed: _gotoEditor,
// ),
// IconButton(
// icon: Icon(Icons.delete, color: primaryColor),
// onPressed: _delete,
// ),
// ]
// : [],
), ),
body: ListView( body:
children: [ Padding(padding:EdgeInsets.only(left: 12.0, right: 12),
Center( child: ListView(
child: Text("${_box?.cartonNumber}", children: [
style: TextStyle( Center(
color: primaryColor, child: Text("${_box?.cartonNumber}",
fontSize: 25, style: TextStyle(
))), color: primaryColor,
MultiImageFile( fontSize: 25,
enabled: true, ))),
controller: multiImgController,
title: "Receipt File", MultiImageFile(
), enabled: true,
Center( controller: multiImgController,
child: ElevatedButton( title: "Receipt File",
style: ElevatedButton.styleFrom(
backgroundColor: Color(0xff272262),
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
minimumSize: Size(300, 45), //////// HERE
),
onPressed: () {},
child:
const Text('Save', style: TextStyle(fontSize: 20)),
), ),
), Center(
], child: ElevatedButton(
))); style: ElevatedButton.styleFrom(
backgroundColor: Color(0xff272262),
elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0)),
minimumSize: Size(300, 45), //////// HERE
),
onPressed: () {},
child:
const Text('Save', style: TextStyle(fontSize: 20)),
),
),
],
),
)));
} }
} }

View File

@@ -34,14 +34,14 @@ class _CartonInfoState extends State<CartonInfo> {
final DateFormat dateFormat = DateFormat("d MMM yyyy"); final DateFormat dateFormat = DateFormat("d MMM yyyy");
final NumberFormat numberFormatter = NumberFormat("#,###"); final NumberFormat numberFormatter = NumberFormat("#,###");
MultiImgController multiImgController = MultiImgController(); MultiImgController multiImgController = MultiImgController();
bool _isLoading = false; bool _isLoading = false;
late Carton _carton; late Carton _carton;
List<CargoType> _cargoTypes = []; List<CargoType> _cargoTypes = [];
List<CargoType> _surchareItems = []; List<CargoType> _surchareItems = [];
List<Carton> _mixCartons = []; List<Carton> _mixCartons = [];
List<Package> _packages = []; List<Package> _packages = [];
double totalWeight=0.0;
double totalSurchargeCount=0.0;
@override @override
void initState() { void initState() {
@@ -52,6 +52,7 @@ class _CartonInfoState extends State<CartonInfo> {
_init() async { _init() async {
_carton.billTo = billToSender; _carton.billTo = billToSender;
_carton.cartonSizeType=standardCarton;
_carton.cartonType = carton_from_packages; _carton.cartonType = carton_from_packages;
multiImgController.setImageUrls = _carton.photos; multiImgController.setImageUrls = _carton.photos;
_cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList(); _cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
@@ -71,14 +72,16 @@ class _CartonInfoState extends State<CartonInfo> {
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);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double totalWeight =
_carton.cargoTypes.fold(0, (sum, value) => sum + value.weight);
double totalSurchargeCount =
_surchareItems.fold(0, (sum, value) => sum + value.qty);
final cartonTypeBox = DisplayText( final cartonTypeBox = DisplayText(
text: _carton.cartonNumber, text: _carton.cartonNumber,
@@ -86,6 +89,11 @@ class _CartonInfoState extends State<CartonInfo> {
); );
final cartonQrBox = DisplayText(iconData: AntDesign.qrcode); final cartonQrBox = DisplayText(iconData: AntDesign.qrcode);
final cartonSubTypeBox = DisplayText(
text: _carton.cartonType==carton_from_packages ? "Carton for packages":"Mix carton",
subText:Text( "${_carton.cartonStandardSize}"),
labelTextKey: "box.carton.type",
);
final shipmentBox = DisplayText( final shipmentBox = DisplayText(
text: _carton.fcsShipmentNumber, text: _carton.fcsShipmentNumber,
@@ -93,19 +101,19 @@ class _CartonInfoState extends State<CartonInfo> {
); );
final deliveryBox = DisplayText( final deliveryBox = DisplayText(
text: "Delivery Carton", text: _carton.deliveryCarton,
labelTextKey: "box.delivery_type", labelTextKey: "box.delivery_type",
); );
final senderBox = DisplayText( final senderBox = DisplayText(
text: _carton.userName == null ? "" : _carton.userName, text: _carton.senderName== null ? "" : _carton.senderName,
subText: Text(_carton.fcsID ?? "", style: textStyle), subText: Text(_carton.senderFCSID?? "", style: textStyle),
labelTextKey: "box.name", labelTextKey: "box.name",
); );
final consigneeNameBox = DisplayText( final consigneeNameBox = DisplayText(
text: _carton.senderName != null ? _carton.senderName : "", text: _carton.userName != null ? _carton.userName : "",
subText: Text(_carton.senderFCSID ?? "", style: textStyle), subText: Text(_carton.fcsID?? "", style: textStyle),
labelTextKey: "processing.consignee.name", labelTextKey: "processing.consignee.name",
); );
@@ -338,14 +346,20 @@ class _CartonInfoState extends State<CartonInfo> {
child: cartonQrBox, child: cartonQrBox,
), ),
]), ]),
Row(children: [Flexible(child: cartonSubTypeBox),],),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Flexible(child: shipmentBox), Flexible(child: shipmentBox),
Flexible(child: deliveryBox), _mixCartons.isEmpty
?
Flexible(child: deliveryBox):const SizedBox(),
], ],
), ),
userRowBox, _mixCartons.isEmpty
?
userRowBox:
const SizedBox(),
_packages.isEmpty _packages.isEmpty
? const SizedBox() ? const SizedBox()
: Padding( : Padding(