diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index 84802c6..8442fde 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -341,7 +341,9 @@ "box.select.cargo_type":"Select surcharge item", "box.surcharge.item":"Surcharge items", "box.package.count":"Packages ({0})", - + "box.bill_to":"Bill to", + "box.delvery_carton":"Delivery carton", + "box.pick_up_carton":"Pick-up carton", "Boxes End ================================================================":"", "Delivery Start ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 72df718..c59ed1c 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -340,6 +340,9 @@ "box.select.cargo_type":"Select surcharge item", "box.surcharge.item":"Surcharge items", "box.package.count":"Packages ({0})", + "box.bill_to":"Bill to", + "box.delvery_carton":"Delivery carton", + "box.pick_up_carton":"Pick-up carton", "Boxes End ================================================================":"", "Delivery Start ================================================================":"", diff --git a/lib/pages/carton/carton_editor.dart b/lib/pages/carton/carton_editor.dart index 29840ae..2368710 100644 --- a/lib/pages/carton/carton_editor.dart +++ b/lib/pages/carton/carton_editor.dart @@ -6,7 +6,6 @@ import 'package:fcs/pages/user_search/user_search.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/local_app_bar.dart'; -import 'package:fcs/pages/widgets/local_radio.dart'; import 'package:fcs/pages/widgets/local_radio_buttons.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_title.dart'; @@ -34,7 +33,6 @@ class _CartonEditorState extends State { bool _isLoading = false; bool _isNew = false; - String _billToValue = billToSender; String? _selectedCartonType; User? _consignee; @@ -157,9 +155,9 @@ class _CartonEditorState extends State { context, CupertinoPageRoute( builder: (context) => CartonEditorForPackage( - sender: _sender!, - consignee: _consignee!, - billToValue: _billToValue))); + sender: _sender!, + consignee: _consignee!, + ))); } // for mix cartion else { @@ -169,10 +167,7 @@ class _CartonEditorState extends State { builder: (context) => const MixCartonEditor())); } }, - child: Icon( - Icons.add_circle, - color: primaryColor, - ), + child: Icon(Icons.add_circle, color: primaryColor), ), )); @@ -268,72 +263,6 @@ class _CartonEditorState extends State { ), ); - final billRadioBox = Container( - child: Row( - children: [ - Flexible( - child: InkWell( - onTap: () { - setState(() { - _billToValue = billToSender; - }); - }, - child: Row(children: [ - LocalRadio( - value: billToSender, - groupValue: _billToValue, - onChanged: (p0) { - setState(() { - _billToValue = billToSender; - }); - }, - ), - Flexible( - child: Padding( - padding: const EdgeInsets.only(left: 10), - child: LocalText(context, 'box.bill_to_sender', - fontSize: 15, - color: _billToValue == billToSender - ? primaryColor - : Colors.black), - ), - ) - ]), - )), - Flexible( - child: InkWell( - onTap: () { - setState(() { - _billToValue = billToConsignee; - }); - }, - child: Row(children: [ - LocalRadio( - value: billToConsignee, - groupValue: _billToValue, - onChanged: (p0) { - setState(() { - _billToValue = billToConsignee; - }); - }, - ), - Flexible( - child: Padding( - padding: const EdgeInsets.only(left: 10), - child: LocalText(context, 'box.bill_to.consignee', - fontSize: 15, - color: _billToValue == billToConsignee - ? primaryColor - : Colors.black), - ), - ) - ]), - ), - ) - ], - ), - ); - return LocalProgress( inAsyncCall: _isLoading, child: Scaffold( @@ -358,9 +287,6 @@ class _CartonEditorState extends State { Flexible(child: consigneeBox) ], ), - const SizedBox(height: 5), - billRadioBox, - const SizedBox(height: 5), ], ) : Container(), diff --git a/lib/pages/carton/carton_editor_for_package.dart b/lib/pages/carton/carton_editor_for_package.dart index 60ca750..7f6be13 100644 --- a/lib/pages/carton/carton_editor_for_package.dart +++ b/lib/pages/carton/carton_editor_for_package.dart @@ -26,9 +26,12 @@ import 'package_selection_widget.dart'; class CartonEditorForPackage extends StatefulWidget { final User sender; final User consignee; - final String billToValue; + const CartonEditorForPackage( - {Key? key, required this.sender, required this.consignee, required this.billToValue}) + {Key? key, + required this.sender, + required this.consignee, + }) : super(key: key); @override @@ -54,6 +57,8 @@ class _CartonEditorForPackageState extends State { double _height = 0; String _selectedDeliveryType = delivery_caton; + String _billToValue = billToSender; + FcsShipment? _shipment; String _cartonSizeType = standardCarton; CartonSize? _standardSize; @@ -131,6 +136,7 @@ class _CartonEditorForPackageState extends State { return Expanded( child: CartonSizeWidget( deliveryType: _selectedDeliveryType, + billType: _billToValue, sender: widget.sender, consignee: widget.consignee, shipment: _shipment, @@ -142,10 +148,11 @@ class _CartonEditorForPackageState extends State { onPrevious: () { Navigator.pop(context); }, - onContinue: (deliveryType, shipment, cartonSizeType, + onContinue: (deliveryType,billType ,shipment, cartonSizeType, {standardSize, length, width, height}) { setState(() { _selectedDeliveryType = deliveryType; + _billToValue = billType; _shipment = shipment; _cartonSizeType = cartonSizeType; _standardSize = standardSize; @@ -205,7 +212,7 @@ class _CartonEditorForPackageState extends State { child: CartonSubmit( sender: widget.sender, consingee: widget.consignee, - billToValue: widget.billToValue, + billToValue: _billToValue, cartonSizeType: _cartonSizeType, standardSize: _standardSize, length: _length, diff --git a/lib/pages/carton/carton_size_widget.dart b/lib/pages/carton/carton_size_widget.dart index 50da3fe..8aa89ef 100644 --- a/lib/pages/carton/carton_size_widget.dart +++ b/lib/pages/carton/carton_size_widget.dart @@ -21,7 +21,8 @@ import '../widgets/previous_button.dart'; typedef OnPrevious = Function(); -typedef OnContinue = Function(String deliveryType,FcsShipment shipment, String cartonSizeType, +typedef OnContinue = Function(String deliveryType, String billType, + FcsShipment shipment, String cartonSizeType, {CartonSize? standardSize, double? length, double? width, double? height}); class CartonSizeWidget extends StatefulWidget { @@ -30,6 +31,7 @@ class CartonSizeWidget extends StatefulWidget { final User sender; final User consignee; final String deliveryType; + final String billType; final FcsShipment? shipment; final String cartonSizeType; final CartonSize? standardSize; @@ -49,7 +51,8 @@ class CartonSizeWidget extends StatefulWidget { this.height, required this.sender, required this.consignee, - required this.deliveryType}) + required this.deliveryType, + required this.billType}) : super(key: key); @override @@ -65,6 +68,7 @@ class _CartonSizeWidgetState extends State { List _shipments = []; CartonSize? _selectStandardSize; late String _selectedDeliveryType; + late String _billToValue; TextEditingController _widthController = new TextEditingController(); TextEditingController _heightController = new TextEditingController(); @@ -78,9 +82,10 @@ class _CartonSizeWidgetState extends State { _init() async { _selectedDeliveryType = widget.deliveryType; + _billToValue = widget.billType; _shipment = widget.shipment; _cartionSizeType = widget.cartonSizeType; - + List cartonSizes = context.read().cartonSizes; _selectStandardSize = widget.standardSize ?? cartonSizes.first; @@ -142,6 +147,72 @@ class _CartonSizeWidgetState extends State { }); }); + final billRadioBox = Container( + child: Row( + children: [ + Flexible( + child: InkWell( + onTap: () { + setState(() { + _billToValue = billToSender; + }); + }, + child: Row(children: [ + LocalRadio( + value: billToSender, + groupValue: _billToValue, + onChanged: (p0) { + setState(() { + _billToValue = billToSender; + }); + }, + ), + Flexible( + child: Padding( + padding: const EdgeInsets.only(left: 10), + child: LocalText(context, 'box.bill_to_sender', + fontSize: 15, + color: _billToValue == billToSender + ? primaryColor + : Colors.black), + ), + ) + ]), + )), + Flexible( + child: InkWell( + onTap: () { + setState(() { + _billToValue = billToConsignee; + }); + }, + child: Row(children: [ + LocalRadio( + value: billToConsignee, + groupValue: _billToValue, + onChanged: (p0) { + setState(() { + _billToValue = billToConsignee; + }); + }, + ), + Flexible( + child: Padding( + padding: const EdgeInsets.only(left: 10), + child: LocalText(context, 'box.bill_to.consignee', + fontSize: 15, + color: _billToValue == billToConsignee + ? primaryColor + : Colors.black), + ), + ) + ]), + ), + ) + ], + ), + ); + final continueBtn = ContinueButton(onTap: () { double l = double.tryParse(_lengthController.text) ?? 0; double w = double.tryParse(_widthController.text) ?? 0; @@ -170,7 +241,8 @@ class _CartonSizeWidgetState extends State { } if (widget.onContinue != null) { - widget.onContinue!(_selectedDeliveryType,_shipment!, _cartionSizeType, + widget.onContinue!( + _selectedDeliveryType, _billToValue, _shipment!, _cartionSizeType, standardSize: _selectStandardSize, length: l, width: w, height: h); } }); @@ -366,7 +438,9 @@ class _CartonSizeWidgetState extends State { children: [ const SizedBox(height: 8), userRow, - LocalTitle(textKey: "box.select.delivery", topPadding: 10), + const SizedBox(height: 5), + billRadioBox, + LocalTitle(textKey: "box.select.delivery"), const SizedBox(height: 5), deliveryTypeBox, const SizedBox(height: 5),