prepare carton info

This commit is contained in:
sma
2024-02-09 17:09:05 +06:30
parent 2d912a20aa
commit 02f1954127
3 changed files with 67 additions and 54 deletions

View File

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

View File

@@ -39,47 +39,40 @@ class _CartonImageUploaState extends State<CartonImageUploadEditor> {
labelColor: primaryColor,
arrowColor: primaryColor,
actions: []
// isEdiable
// ? <Widget>[
// IconButton(
// icon: Icon(Icons.edit, color: primaryColor),
// onPressed: _gotoEditor,
// ),
// IconButton(
// icon: Icon(Icons.delete, color: primaryColor),
// onPressed: _delete,
// ),
// ]
// : [],
),
body: ListView(
children: [
Center(
child: Text("${_box?.cartonNumber}",
style: TextStyle(
color: primaryColor,
fontSize: 25,
))),
MultiImageFile(
enabled: true,
controller: multiImgController,
title: "Receipt File",
),
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)),
body:
Padding(padding:EdgeInsets.only(left: 12.0, right: 12),
child: ListView(
children: [
Center(
child: Text("${_box?.cartonNumber}",
style: TextStyle(
color: primaryColor,
fontSize: 25,
))),
MultiImageFile(
enabled: true,
controller: multiImgController,
title: "Receipt File",
),
),
],
)));
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 NumberFormat numberFormatter = NumberFormat("#,###");
MultiImgController multiImgController = MultiImgController();
bool _isLoading = false;
late Carton _carton;
List<CargoType> _cargoTypes = [];
List<CargoType> _surchareItems = [];
List<Carton> _mixCartons = [];
List<Package> _packages = [];
double totalWeight=0.0;
double totalSurchargeCount=0.0;
@override
void initState() {
@@ -52,6 +52,7 @@ class _CartonInfoState extends State<CartonInfo> {
_init() async {
_carton.billTo = billToSender;
_carton.cartonSizeType=standardCarton;
_carton.cartonType = carton_from_packages;
multiImgController.setImageUrls = _carton.photos;
_cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
@@ -71,14 +72,16 @@ class _CartonInfoState extends State<CartonInfo> {
if (mounted) {
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
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(
text: _carton.cartonNumber,
@@ -86,6 +89,11 @@ class _CartonInfoState extends State<CartonInfo> {
);
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(
text: _carton.fcsShipmentNumber,
@@ -93,19 +101,19 @@ class _CartonInfoState extends State<CartonInfo> {
);
final deliveryBox = DisplayText(
text: "Delivery Carton",
text: _carton.deliveryCarton,
labelTextKey: "box.delivery_type",
);
final senderBox = DisplayText(
text: _carton.userName == null ? "" : _carton.userName,
subText: Text(_carton.fcsID ?? "", style: textStyle),
text: _carton.senderName== null ? "" : _carton.senderName,
subText: Text(_carton.senderFCSID?? "", style: textStyle),
labelTextKey: "box.name",
);
final consigneeNameBox = DisplayText(
text: _carton.senderName != null ? _carton.senderName : "",
subText: Text(_carton.senderFCSID ?? "", style: textStyle),
text: _carton.userName != null ? _carton.userName : "",
subText: Text(_carton.fcsID?? "", style: textStyle),
labelTextKey: "processing.consignee.name",
);
@@ -338,14 +346,20 @@ class _CartonInfoState extends State<CartonInfo> {
child: cartonQrBox,
),
]),
Row(children: [Flexible(child: cartonSubTypeBox),],),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: shipmentBox),
Flexible(child: deliveryBox),
_mixCartons.isEmpty
?
Flexible(child: deliveryBox):const SizedBox(),
],
),
userRowBox,
_mixCartons.isEmpty
?
userRowBox:
const SizedBox(),
_packages.isEmpty
? const SizedBox()
: Padding(