Merge branch 'master' of sma/fcs into master
This commit is contained in:
@@ -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,9 +50,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
bool _isLoading = false;
|
||||
Carton? _box;
|
||||
|
||||
|
||||
List<CargoType>? cargoTypes;
|
||||
List<String> pickups=['203PVH','Fh290','HH211'];
|
||||
Map<String,dynamic> cargos={"General":150,"Electronics":15};
|
||||
DeliveryAddress? _deliveryAddress = new DeliveryAddress();
|
||||
MultiImgController multiImgController = MultiImgController();
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
@@ -70,12 +69,20 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
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"),
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_box = widget.box;
|
||||
initPackage(widget.package);
|
||||
//initPackage(widget.package!);
|
||||
//for shipment weight
|
||||
volumetricRatio = Provider.of<ShipmentRateModel>(context, listen: false)
|
||||
.rate
|
||||
@@ -83,19 +90,12 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
_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<CartonInfo> {
|
||||
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<CartonInfo> {
|
||||
: [],
|
||||
),
|
||||
body: Container(
|
||||
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Row( children: <Widget>[
|
||||
// Container(child: Row(children: [
|
||||
// Column(children: [
|
||||
// LocalTitle(textKey: "box.type.title"),
|
||||
// Align(
|
||||
// alignment: Alignment(-0.1,0.1),
|
||||
// child: getCartonNumberStatus(context, _box!)),
|
||||
child: Column( children: <Widget>[
|
||||
|
||||
// ],)
|
||||
// ]),),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
Row(children:[
|
||||
Flexible(child:
|
||||
cartonTypeBox),
|
||||
Flexible(child:
|
||||
cartonQrBox,
|
||||
),
|
||||
]),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: cartonTypeBox,
|
||||
flex: 1,
|
||||
),
|
||||
Expanded(
|
||||
child: IconButton(
|
||||
alignment: Alignment.centerLeft,
|
||||
iconSize: 30,
|
||||
icon: const Icon( AntDesign.qrcode),
|
||||
onPressed: () {
|
||||
// ...
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Flexible(child: shipmentBox,),
|
||||
Flexible(child: deliveryBox,),
|
||||
|
||||
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<pickups.length;pack++)
|
||||
|
||||
Padding(padding: EdgeInsets.only(left: 10.0),
|
||||
child:
|
||||
Text(pickups[pack],style:TextStyle(fontSize: 15,color: Colors.black))
|
||||
],),
|
||||
Row(
|
||||
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Flexible(child: customerNameBox,),
|
||||
Flexible(child: consigneeNameBox),
|
||||
|
||||
|
||||
|
||||
]),
|
||||
packageBox,
|
||||
Column(children:
|
||||
getPackageList(packages),
|
||||
),
|
||||
Padding(padding: EdgeInsets.only(left: 10),
|
||||
child: cargoBox,),
|
||||
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) {
|
||||
@@ -474,7 +515,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
|
||||
// }),
|
||||
|
||||
Expanded(child:
|
||||
Flexible(child:
|
||||
Padding(padding: EdgeInsets.only(left: 200.0,right: 8.0),
|
||||
|
||||
child: ElevatedButton(
|
||||
@@ -483,14 +524,15 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
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)),
|
||||
@@ -575,9 +617,12 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
// SizedBox(
|
||||
// height: 20,
|
||||
// )
|
||||
]),
|
||||
),
|
||||
),
|
||||
])
|
||||
)
|
||||
)
|
||||
// ])
|
||||
// )
|
||||
// )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -586,6 +631,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
return CartonRow(box: c);
|
||||
}).toList();
|
||||
}
|
||||
List<Widget> _getPackages(BuildContext context, List<Package> packages) {
|
||||
return packages.map((p) {
|
||||
return Text(p.packageType!);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
_gotoEditor() async {
|
||||
_box!.mixCartons = _box!.mixCartons;
|
||||
@@ -627,18 +677,30 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
});
|
||||
}
|
||||
}
|
||||
Widget _packageList(BuildContext context) {
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.all(8),
|
||||
itemCount: pickups.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
|
||||
List<Widget> getPackageList(List<Package> _p) {
|
||||
return _p.map((p) {
|
||||
return Container(
|
||||
height: 50,
|
||||
//color: Colors.amber[pickups[index]],
|
||||
child: Center(child: Text('Entry ${pickups[index]}')),
|
||||
);
|
||||
},
|
||||
//separatorBuilder: (BuildContext context, int index) => const Divider(),
|
||||
);
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Container(
|
||||
//padding:
|
||||
//EdgeInsets.only(top: 0.0),
|
||||
child: Row(children:<Widget> [
|
||||
new Text(p.packageType ?? '')
|
||||
]),
|
||||
));}).toList();
|
||||
}
|
||||
List<Widget> getCargoList(List<CargoType> _c) {
|
||||
return _c.map((c) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 0),
|
||||
child: Container(
|
||||
//padding:
|
||||
//EdgeInsets.only(top: 0.0),
|
||||
child: Row(children:<Widget> [
|
||||
new Text(c.name ?? '')
|
||||
]),
|
||||
));}).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user