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.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 ================================================================":"",

View File

@@ -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 ================================================================":"",

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/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<CartonEditor> {
bool _isLoading = false;
bool _isNew = false;
String _billToValue = billToSender;
String? _selectedCartonType;
User? _consignee;
@@ -157,9 +155,9 @@ class _CartonEditorState extends State<CartonEditor> {
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<CartonEditor> {
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<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(
inAsyncCall: _isLoading,
child: Scaffold(
@@ -358,9 +287,6 @@ class _CartonEditorState extends State<CartonEditor> {
Flexible(child: consigneeBox)
],
),
const SizedBox(height: 5),
billRadioBox,
const SizedBox(height: 5),
],
)
: Container(),

View File

@@ -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<CartonEditorForPackage> {
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<CartonEditorForPackage> {
return Expanded(
child: CartonSizeWidget(
deliveryType: _selectedDeliveryType,
billType: _billToValue,
sender: widget.sender,
consignee: widget.consignee,
shipment: _shipment,
@@ -142,10 +148,11 @@ class _CartonEditorForPackageState extends State<CartonEditorForPackage> {
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<CartonEditorForPackage> {
child: CartonSubmit(
sender: widget.sender,
consingee: widget.consignee,
billToValue: widget.billToValue,
billToValue: _billToValue,
cartonSizeType: _cartonSizeType,
standardSize: _standardSize,
length: _length,

View File

@@ -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<CartonSizeWidget> {
List<FcsShipment> _shipments = [];
CartonSize? _selectStandardSize;
late String _selectedDeliveryType;
late String _billToValue;
TextEditingController _widthController = new TextEditingController();
TextEditingController _heightController = new TextEditingController();
@@ -78,6 +82,7 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
_init() async {
_selectedDeliveryType = widget.deliveryType;
_billToValue = widget.billType;
_shipment = widget.shipment;
_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: () {
double l = double.tryParse(_lengthController.text) ?? 0;
double w = double.tryParse(_widthController.text) ?? 0;
@@ -170,7 +241,8 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
}
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<CartonSizeWidget> {
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),