update cargo type form from rate, update carton info and form
This commit is contained in:
@@ -31,7 +31,7 @@ class CartonSizeWidget extends StatefulWidget {
|
||||
final OnContinue? onContinue;
|
||||
final User sender;
|
||||
final User consignee;
|
||||
final String deliveryType;
|
||||
final String lastMile;
|
||||
final String billType;
|
||||
final FcsShipment? shipment;
|
||||
final String cartonSizeType;
|
||||
@@ -52,7 +52,7 @@ class CartonSizeWidget extends StatefulWidget {
|
||||
this.height,
|
||||
required this.sender,
|
||||
required this.consignee,
|
||||
required this.deliveryType,
|
||||
required this.lastMile,
|
||||
required this.billType})
|
||||
: super(key: key);
|
||||
|
||||
@@ -68,7 +68,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
|
||||
List<FcsShipment> _shipments = [];
|
||||
CartonSize? _selectStandardSize;
|
||||
late String _selectedDeliveryType;
|
||||
late String _selectedLastmile;
|
||||
late String _billToValue;
|
||||
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
@@ -82,13 +82,10 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
}
|
||||
|
||||
_init() async {
|
||||
_selectedDeliveryType = widget.deliveryType;
|
||||
_selectedLastmile = widget.lastMile;
|
||||
_billToValue = widget.billType;
|
||||
_cartonSizeType = widget.cartonSizeType;
|
||||
|
||||
List<CartonSize> cartonSizes = context.read<CartonSizeModel>().cartonSizes;
|
||||
_selectStandardSize = widget.standardSize ?? cartonSizes.first;
|
||||
|
||||
_lengthController.text =
|
||||
widget.length == null ? "0" : removeTrailingZeros(widget.length ?? 0);
|
||||
_widthController.text =
|
||||
@@ -96,6 +93,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
_heightController.text =
|
||||
widget.height == null ? "0" : removeTrailingZeros(widget.height ?? 0);
|
||||
|
||||
_getStandardCartonSize();
|
||||
_loadShipment();
|
||||
|
||||
if (mounted) {
|
||||
@@ -103,11 +101,24 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
_getStandardCartonSize() {
|
||||
List<CartonSize> cartonSizes = context.read<CartonSizeModel>().cartonSizes;
|
||||
_selectStandardSize = widget.standardSize ?? cartonSizes.first;
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
_loadShipment() async {
|
||||
var fcsShipments =
|
||||
await context.read<FcsShipmentModel>().getActiveFcsShipments();
|
||||
_shipments = fcsShipments;
|
||||
_shipment = widget.shipment;
|
||||
if (_shipments.contains(widget.shipment)) {
|
||||
_shipment = widget.shipment;
|
||||
} else {
|
||||
_shipment = null;
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
@@ -116,6 +127,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
@override
|
||||
void didUpdateWidget(covariant CartonSizeWidget oldWidget) {
|
||||
_loadShipment();
|
||||
_getStandardCartonSize();
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
@@ -125,7 +137,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
context.watch<CartonSizeModel>().getCartonSizes;
|
||||
bool isStandardSize = _cartonSizeType == standardCarton;
|
||||
bool isCustomSize = _cartonSizeType == customCarton;
|
||||
bool isNoneDefinedSize = _cartonSizeType == packageCartion;
|
||||
bool isNoneDefinedSize = _cartonSizeType == packageCarton;
|
||||
|
||||
final senderBox = DisplayText(
|
||||
text: widget.sender.name,
|
||||
@@ -139,7 +151,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
text: widget.consignee.name,
|
||||
labelTextKey: "box.consignee.title",
|
||||
iconData: MaterialCommunityIcons.account_arrow_left,
|
||||
subText: Text(widget.consignee.fcsID!,
|
||||
subText: Text(widget.consignee.fcsID ?? '',
|
||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
||||
);
|
||||
|
||||
@@ -161,16 +173,16 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedDeliveryType = delivery_caton;
|
||||
_selectedLastmile = delivery_caton;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: delivery_caton,
|
||||
groupValue: _selectedDeliveryType,
|
||||
groupValue: _selectedLastmile,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_selectedDeliveryType = delivery_caton;
|
||||
_selectedLastmile = delivery_caton;
|
||||
});
|
||||
},
|
||||
),
|
||||
@@ -179,7 +191,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.delivery',
|
||||
fontSize: 15,
|
||||
color: _selectedDeliveryType == delivery_caton
|
||||
color: _selectedLastmile == delivery_caton
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
@@ -190,16 +202,16 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedDeliveryType = pickup_carton;
|
||||
_selectedLastmile = pickup_carton;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: pickup_carton,
|
||||
groupValue: _selectedDeliveryType,
|
||||
groupValue: _selectedLastmile,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_selectedDeliveryType = pickup_carton;
|
||||
_selectedLastmile = pickup_carton;
|
||||
});
|
||||
},
|
||||
),
|
||||
@@ -208,7 +220,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.pickup',
|
||||
fontSize: 15,
|
||||
color: _selectedDeliveryType == pickup_carton
|
||||
color: _selectedLastmile == pickup_carton
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
@@ -315,7 +327,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
|
||||
if (widget.onContinue != null) {
|
||||
widget.onContinue!(
|
||||
_selectedDeliveryType, _billToValue, _shipment!, _cartonSizeType,
|
||||
_selectedLastmile, _billToValue, _shipment!, _cartonSizeType,
|
||||
standardSize: _selectStandardSize, length: l, width: w, height: h);
|
||||
}
|
||||
});
|
||||
@@ -463,16 +475,16 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_cartonSizeType = packageCartion;
|
||||
_cartonSizeType = packageCarton;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: packageCartion,
|
||||
value: packageCarton,
|
||||
groupValue: _cartonSizeType,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_cartonSizeType = packageCartion;
|
||||
_cartonSizeType = packageCarton;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user