move bill to to cartion size widget

This commit is contained in:
tzw
2024-02-09 12:16:39 +06:30
parent b2603c02ce
commit 4a9c04ef1e
5 changed files with 100 additions and 88 deletions

View File

@@ -341,7 +341,9 @@
"box.select.cargo_type":"Select surcharge item", "box.select.cargo_type":"Select surcharge item",
"box.surcharge.item":"Surcharge items", "box.surcharge.item":"Surcharge items",
"box.package.count":"Packages ({0})", "box.package.count":"Packages ({0})",
"box.bill_to":"Bill to",
"box.delvery_carton":"Delivery carton",
"box.pick_up_carton":"Pick-up carton",
"Boxes End ================================================================":"", "Boxes End ================================================================":"",
"Delivery Start ================================================================":"", "Delivery Start ================================================================":"",

View File

@@ -340,6 +340,9 @@
"box.select.cargo_type":"Select surcharge item", "box.select.cargo_type":"Select surcharge item",
"box.surcharge.item":"Surcharge items", "box.surcharge.item":"Surcharge items",
"box.package.count":"Packages ({0})", "box.package.count":"Packages ({0})",
"box.bill_to":"Bill to",
"box.delvery_carton":"Delivery carton",
"box.pick_up_carton":"Pick-up carton",
"Boxes End ================================================================":"", "Boxes End ================================================================":"",
"Delivery Start ================================================================":"", "Delivery Start ================================================================":"",

View File

@@ -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/display_text.dart';
import 'package:fcs/pages/widgets/fcs_id_icon.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_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_radio_buttons.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/local_title.dart'; import 'package:fcs/pages/widgets/local_title.dart';
@@ -34,7 +33,6 @@ class _CartonEditorState extends State<CartonEditor> {
bool _isLoading = false; bool _isLoading = false;
bool _isNew = false; bool _isNew = false;
String _billToValue = billToSender;
String? _selectedCartonType; String? _selectedCartonType;
User? _consignee; User? _consignee;
@@ -159,7 +157,7 @@ class _CartonEditorState extends State<CartonEditor> {
builder: (context) => CartonEditorForPackage( builder: (context) => CartonEditorForPackage(
sender: _sender!, sender: _sender!,
consignee: _consignee!, consignee: _consignee!,
billToValue: _billToValue))); )));
} }
// for mix cartion // for mix cartion
else { else {
@@ -169,10 +167,7 @@ class _CartonEditorState extends State<CartonEditor> {
builder: (context) => const MixCartonEditor())); builder: (context) => const MixCartonEditor()));
} }
}, },
child: Icon( child: Icon(Icons.add_circle, color: primaryColor),
Icons.add_circle,
color: primaryColor,
),
), ),
)); ));
@@ -268,72 +263,6 @@ class _CartonEditorState extends State<CartonEditor> {
), ),
); );
final billRadioBox = Container(
child: Row(
children: [
Flexible(
child: InkWell(
onTap: () {
setState(() {
_billToValue = billToSender;
});
},
child: Row(children: <Widget>[
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: <Widget>[
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( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
@@ -358,9 +287,6 @@ class _CartonEditorState extends State<CartonEditor> {
Flexible(child: consigneeBox) Flexible(child: consigneeBox)
], ],
), ),
const SizedBox(height: 5),
billRadioBox,
const SizedBox(height: 5),
], ],
) )
: Container(), : Container(),

View File

@@ -26,9 +26,12 @@ import 'package_selection_widget.dart';
class CartonEditorForPackage extends StatefulWidget { class CartonEditorForPackage extends StatefulWidget {
final User sender; final User sender;
final User consignee; final User consignee;
final String billToValue;
const CartonEditorForPackage( const CartonEditorForPackage(
{Key? key, required this.sender, required this.consignee, required this.billToValue}) {Key? key,
required this.sender,
required this.consignee,
})
: super(key: key); : super(key: key);
@override @override
@@ -54,6 +57,8 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
double _height = 0; double _height = 0;
String _selectedDeliveryType = delivery_caton; String _selectedDeliveryType = delivery_caton;
String _billToValue = billToSender;
FcsShipment? _shipment; FcsShipment? _shipment;
String _cartonSizeType = standardCarton; String _cartonSizeType = standardCarton;
CartonSize? _standardSize; CartonSize? _standardSize;
@@ -131,6 +136,7 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
return Expanded( return Expanded(
child: CartonSizeWidget( child: CartonSizeWidget(
deliveryType: _selectedDeliveryType, deliveryType: _selectedDeliveryType,
billType: _billToValue,
sender: widget.sender, sender: widget.sender,
consignee: widget.consignee, consignee: widget.consignee,
shipment: _shipment, shipment: _shipment,
@@ -142,10 +148,11 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
onPrevious: () { onPrevious: () {
Navigator.pop(context); Navigator.pop(context);
}, },
onContinue: (deliveryType, shipment, cartonSizeType, onContinue: (deliveryType,billType ,shipment, cartonSizeType,
{standardSize, length, width, height}) { {standardSize, length, width, height}) {
setState(() { setState(() {
_selectedDeliveryType = deliveryType; _selectedDeliveryType = deliveryType;
_billToValue = billType;
_shipment = shipment; _shipment = shipment;
_cartonSizeType = cartonSizeType; _cartonSizeType = cartonSizeType;
_standardSize = standardSize; _standardSize = standardSize;
@@ -205,7 +212,7 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
child: CartonSubmit( child: CartonSubmit(
sender: widget.sender, sender: widget.sender,
consingee: widget.consignee, consingee: widget.consignee,
billToValue: widget.billToValue, billToValue: _billToValue,
cartonSizeType: _cartonSizeType, cartonSizeType: _cartonSizeType,
standardSize: _standardSize, standardSize: _standardSize,
length: _length, length: _length,

View File

@@ -21,7 +21,8 @@ import '../widgets/previous_button.dart';
typedef OnPrevious = Function(); 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}); {CartonSize? standardSize, double? length, double? width, double? height});
class CartonSizeWidget extends StatefulWidget { class CartonSizeWidget extends StatefulWidget {
@@ -30,6 +31,7 @@ class CartonSizeWidget extends StatefulWidget {
final User sender; final User sender;
final User consignee; final User consignee;
final String deliveryType; final String deliveryType;
final String billType;
final FcsShipment? shipment; final FcsShipment? shipment;
final String cartonSizeType; final String cartonSizeType;
final CartonSize? standardSize; final CartonSize? standardSize;
@@ -49,7 +51,8 @@ class CartonSizeWidget extends StatefulWidget {
this.height, this.height,
required this.sender, required this.sender,
required this.consignee, required this.consignee,
required this.deliveryType}) required this.deliveryType,
required this.billType})
: super(key: key); : super(key: key);
@override @override
@@ -65,6 +68,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
List<FcsShipment> _shipments = []; List<FcsShipment> _shipments = [];
CartonSize? _selectStandardSize; CartonSize? _selectStandardSize;
late String _selectedDeliveryType; late String _selectedDeliveryType;
late String _billToValue;
TextEditingController _widthController = new TextEditingController(); TextEditingController _widthController = new TextEditingController();
TextEditingController _heightController = new TextEditingController(); TextEditingController _heightController = new TextEditingController();
@@ -78,6 +82,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
_init() async { _init() async {
_selectedDeliveryType = widget.deliveryType; _selectedDeliveryType = widget.deliveryType;
_billToValue = widget.billType;
_shipment = widget.shipment; _shipment = widget.shipment;
_cartionSizeType = widget.cartonSizeType; _cartionSizeType = widget.cartonSizeType;
@@ -142,6 +147,72 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
}); });
}); });
final billRadioBox = Container(
child: Row(
children: [
Flexible(
child: InkWell(
onTap: () {
setState(() {
_billToValue = billToSender;
});
},
child: Row(children: <Widget>[
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: <Widget>[
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: () { final continueBtn = ContinueButton(onTap: () {
double l = double.tryParse(_lengthController.text) ?? 0; double l = double.tryParse(_lengthController.text) ?? 0;
double w = double.tryParse(_widthController.text) ?? 0; double w = double.tryParse(_widthController.text) ?? 0;
@@ -170,7 +241,8 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
} }
if (widget.onContinue != null) { if (widget.onContinue != null) {
widget.onContinue!(_selectedDeliveryType,_shipment!, _cartionSizeType, widget.onContinue!(
_selectedDeliveryType, _billToValue, _shipment!, _cartionSizeType,
standardSize: _selectStandardSize, length: l, width: w, height: h); standardSize: _selectStandardSize, length: l, width: w, height: h);
} }
}); });
@@ -366,7 +438,9 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
children: [ children: [
const SizedBox(height: 8), const SizedBox(height: 8),
userRow, userRow,
LocalTitle(textKey: "box.select.delivery", topPadding: 10), const SizedBox(height: 5),
billRadioBox,
LocalTitle(textKey: "box.select.delivery"),
const SizedBox(height: 5), const SizedBox(height: 5),
deliveryTypeBox, deliveryTypeBox,
const SizedBox(height: 5), const SizedBox(height: 5),