update carton info
This commit is contained in:
@@ -60,8 +60,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
bool isFromPackages = false;
|
||||
bool isSmallBag = false;
|
||||
bool isFromCartons = false;
|
||||
bool isEdiable = false;
|
||||
bool isCutomDuty=false;
|
||||
|
||||
bool isCutomDuty = false;
|
||||
final List<CargoType> cargoTypes = [];
|
||||
final List<CargoType> surchareItems = [];
|
||||
final List<Carton> cartons = [];
|
||||
@@ -71,9 +71,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
super.initState();
|
||||
_box = widget.box;
|
||||
_box?.billToValue = "Bill to sender";
|
||||
|
||||
|
||||
|
||||
|
||||
//initPackage(widget.package!);
|
||||
//for shipment weight
|
||||
@@ -100,8 +97,6 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
isSmallBag = _box!.cartonType == carton_small_bag;
|
||||
isFromCartons = _box!.cartonType == carton_from_cartons;
|
||||
|
||||
isEdiable = (isFromPackages || isMixBox || isFromCartons) &&
|
||||
_box!.status == carton_packed_status;
|
||||
selectMixBoxType = _box!.mixBoxType;
|
||||
getCartonSize();
|
||||
}
|
||||
@@ -337,70 +332,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
);
|
||||
final consigneeBox=Container(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
consigneeNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
_cartonSubmit?.billToValue == billToSender
|
||||
? Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 0, top: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Ionicons.document_text_outline,
|
||||
color: primaryColor, size: 20),
|
||||
Text("Bill to",
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontSize: 15))
|
||||
],
|
||||
)))
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
));
|
||||
final customerBox= Container(
|
||||
child: Row(
|
||||
//crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
customerNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
_box?.billToValue == billToSender
|
||||
? Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 0, top: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Ionicons.document_text_outline,
|
||||
color: primaryColor, size: 20),
|
||||
Text("Bill to",
|
||||
style: TextStyle(
|
||||
color: primaryColor, fontSize: 15))
|
||||
],
|
||||
)))
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
final billWidget = Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: 0, top: 15),
|
||||
@@ -418,23 +350,15 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
appBar: LocalAppBar(
|
||||
labelKey: "box.info.title",
|
||||
backgroundColor: Colors.white,
|
||||
labelColor: primaryColor,
|
||||
arrowColor: primaryColor,
|
||||
actions: isEdiable
|
||||
? <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: _gotoEditor,
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, color: primaryColor),
|
||||
onPressed: _delete,
|
||||
),
|
||||
]
|
||||
: [],
|
||||
),
|
||||
labelKey: "box.info.title",
|
||||
backgroundColor: Colors.white,
|
||||
labelColor: primaryColor,
|
||||
arrowColor: primaryColor,
|
||||
actions: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit, color: primaryColor),
|
||||
onPressed: _gotoEditor),
|
||||
]),
|
||||
body: Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
@@ -458,79 +382,81 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
// isMixBox
|
||||
// ?
|
||||
// displayMixBox:Container(),
|
||||
|
||||
isMixBox?
|
||||
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
//crossAxisAlignment: CrossAxisAlignment.start,
|
||||
isMixBox
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
child: Row(
|
||||
//crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
customerNameBox,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
customerNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
_box?.billToValue == billToSender
|
||||
? billWidget
|
||||
: const SizedBox(
|
||||
height: 300.0,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
_box?.billToValue == billToSender
|
||||
? billWidget
|
||||
: const SizedBox( height: 300.0,)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
consigneeNameBox,
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
consigneeNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
_cartonSubmit?.billToValue == billToSender
|
||||
? billWidget
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
)
|
||||
// ,
|
||||
|
||||
// Row(
|
||||
// children: getPackageList(_box!.packages),
|
||||
// ),
|
||||
// ])
|
||||
: Container(),
|
||||
isMixBox
|
||||
? Column(
|
||||
children: [
|
||||
packageBox,
|
||||
Row(
|
||||
children: getPackageList(_box!.packages),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
children: [
|
||||
cartonBox,
|
||||
Row(
|
||||
children: getCartonList(_box!.mixCartons),
|
||||
),
|
||||
_cartonSubmit?.billToValue == billToSender
|
||||
? billWidget
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
)
|
||||
// ,
|
||||
|
||||
// Row(
|
||||
// children: getPackageList(_box!.packages),
|
||||
// ),
|
||||
// ])
|
||||
:Container(),
|
||||
isMixBox ?
|
||||
Column(children: [
|
||||
packageBox,
|
||||
Row(
|
||||
children: getPackageList(_box!.packages),
|
||||
),
|
||||
],):Column(
|
||||
children: [
|
||||
cartonBox,
|
||||
Row(
|
||||
children: getCartonList(_box!.mixCartons),
|
||||
),
|
||||
],
|
||||
),
|
||||
isCutomDuty
|
||||
?
|
||||
surchargeItemBox:
|
||||
cargosBox,
|
||||
|
||||
isCutomDuty ? surchargeItemBox : cargosBox,
|
||||
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 200.0, right: 8.0),
|
||||
child: ElevatedButton(
|
||||
@@ -571,20 +497,19 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
}
|
||||
|
||||
_gotoEditor() async {
|
||||
_box!.mixCartons = _box!.mixCartons;
|
||||
bool? updated = await Navigator.push<bool>(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => CartonEditor(carton: _box)),
|
||||
);
|
||||
if (updated ?? false) {
|
||||
var cartonModel = Provider.of<CartonModel>(context, listen: false);
|
||||
var c = await cartonModel.getCarton(widget.box.id ?? "");
|
||||
setState(() {
|
||||
_box = c;
|
||||
_loadPackages();
|
||||
_loadMixCartons();
|
||||
_updateBoxData();
|
||||
});
|
||||
// var cartonModel = Provider.of<CartonModel>(context, listen: false);
|
||||
// var c = await cartonModel.getCarton(widget.box.id ?? "");
|
||||
// setState(() {
|
||||
// _box = c;
|
||||
// _loadPackages();
|
||||
// _loadMixCartons();
|
||||
// _updateBoxData();
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,7 +547,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
));
|
||||
}).toList();
|
||||
}
|
||||
List<Widget> getCartonList(List<Carton> _c) {
|
||||
|
||||
List<Widget> getCartonList(List<Carton> _c) {
|
||||
return _c.map((c) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
|
||||
Reference in New Issue
Block a user