update pages for carton
This commit is contained in:
@@ -14,7 +14,6 @@ import '../fcs_shipment/model/fcs_shipment_model.dart';
|
||||
import '../main/util.dart';
|
||||
import '../widgets/box_size_picker.dart';
|
||||
import '../widgets/continue_button.dart';
|
||||
import '../widgets/display_text.dart';
|
||||
import '../widgets/local_dropdown.dart';
|
||||
import '../widgets/local_text.dart';
|
||||
import '../widgets/local_title.dart';
|
||||
@@ -41,7 +40,7 @@ class CartonSizeWidget extends StatefulWidget {
|
||||
final double? height;
|
||||
|
||||
const CartonSizeWidget(
|
||||
{Key? key,
|
||||
{super.key,
|
||||
this.onPrevious,
|
||||
this.onContinue,
|
||||
this.shipment,
|
||||
@@ -53,8 +52,7 @@ class CartonSizeWidget extends StatefulWidget {
|
||||
required this.sender,
|
||||
required this.consignee,
|
||||
required this.lastMile,
|
||||
required this.billType})
|
||||
: super(key: key);
|
||||
required this.billType});
|
||||
|
||||
@override
|
||||
State<CartonSizeWidget> createState() => _CartonSizeWidgetState();
|
||||
@@ -69,9 +67,9 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
late String _selectedLastmile;
|
||||
late String _billToValue;
|
||||
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
TextEditingController _heightController = new TextEditingController();
|
||||
TextEditingController _lengthController = new TextEditingController();
|
||||
TextEditingController widthController = TextEditingController();
|
||||
TextEditingController heightController = TextEditingController();
|
||||
TextEditingController lengthController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -83,15 +81,15 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
_selectedLastmile = widget.lastMile;
|
||||
_billToValue = widget.billType;
|
||||
_cartonSizeType = widget.cartonSizeType;
|
||||
_lengthController.text =
|
||||
lengthController.text =
|
||||
widget.length == null ? "0" : removeTrailingZeros(widget.length ?? 0);
|
||||
_widthController.text =
|
||||
widthController.text =
|
||||
widget.width == null ? "0" : removeTrailingZeros(widget.width ?? 0);
|
||||
_heightController.text =
|
||||
heightController.text =
|
||||
widget.height == null ? "0" : removeTrailingZeros(widget.height ?? 0);
|
||||
|
||||
_getStandardCartonSize();
|
||||
_loadShipment();
|
||||
_loadShipment();
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
@@ -135,169 +133,163 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
bool isCustomSize = _cartonSizeType == customCarton;
|
||||
bool isNoneDefinedSize = _cartonSizeType == packageCarton;
|
||||
|
||||
final senderBox = DisplayText(
|
||||
text: widget.sender.name,
|
||||
labelTextKey: "box.sender.title",
|
||||
iconData: MaterialCommunityIcons.account_arrow_right,
|
||||
subText: Text(widget.sender.fcsID ?? "",
|
||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
||||
);
|
||||
final senderBox = userDisplayBox(context,
|
||||
lableKey: "box.sender.title",
|
||||
icon: MaterialCommunityIcons.account_arrow_right,
|
||||
showLink: false,
|
||||
name: widget.sender.name ?? "",
|
||||
fcsID: widget.sender.fcsID ?? "");
|
||||
|
||||
final consigneeBox = DisplayText(
|
||||
text: widget.consignee.name,
|
||||
labelTextKey: "box.consignee.title",
|
||||
iconData: MaterialCommunityIcons.account_arrow_left,
|
||||
subText: Text(widget.consignee.fcsID ?? '',
|
||||
style: TextStyle(fontSize: 13, color: labelColor)),
|
||||
);
|
||||
final consigneeBox = userDisplayBox(context,
|
||||
showLink: false,
|
||||
lableKey: "box.consignee.title",
|
||||
icon: MaterialCommunityIcons.account_arrow_left,
|
||||
name: widget.consignee.name,
|
||||
fcsID: widget.consignee.fcsID);
|
||||
|
||||
final userRow = Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: senderBox,
|
||||
flex: 2,
|
||||
child: consigneeBox,
|
||||
),
|
||||
Flexible(child: consigneeBox)
|
||||
Flexible(child: senderBox)
|
||||
],
|
||||
);
|
||||
|
||||
final deliveryTypeBox = Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: InkWell(
|
||||
final deliveryTypeBox = Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedLastmile = delivery_caton;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: delivery_caton,
|
||||
groupValue: _selectedLastmile,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_selectedLastmile = delivery_caton;
|
||||
});
|
||||
},
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.delivery',
|
||||
fontSize: 15,
|
||||
color: _selectedLastmile == delivery_caton
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
)
|
||||
]),
|
||||
)),
|
||||
Flexible(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedLastmile = delivery_caton;
|
||||
_selectedLastmile = pickup_carton;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: delivery_caton,
|
||||
value: pickup_carton,
|
||||
groupValue: _selectedLastmile,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_selectedLastmile = delivery_caton;
|
||||
_selectedLastmile = pickup_carton;
|
||||
});
|
||||
},
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.delivery',
|
||||
child: LocalText(context, 'box.pickup',
|
||||
fontSize: 15,
|
||||
color: _selectedLastmile == delivery_caton
|
||||
color: _selectedLastmile == pickup_carton
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
)
|
||||
]),
|
||||
)),
|
||||
Flexible(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedLastmile = pickup_carton;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: pickup_carton,
|
||||
groupValue: _selectedLastmile,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_selectedLastmile = pickup_carton;
|
||||
});
|
||||
},
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.pickup',
|
||||
fontSize: 15,
|
||||
color: _selectedLastmile == pickup_carton
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
||||
final billRadioBox = Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: InkWell(
|
||||
final billRadioBox = Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_billToValue = billToSender;
|
||||
_billToValue = billToConsignee;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: billToSender,
|
||||
value: billToConsignee,
|
||||
groupValue: _billToValue,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_billToValue = billToSender;
|
||||
_billToValue = billToConsignee;
|
||||
});
|
||||
},
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.sender.title',
|
||||
child: LocalText(context, 'box.consignee.title',
|
||||
fontSize: 15,
|
||||
color: _billToValue == billToSender
|
||||
color: _billToValue == billToConsignee
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
)
|
||||
]),
|
||||
)),
|
||||
Flexible(
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_billToValue = billToSender;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: billToSender,
|
||||
groupValue: _billToValue,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_billToValue = billToConsignee;
|
||||
_billToValue = billToSender;
|
||||
});
|
||||
},
|
||||
child: Row(children: <Widget>[
|
||||
LocalRadio(
|
||||
value: billToConsignee,
|
||||
groupValue: _billToValue,
|
||||
onChanged: (p0) {
|
||||
setState(() {
|
||||
_billToValue = billToConsignee;
|
||||
});
|
||||
},
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.consignee.title',
|
||||
fontSize: 15,
|
||||
color: _billToValue == billToConsignee
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Flexible(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: LocalText(context, 'box.sender.title',
|
||||
fontSize: 15,
|
||||
color: _billToValue == billToSender
|
||||
? primaryColor
|
||||
: Colors.black),
|
||||
),
|
||||
)
|
||||
]),
|
||||
)),
|
||||
],
|
||||
);
|
||||
|
||||
final continueBtn = ContinueButton(onTap: () {
|
||||
double l = double.tryParse(_lengthController.text) ?? 0;
|
||||
double w = double.tryParse(_widthController.text) ?? 0;
|
||||
double h = double.tryParse(_heightController.text) ?? 0;
|
||||
double l = double.tryParse(lengthController.text) ?? 0;
|
||||
double w = double.tryParse(widthController.text) ?? 0;
|
||||
double h = double.tryParse(heightController.text) ?? 0;
|
||||
|
||||
if (_shipment == null) {
|
||||
showMsgDialog(context, "Error", "Please select shipment");
|
||||
@@ -382,17 +374,17 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
|
||||
|
||||
final lengthBox = BoxSizePicker(
|
||||
lableKey: 'box.length',
|
||||
controller: _lengthController,
|
||||
controller: lengthController,
|
||||
enable: isCustomSize);
|
||||
|
||||
final widthBox = BoxSizePicker(
|
||||
lableKey: 'box.width',
|
||||
controller: _widthController,
|
||||
controller: widthController,
|
||||
enable: isCustomSize);
|
||||
|
||||
final heightBox = BoxSizePicker(
|
||||
lableKey: 'box.height',
|
||||
controller: _heightController,
|
||||
controller: heightController,
|
||||
enable: isCustomSize);
|
||||
|
||||
final customSizeBox = Padding(
|
||||
|
||||
Reference in New Issue
Block a user