update cartion editor
This commit is contained in:
@@ -17,6 +17,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../domain/entities/carton_size.dart';
|
||||
import '../widgets/local_button.dart';
|
||||
import 'carton_package_editor.dart';
|
||||
import 'mix_carton/mix_carton_editor.dart';
|
||||
@@ -40,8 +41,9 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
List<CargoType> _surchareItems = [];
|
||||
List<Carton> _mixCartons = [];
|
||||
List<Package> _packages = [];
|
||||
double totalWeight=0.0;
|
||||
double totalSurchargeCount=0.0;
|
||||
double totalWeight = 0.0;
|
||||
double totalSurchargeCount = 0.0;
|
||||
CartonSize? standardSize;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -51,13 +53,14 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
}
|
||||
|
||||
_init() async {
|
||||
_carton.billTo = billToSender;
|
||||
_carton.cartonSizeType=standardCarton;
|
||||
_carton.billTo = billToConsignee;
|
||||
_carton.cartonSizeType = customCarton;
|
||||
_carton.cartonType = carton_from_packages;
|
||||
multiImgController.setImageUrls = _carton.photos;
|
||||
_cargoTypes = _carton.cargoTypes.where((e) => !e.isCutomDuty).toList();
|
||||
_surchareItems = _carton.cargoTypes.where((e) => e.isCutomDuty).toList();
|
||||
if (_carton.cartonType == carton_from_packages) {
|
||||
_carton.deliveryType = delivery_caton;
|
||||
_packages = await context
|
||||
.read<PackageModel>()
|
||||
.getPackagesByIds(_carton.packageIDs);
|
||||
@@ -72,16 +75,20 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
_carton.cartonType="Carton for packages";
|
||||
totalWeight =
|
||||
_carton.cartonType = "Carton for packages";
|
||||
totalWeight =
|
||||
_carton.cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
||||
totalSurchargeCount =
|
||||
totalSurchargeCount =
|
||||
_surchareItems.fold(0, (sum, value) => sum + value.qty);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
String? boxDimension = _carton.cartonSizeType == standardCarton
|
||||
? "${standardSize?.name} - ${standardSize?.length.toInt()}”x${standardSize?.width.toInt()}”x${standardSize?.height.toInt()}”"
|
||||
: _carton.cartonSizeType == customCarton
|
||||
? "${_carton.length.toInt()}”x${_carton.width.toInt()}”x${_carton.height.toInt()}”"
|
||||
: null;
|
||||
|
||||
final cartonTypeBox = DisplayText(
|
||||
text: _carton.cartonNumber,
|
||||
@@ -90,8 +97,10 @@ 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}"),
|
||||
text: _carton.cartonType == carton_from_packages
|
||||
? "Carton for packages"
|
||||
: "Mix carton",
|
||||
subText: boxDimension == null ? null : Text("$boxDimension"),
|
||||
labelTextKey: "box.carton.type",
|
||||
);
|
||||
|
||||
@@ -101,19 +110,19 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
);
|
||||
|
||||
final deliveryBox = DisplayText(
|
||||
text: _carton.deliveryCarton,
|
||||
text: _carton.deliveryType,
|
||||
labelTextKey: "box.delivery_type",
|
||||
);
|
||||
|
||||
final senderBox = DisplayText(
|
||||
text: _carton.senderName== null ? "" : _carton.senderName,
|
||||
subText: Text(_carton.senderFCSID?? "", style: textStyle),
|
||||
text: _carton.senderName == null ? "" : _carton.senderName,
|
||||
subText: Text(_carton.senderFCSID ?? "", style: textStyle),
|
||||
labelTextKey: "box.name",
|
||||
);
|
||||
|
||||
final consigneeNameBox = DisplayText(
|
||||
text: _carton.userName != null ? _carton.userName : "",
|
||||
subText: Text(_carton.fcsID?? "", style: textStyle),
|
||||
subText: Text(_carton.fcsID ?? "", style: textStyle),
|
||||
labelTextKey: "processing.consignee.name",
|
||||
);
|
||||
|
||||
@@ -183,7 +192,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||
],
|
||||
),
|
||||
//),
|
||||
Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 100),
|
||||
@@ -346,20 +354,21 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
child: cartonQrBox,
|
||||
),
|
||||
]),
|
||||
Row(children: [Flexible(child: cartonSubTypeBox),],),
|
||||
Row(
|
||||
children: [
|
||||
Flexible(child: cartonSubTypeBox),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(child: shipmentBox),
|
||||
_mixCartons.isEmpty
|
||||
?
|
||||
Flexible(child: deliveryBox):const SizedBox(),
|
||||
? Flexible(child: deliveryBox)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
_mixCartons.isEmpty
|
||||
?
|
||||
userRowBox:
|
||||
const SizedBox(),
|
||||
_mixCartons.isEmpty ? userRowBox : const SizedBox(),
|
||||
_packages.isEmpty
|
||||
? const SizedBox()
|
||||
: Padding(
|
||||
|
||||
Reference in New Issue
Block a user