prepare carton info page and add cartonimage upload page
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/entities/pickup.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/carton/carton_image_upload.dart';
|
||||
import 'package:fcs/pages/carton_size/model/carton_size_model.dart';
|
||||
import 'package:fcs/pages/main/util.dart';
|
||||
import 'package:fcs/pages/package/model/package_model.dart';
|
||||
@@ -24,6 +25,7 @@ import 'package:fcs/pages/widgets/status_tree.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@@ -35,6 +37,7 @@ import 'model/carton_model.dart';
|
||||
import 'widgets.dart';
|
||||
|
||||
final DateFormat dateFormat = DateFormat("d MMM yyyy");
|
||||
final NumberFormat numberFormatter = NumberFormat("#,###");
|
||||
|
||||
class CartonInfo extends StatefulWidget {
|
||||
final Package? package;
|
||||
@@ -51,7 +54,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
Carton? _box;
|
||||
|
||||
|
||||
List<CargoType>? cargoTypes;
|
||||
|
||||
DeliveryAddress? _deliveryAddress = new DeliveryAddress();
|
||||
MultiImgController multiImgController = MultiImgController();
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
@@ -67,17 +70,9 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
bool isFromPackages = false;
|
||||
bool isSmallBag = false;
|
||||
bool isFromCartons = false;
|
||||
bool isEdiable = false;
|
||||
Package? _package;
|
||||
final List<Package> packages=[Package(packageType: "2303HH"),
|
||||
Package(packageType: "540FH"),
|
||||
Package(packageType: "440WFH"),
|
||||
];
|
||||
final List<CargoType> cargos=[CargoType(name: "Electronics"),
|
||||
CargoType(name: "General"),
|
||||
CargoType(name: "Dangerous"),
|
||||
];
|
||||
|
||||
bool isEdiable = false;
|
||||
final List<CargoType> cargoTypes=[];
|
||||
final List<CargoType> surchareItems=[];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -90,7 +85,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
_lengthController.addListener(_calShipmentWeight);
|
||||
_widthController.addListener(_calShipmentWeight);
|
||||
_heightController.addListener(_calShipmentWeight);
|
||||
//multiImgController.setImageUrls = _box.photoUrls;
|
||||
multiImgController.setImageUrls = _box!.photos;
|
||||
_updateBoxData();
|
||||
_loadPackages();
|
||||
_loadMixCartons();
|
||||
@@ -185,7 +180,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var cartonModel = Provider.of<CartonModel>(context);
|
||||
|
||||
double totalWeight = _box!.cargoTypes.fold(0, (sum, value) => sum + value.weight);
|
||||
double totalPieces = surchareItems.fold(0, (sum, value) => sum + value.qty);
|
||||
// final cartonTypeBox = LocalRadioButtons(
|
||||
// readOnly: true,
|
||||
// values: cartonModel.cartonTypesInfo,
|
||||
@@ -213,11 +209,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
//icon: FcsIDIcon(),
|
||||
);
|
||||
|
||||
final fcsIDBox = DisplayText(
|
||||
text: _box!.fcsID == null ? "" : _box!.fcsID,
|
||||
labelTextKey: "box.fcs.id",
|
||||
//icon: FcsIDIcon(),
|
||||
);
|
||||
// final fcsIDBox = DisplayText(
|
||||
// text: _box!.fcsID == null ? "" : _box!.fcsID,
|
||||
// labelTextKey: "box.fcs.id",
|
||||
// //icon: FcsIDIcon(),
|
||||
// );
|
||||
|
||||
final customerNameBox = DisplayText(
|
||||
text: _box!.userName == null ? "" : _box!.userName,
|
||||
@@ -227,11 +223,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
//iconData: Icons.person,
|
||||
);
|
||||
|
||||
final consigneefcsIDBox = DisplayText(
|
||||
text: _box!.fcsID != null ? _box!.fcsID : "",
|
||||
labelTextKey: "processing.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
);
|
||||
// final consigneefcsIDBox = DisplayText(
|
||||
// text: _box!.fcsID != null ? _box!.fcsID : "",
|
||||
// labelTextKey: "processing.fcs.id",
|
||||
// icon: FcsIDIcon(),
|
||||
// );
|
||||
|
||||
final consigneeNameBox = DisplayText(
|
||||
text: _box!.senderName != null ? _box!.senderName : "",
|
||||
@@ -242,44 +238,44 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
// iconData: Ionicons.document_text_outline,
|
||||
);
|
||||
|
||||
final consigneeBox = Container(
|
||||
child: Column(
|
||||
children: [
|
||||
consigneeNameBox,
|
||||
IconButton(icon:Icon(Ionicons.document_text_outline),
|
||||
onPressed:() {},),
|
||||
Text("Bill to",style:TextStyle(color:Color.fromARGB(255, 57, 80, 233)))
|
||||
// final consigneeBox = Container(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// consigneeNameBox,
|
||||
// IconButton(icon:Icon(Ionicons.document_text_outline),
|
||||
// onPressed:() {},),
|
||||
// Text("Bill to",style:TextStyle(color:Color.fromARGB(255, 57, 80, 233)))
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
|
||||
final shipperIDBox = Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: DisplayText(
|
||||
text: _box!.senderFCSID,
|
||||
labelTextKey: "processing.fcs.id",
|
||||
icon: FcsIDIcon(),
|
||||
)),
|
||||
],
|
||||
);
|
||||
// final shipperIDBox = Row(
|
||||
// children: <Widget>[
|
||||
// Expanded(
|
||||
// child: DisplayText(
|
||||
// text: _box!.senderFCSID,
|
||||
// labelTextKey: "processing.fcs.id",
|
||||
// icon: FcsIDIcon(),
|
||||
// )),
|
||||
// ],
|
||||
// );
|
||||
|
||||
final shipperNamebox = DisplayText(
|
||||
text: _box!.senderName,
|
||||
labelTextKey: "processing.shipper.name",
|
||||
maxLines: 2,
|
||||
iconData: Icons.person,
|
||||
);
|
||||
// final shipperNamebox = DisplayText(
|
||||
// text: _box!.senderName,
|
||||
// labelTextKey: "processing.shipper.name",
|
||||
// maxLines: 2,
|
||||
// iconData: Icons.person,
|
||||
// );
|
||||
|
||||
final shipperBox = Container(
|
||||
child: Column(
|
||||
children: [
|
||||
shipperIDBox,
|
||||
shipperNamebox,
|
||||
],
|
||||
),
|
||||
);
|
||||
// final shipperBox = Container(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// shipperIDBox,
|
||||
// shipperNamebox,
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
|
||||
final lengthBox = LengthPicker(
|
||||
controller: _lengthController,
|
||||
@@ -314,16 +310,154 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
labelTextKey: "box.package",
|
||||
|
||||
);
|
||||
final subPackageBox=ListView(children: packages.map((pack)=>
|
||||
Card(child: Row(children: [
|
||||
Container(child:Text((pack.packageType).toString()))
|
||||
]),)
|
||||
).toList(),);
|
||||
final cargosBox = Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 5, bottom: 5, right: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
LocalText(context, 'box.cargo.type',
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal),
|
||||
Padding(padding: EdgeInsets.only(right: 100),
|
||||
child:
|
||||
Text("${removeTrailingZeros(totalWeight)} lb",
|
||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||
],
|
||||
),
|
||||
//),
|
||||
Container(
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(color: primaryColor),
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// ),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 100),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _box!.cargoTypes.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
e.name ?? "",
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontSize: 15),
|
||||
),
|
||||
Text("${removeTrailingZeros(e.weight)} lb",
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 15))
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
const SizedBox(height: 10),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
final surchargeItemBox = Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left: 5, bottom: 5, right: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
LocalText(context, 'box.surcharge.item',
|
||||
color: Colors.black54,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal),
|
||||
Padding(padding: EdgeInsets.only(right: 100),
|
||||
child:
|
||||
Text("${removeTrailingZeros(totalPieces)} pcs",
|
||||
style: TextStyle(color: Colors.black54, fontSize: 15)))
|
||||
],
|
||||
),
|
||||
//),
|
||||
Container(
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(color: primaryColor),
|
||||
// borderRadius: BorderRadius.circular(5),
|
||||
// ),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(right: 100),
|
||||
child: Column(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: surchareItems.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
e.name ?? "",
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontSize: 15),
|
||||
),
|
||||
Text("${removeTrailingZeros((e.qty).toDouble())} pc",
|
||||
style: TextStyle(
|
||||
color: Colors.black, fontSize: 15))
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
const SizedBox(height: 10),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: surchareItems.map((e) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
e.name ?? "",
|
||||
style: TextStyle(color: labelColor, fontSize: 15),
|
||||
),
|
||||
Text("${numberFormatter.format(e.qty)} pc",
|
||||
style:
|
||||
TextStyle(color: labelColor, fontSize: 15))
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
|
||||
final img = MultiImageFile(
|
||||
enabled: false,
|
||||
controller: multiImgController,
|
||||
title: "Receipt File",
|
||||
);
|
||||
final billWidget
|
||||
= 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))
|
||||
],
|
||||
)));
|
||||
|
||||
final cargoBox = DisplayText(
|
||||
//text: "203FVH",
|
||||
labelTextKey: "box.cargo.type",
|
||||
@@ -336,9 +470,9 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
labelTextKey: "box.carton_size",
|
||||
iconData: AntDesign.CodeSandbox,
|
||||
);
|
||||
final cargoTableBox = CargoTable(
|
||||
cargoTypes: _box!.cargoTypes,
|
||||
);
|
||||
// final cargoTableBox = CargoTable(
|
||||
// cargoTypes: _box!.cargoTypes,
|
||||
// );
|
||||
// final mixCartonNumberBox = DisplayText(
|
||||
// text: _box!.mixCartonNumber,
|
||||
// labelTextKey: "box.mix.carton",
|
||||
@@ -396,10 +530,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
]
|
||||
: [],
|
||||
),
|
||||
body: Container(
|
||||
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column( children: <Widget>[
|
||||
body:
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child:
|
||||
Column(children: [
|
||||
|
||||
Row(children:[
|
||||
Flexible(child:
|
||||
@@ -416,104 +551,58 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
|
||||
|
||||
],),
|
||||
|
||||
Row(
|
||||
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Flexible(child: customerNameBox,),
|
||||
Flexible(child: consigneeNameBox),
|
||||
|
||||
|
||||
|
||||
]),
|
||||
Expanded(
|
||||
child: Row(
|
||||
//crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
customerNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
CargoType().isCutomDuty == false
|
||||
? billWidget
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 0),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
consigneeNameBox,
|
||||
],
|
||||
),
|
||||
),
|
||||
CargoType().isCutomDuty == true
|
||||
? billWidget
|
||||
: const SizedBox()
|
||||
],
|
||||
),
|
||||
))
|
||||
|
||||
],),
|
||||
|
||||
packageBox,
|
||||
Column(children:
|
||||
getPackageList(packages),
|
||||
getPackageList(_box!.packages),
|
||||
),
|
||||
Column(children: getCargoList(cargos),),
|
||||
//subPackageBox,
|
||||
|
||||
|
||||
// packages.map((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<pickups.length;pack++)
|
||||
|
||||
// Padding(padding: EdgeInsets.only(left: 10.0),
|
||||
// child:
|
||||
// Text(pickups[pack],style:TextStyle(fontSize: 15,color: Colors.black))
|
||||
// ),
|
||||
// Padding(padding: EdgeInsets.only(left: 10),
|
||||
// child: cargoBox,),
|
||||
// ListView.builder(
|
||||
// itemCount: cargos.length,
|
||||
// itemBuilder: (BuildContext context, int index) {
|
||||
// return ListTile(
|
||||
// title: Text(cargos[index].key));
|
||||
|
||||
// }),
|
||||
cargosBox,
|
||||
surchargeItemBox,
|
||||
|
||||
|
||||
Flexible(child:
|
||||
Padding(padding: EdgeInsets.only(left: 200.0,right: 8.0),
|
||||
@@ -526,7 +615,12 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
borderRadius: BorderRadius.circular(5.0)),
|
||||
minimumSize: Size(10, 35), //////// HERE
|
||||
),
|
||||
onPressed: (){},
|
||||
onPressed: (){
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(builder: (context) => CartonImageUpload()),
|
||||
);
|
||||
},
|
||||
child: const Text('Upload Images'),
|
||||
),)),
|
||||
img,
|
||||
@@ -541,18 +635,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
onPressed: (){},
|
||||
child: const Text('Delete Carton',style:TextStyle(fontSize: 20)),
|
||||
),),
|
||||
|
||||
|
||||
//_package!.photoUrls.length == 0 || _package!.photoUrls.isEmpty ? Container() : img,
|
||||
|
||||
// Padding(padding: EdgeInsets.only(left: 10.0),
|
||||
// child: Column(children: [
|
||||
// cargos.isEmpty?Container():
|
||||
// Text(cargos[cargo].key),
|
||||
// Text(cargos[cargo].value),
|
||||
// ]),),
|
||||
|
||||
//_packageList,
|
||||
|
||||
|
||||
|
||||
//LocalTitle(textKey: "box.shipment_info"),
|
||||
// shipmentBox,
|
||||
// isSmallBag ? mixCartonNumberBox : Container(),
|
||||
@@ -584,7 +671,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
// title: Text(pickups[index]),
|
||||
// );
|
||||
// },)
|
||||
|
||||
|
||||
// ])),
|
||||
// // isMixBox ? mixTypeBox : Container(),
|
||||
// isMixBox ? LocalTitle(textKey: "box.mix_caton_title") : Container(),
|
||||
@@ -620,6 +707,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
])
|
||||
)
|
||||
)
|
||||
|
||||
// ])
|
||||
// )
|
||||
// )
|
||||
|
||||
Reference in New Issue
Block a user