From 62c0da8a9625be054104f841faaaae8d1e7b85f3 Mon Sep 17 00:00:00 2001 From: tzw Date: Fri, 9 Feb 2024 12:21:49 +0630 Subject: [PATCH] update carton info --- lib/pages/carton/carton_info.dart | 238 ++++++++++-------------------- 1 file changed, 82 insertions(+), 156 deletions(-) diff --git a/lib/pages/carton/carton_info.dart b/lib/pages/carton/carton_info.dart index 4a9d997..788d446 100644 --- a/lib/pages/carton/carton_info.dart +++ b/lib/pages/carton/carton_info.dart @@ -60,8 +60,8 @@ class _CartonInfoState extends State { bool isFromPackages = false; bool isSmallBag = false; bool isFromCartons = false; - bool isEdiable = false; - bool isCutomDuty=false; + + bool isCutomDuty = false; final List cargoTypes = []; final List surchareItems = []; final List cartons = []; @@ -71,9 +71,6 @@ class _CartonInfoState extends State { super.initState(); _box = widget.box; _box?.billToValue = "Bill to sender"; - - - //initPackage(widget.package!); //for shipment weight @@ -100,8 +97,6 @@ class _CartonInfoState extends State { 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 { 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 { inAsyncCall: _isLoading, child: Scaffold( appBar: LocalAppBar( - labelKey: "box.info.title", - backgroundColor: Colors.white, - labelColor: primaryColor, - arrowColor: primaryColor, - actions: isEdiable - ? [ - 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: [ + IconButton( + icon: Icon(Icons.edit, color: primaryColor), + onPressed: _gotoEditor), + ]), body: Container( padding: const EdgeInsets.all(10.0), child: ListView(children: [ @@ -458,79 +382,81 @@ class _CartonInfoState extends State { // 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 { } _gotoEditor() async { - _box!.mixCartons = _box!.mixCartons; bool? updated = await Navigator.push( context, CupertinoPageRoute(builder: (context) => CartonEditor(carton: _box)), ); if (updated ?? false) { - var cartonModel = Provider.of(context, listen: false); - var c = await cartonModel.getCarton(widget.box.id ?? ""); - setState(() { - _box = c; - _loadPackages(); - _loadMixCartons(); - _updateBoxData(); - }); + // var cartonModel = Provider.of(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 { )); }).toList(); } - List getCartonList(List _c) { + + List getCartonList(List _c) { return _c.map((c) { return Container( padding: EdgeInsets.only(top: 0),