From f3474e655b7521e3608847d54c2272c7fd9ad28e Mon Sep 17 00:00:00 2001 From: sma Date: Tue, 6 Feb 2024 17:42:12 +0630 Subject: [PATCH] preparing carton info page --- lib/pages/carton/carton_info.dart | 276 ++++++++++++++++++------------ 1 file changed, 169 insertions(+), 107 deletions(-) diff --git a/lib/pages/carton/carton_info.dart b/lib/pages/carton/carton_info.dart index 1dc5c57..9236348 100644 --- a/lib/pages/carton/carton_info.dart +++ b/lib/pages/carton/carton_info.dart @@ -38,9 +38,9 @@ final DateFormat dateFormat = DateFormat("d MMM yyyy"); class CartonInfo extends StatefulWidget { final Package? package; - final Carton? box; + final Carton box; - CartonInfo({this.box,this.package}); + CartonInfo({required this.box,this.package}); @override _CartonInfoState createState() => _CartonInfoState(); @@ -50,10 +50,9 @@ class _CartonInfoState extends State { bool _isLoading = false; Carton? _box; + List? cargoTypes; - List pickups=['203PVH','Fh290','HH211']; - Map cargos={"General":150,"Electronics":15}; - DeliveryAddress? _deliveryAddress = new DeliveryAddress(); + DeliveryAddress? _deliveryAddress = new DeliveryAddress(); MultiImgController multiImgController = MultiImgController(); TextEditingController _widthController = new TextEditingController(); TextEditingController _heightController = new TextEditingController(); @@ -70,12 +69,20 @@ class _CartonInfoState extends State { bool isFromCartons = false; bool isEdiable = false; Package? _package; + final List packages=[Package(packageType: "2303HH"), + Package(packageType: "540FH"), + Package(packageType: "440WFH"), + ]; + final List cargos=[CargoType(name: "Electronics"), + CargoType(name: "General"), + CargoType(name: "Dangerous"), + ]; @override void initState() { super.initState(); _box = widget.box; - initPackage(widget.package); + //initPackage(widget.package!); //for shipment weight volumetricRatio = Provider.of(context, listen: false) .rate @@ -83,19 +90,12 @@ class _CartonInfoState extends State { _lengthController.addListener(_calShipmentWeight); _widthController.addListener(_calShipmentWeight); _heightController.addListener(_calShipmentWeight); - + //multiImgController.setImageUrls = _box.photoUrls; _updateBoxData(); _loadPackages(); _loadMixCartons(); } - initPackage(Package? package) { - - if (package == null) return; - multiImgController.setImageUrls = package.photoUrls; - setState(() { - _package = package; - }); - } + _updateBoxData() { _widthController.text = _box!.width.toString(); @@ -314,6 +314,11 @@ class _CartonInfoState extends State { labelTextKey: "box.package", ); + final subPackageBox=ListView(children: packages.map((pack)=> + Card(child: Row(children: [ + Container(child:Text((pack.packageType).toString())) + ]),) + ).toList(),); final img = MultiImageFile( enabled: false, controller: multiImgController, @@ -392,80 +397,116 @@ class _CartonInfoState extends State { : [], ), body: Container( + padding: const EdgeInsets.all(10.0), - child: Row( children: [ - // Container(child: Row(children: [ - // Column(children: [ - // LocalTitle(textKey: "box.type.title"), - // Align( - // alignment: Alignment(-0.1,0.1), - // child: getCartonNumberStatus(context, _box!)), - - // ],) - // ]),), - Padding( - padding: EdgeInsets.only(left: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: cartonTypeBox, - flex: 1, - ), - Expanded( - child: IconButton( - alignment: Alignment.centerLeft, - iconSize: 30, - icon: const Icon( AntDesign.qrcode), - onPressed: () { - // ... - }, -), + child: Column( children: [ + + Row(children:[ + Flexible(child: + cartonTypeBox), + Flexible(child: + cartonQrBox, ), - ], - )), + ]), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Flexible(child: shipmentBox,), + Flexible(child: deliveryBox,), + + + ],), + Row( + + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Flexible(child: customerNameBox,), + Flexible(child: consigneeNameBox), - Padding( - padding: EdgeInsets.only(left: 10), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: shipmentBox, - flex: 1, - ), - Flexible( - child: deliveryBox, - ), - ], - )), - Padding( - padding: EdgeInsets.only(left: 10), - child: Row( - children: [ - Flexible( - child: customerNameBox, - ), - Flexible( - child: consigneeNameBox, - ), - Flexible( - child: Column(children: [ - Icon(Ionicons.document_text_outline), - Text("Bill to", style: TextStyle(color: Colors.blue)) - ])), - ], - )), - Padding(padding: EdgeInsets.only(left:10), - child: Flexible(child: packageBox)), - for(int pack=0;pack + // Card(child: Row(children: [ + // Container(child:Text(pack.packageType,)) + // ]),) + // ).toList(), + + // flex: 1, + // ), +// Expanded( +// child: IconButton( +// alignment: Alignment.centerLeft, +// iconSize: 30, +// icon: const Icon( AntDesign.qrcode), +// onPressed: () { +// // ... +// }, +// ), +// ), + + // ], + // )), + + // Padding( + // padding: EdgeInsets.only(left: 10), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.end, + // children: [ + // Expanded( + // child: shipmentBox, + // flex: 1, + // ), + // Flexible( + // child: deliveryBox, + // ), + // ], + // )), + // Padding( + // padding: EdgeInsets.only(left: 10), + // child: Row( + // children: [ + // Flexible( + // child: customerNameBox, + // ), + // Column( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Row( + // children: [consigneeNameBox,Flexible( + // child: Column(children: [ + // Icon(Ionicons.document_text_outline), + // Text("Bill to", style: TextStyle(color: Colors.blue)) + // ])),], + // ) + // ], + // // child: consigneeNameBox, + // ), + // // Flexible( + // // child: Column(children: [ + // // Icon(Ionicons.document_text_outline), + // // Text("Bill to", style: TextStyle(color: Colors.blue)) + // // ])), + // ], + // )), + // Padding(padding: EdgeInsets.only(left:10), + // child: Flexible(child: packageBox)), + //for(int pack=0;pack { // }), - Expanded(child: + Flexible(child: Padding(padding: EdgeInsets.only(left: 200.0,right: 8.0), child: ElevatedButton( @@ -483,14 +524,15 @@ class _CartonInfoState extends State { elevation: 3, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0)), - minimumSize: Size(100, 35), //////// HERE + minimumSize: Size(10, 35), //////// HERE ), onPressed: (){}, child: const Text('Upload Images'), ),)), + img, Center(child: ElevatedButton( style: ElevatedButton.styleFrom( - backgroundColor: Color.fromARGB(255, 196, 39, 52), + backgroundColor:Color(0xffff0606), elevation: 3, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(5.0)), @@ -521,7 +563,7 @@ class _CartonInfoState extends State { // : Container(), // isMixBox // ? Container() - // : isFromPackages + // : isFromPackages // ? customerNameBox // : Container(), // isFromCartons @@ -575,10 +617,13 @@ class _CartonInfoState extends State { // SizedBox( // height: 20, // ) - ]), - ), - ), - ); + ]) + ) + ) + // ]) + // ) + // ) + ); } List _getCartons(BuildContext context, List cartons) { @@ -586,6 +631,11 @@ class _CartonInfoState extends State { return CartonRow(box: c); }).toList(); } + List _getPackages(BuildContext context, List packages) { + return packages.map((p) { + return Text(p.packageType!); + }).toList(); + } _gotoEditor() async { _box!.mixCartons = _box!.mixCartons; @@ -627,18 +677,30 @@ class _CartonInfoState extends State { }); } } - Widget _packageList(BuildContext context) { - return ListView.builder( - padding: const EdgeInsets.all(8), - itemCount: pickups.length, - itemBuilder: (BuildContext context, int index) { - return Container( - height: 50, - //color: Colors.amber[pickups[index]], - child: Center(child: Text('Entry ${pickups[index]}')), - ); - }, - //separatorBuilder: (BuildContext context, int index) => const Divider(), - ); -} + + List getPackageList(List _p) { + return _p.map((p) { + return Container( + padding: EdgeInsets.only(top: 0), + child: Container( + //padding: + //EdgeInsets.only(top: 0.0), + child: Row(children: [ + new Text(p.packageType ?? '') + ]), + ));}).toList(); + } + List getCargoList(List _c) { + return _c.map((c) { + return Container( + padding: EdgeInsets.only(top: 0), + child: Container( + //padding: + //EdgeInsets.only(top: 0.0), + child: Row(children: [ + new Text(c.name ?? '') + ]), + ));}).toList(); + } + }