add carton editor to update

This commit is contained in:
tzw
2024-02-09 17:10:19 +06:30
parent 2d912a20aa
commit a246097d05
9 changed files with 103 additions and 45 deletions

View File

@@ -63,7 +63,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
List<String> _deliveryTypes = [delivery_caton, pickup_carton];
FcsShipment? _shipment;
String _cartionSizeType = standardCarton;
String _cartonSizeType = standardCarton;
List<FcsShipment> _shipments = [];
CartonSize? _selectStandardSize;
@@ -83,34 +83,40 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
_init() async {
_selectedDeliveryType = widget.deliveryType;
_billToValue = widget.billType;
_shipment = widget.shipment;
_cartionSizeType = widget.cartonSizeType;
_cartonSizeType = widget.cartonSizeType;
List<CartonSize> cartonSizes = context.read<CartonSizeModel>().cartonSizes;
_selectStandardSize = widget.standardSize ?? cartonSizes.first;
_lengthController.text =
widget.length == null ? "0" : widget.length.toString();
widget.length == null ? "0" : removeTrailingZeros(widget.length ?? 0);
_widthController.text =
widget.width == null ? "0" : widget.width.toString();
widget.width == null ? "0" : removeTrailingZeros(widget.width ?? 0);
_heightController.text =
widget.height == null ? "0" : widget.height.toString();
widget.height == null ? "0" : removeTrailingZeros(widget.height ?? 0);
var fcsShipments =
await context.read<FcsShipmentModel>().getActiveFcsShipments();
_shipments = fcsShipments;
_shipment = widget.shipment;
if (mounted) {
setState(() {});
}
}
@override
void didUpdateWidget(covariant CartonSizeWidget oldWidget) {
_init();
super.didUpdateWidget(oldWidget);
}
@override
Widget build(BuildContext context) {
List<CartonSize> cartonSizes = context.watch<CartonSizeModel>().cartonSizes;
bool isStandardSize = _cartionSizeType == standardCarton;
bool isCustomSize = _cartionSizeType == customCarton;
bool isNoneDefinedSize = _cartionSizeType == packageCartion;
bool isStandardSize = _cartonSizeType == standardCarton;
bool isCustomSize = _cartonSizeType == customCarton;
bool isNoneDefinedSize = _cartonSizeType == packageCartion;
final senderBox = DisplayText(
text: widget.sender.name,
@@ -242,7 +248,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
if (widget.onContinue != null) {
widget.onContinue!(
_selectedDeliveryType, _billToValue, _shipment!, _cartionSizeType,
_selectedDeliveryType, _billToValue, _shipment!, _cartonSizeType,
standardSize: _selectStandardSize, length: l, width: w, height: h);
}
});
@@ -321,16 +327,16 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
InkWell(
onTap: () {
setState(() {
_cartionSizeType = standardCarton;
_cartonSizeType = standardCarton;
});
},
child: Row(children: <Widget>[
LocalRadio(
value: standardCarton,
groupValue: _cartionSizeType,
groupValue: _cartonSizeType,
onChanged: (p0) {
setState(() {
_cartionSizeType = standardCarton;
_cartonSizeType = standardCarton;
});
},
),
@@ -350,16 +356,16 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
InkWell(
onTap: () {
setState(() {
_cartionSizeType = customCarton;
_cartonSizeType = customCarton;
});
},
child: Row(children: <Widget>[
LocalRadio(
value: customCarton,
groupValue: _cartionSizeType,
groupValue: _cartonSizeType,
onChanged: (p0) {
setState(() {
_cartionSizeType = customCarton;
_cartonSizeType = customCarton;
});
},
),
@@ -379,16 +385,16 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
InkWell(
onTap: () {
setState(() {
_cartionSizeType = packageCartion;
_cartonSizeType = packageCartion;
});
},
child: Row(children: <Widget>[
LocalRadio(
value: packageCartion,
groupValue: _cartionSizeType,
groupValue: _cartonSizeType,
onChanged: (p0) {
setState(() {
_cartionSizeType = packageCartion;
_cartonSizeType = packageCartion;
});
},
),