update carton
This commit is contained in:
@@ -35,6 +35,7 @@ import 'cargo_type_addtion.dart';
|
||||
import 'cargo_type_editor.dart';
|
||||
import 'model/carton_model.dart';
|
||||
import '../carton_size/model/carton_size_model.dart';
|
||||
import 'package_carton_editor.dart';
|
||||
import 'widgets.dart';
|
||||
|
||||
class CartonEditor extends StatefulWidget {
|
||||
@@ -63,6 +64,8 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
Carton _mixCarton;
|
||||
List<Carton> _mixCartons;
|
||||
|
||||
List<Carton> _cartons = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -96,6 +99,11 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
_isNew = true;
|
||||
_selectedCartonType = carton_from_packages;
|
||||
_loadFcsShipments();
|
||||
_cartons = [
|
||||
Carton(cartonNumber: "A100B-1#1"),
|
||||
Carton(cartonNumber: "A100B-1#2"),
|
||||
Carton(cartonNumber: "A100B-1#3")
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +305,7 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
);
|
||||
|
||||
final createBtn = LocalButton(
|
||||
textKey: "box.create.btn",
|
||||
textKey: "box.complete.packaging",
|
||||
callBack: _save,
|
||||
);
|
||||
|
||||
@@ -344,6 +352,28 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
onRemove: (c) => _removeCargo(c),
|
||||
);
|
||||
|
||||
final cartonTitleBox = Container(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text("Cartons (${_cartons.length})"),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.add_circle,
|
||||
color: primaryColor,
|
||||
),
|
||||
onPressed: () async {
|
||||
Carton _carton = await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => PackageCartonEditor()),
|
||||
);
|
||||
_addCarton(_carton);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -359,19 +389,25 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
),
|
||||
shadowColor: Colors.transparent,
|
||||
backgroundColor: Colors.white,
|
||||
title: _isNew
|
||||
? LocalText(
|
||||
context,
|
||||
"boxes.create.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
)
|
||||
: LocalText(
|
||||
context,
|
||||
"box.edit.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
title: LocalText(
|
||||
context,
|
||||
"box.info.title",
|
||||
fontSize: 20,
|
||||
color: primaryColor,
|
||||
),
|
||||
// title: _isNew
|
||||
// ? LocalText(
|
||||
// context,
|
||||
// "boxes.create.title",
|
||||
// fontSize: 20,
|
||||
// color: primaryColor,
|
||||
// )
|
||||
// : LocalText(
|
||||
// context,
|
||||
// "box.edit.title",
|
||||
// fontSize: 20,
|
||||
// color: primaryColor,
|
||||
// ),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
@@ -418,32 +454,41 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
_populateDeliveryAddress();
|
||||
},
|
||||
),
|
||||
cargoTableTitleBox,
|
||||
cargoTableBox,
|
||||
isSmallBag
|
||||
? Container()
|
||||
: LocalTitle(textKey: "box.dimension"),
|
||||
isSmallBag ? Container() : cartonSizeDropdown(),
|
||||
isSmallBag ? Container() : dimBox,
|
||||
isSmallBag ? Container() : shipmentWeightBox,
|
||||
LocalTitle(textKey: "box.delivery_address"),
|
||||
DefaultDeliveryAddress(
|
||||
deliveryAddress: _deliveryAddress,
|
||||
labelKey: "box.delivery_address",
|
||||
onTap: () async {
|
||||
DeliveryAddress _address = await Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) => DeliveryAddressList(
|
||||
isAdminCreation: true,
|
||||
deliveryAddress: _deliveryAddress)));
|
||||
if (_address == null) return;
|
||||
setState(() {
|
||||
_deliveryAddress = _address;
|
||||
});
|
||||
},
|
||||
),
|
||||
cartonTitleBox,
|
||||
Column(
|
||||
children: _getCartons(
|
||||
context,
|
||||
this._cartons,
|
||||
)),
|
||||
// cargoTableTitleBox,
|
||||
// cargoTableBox,
|
||||
// isSmallBag
|
||||
// ? Container()
|
||||
// : LocalTitle(textKey: "box.dimension"),
|
||||
// isSmallBag ? Container() : cartonSizeDropdown(),
|
||||
// isSmallBag ? Container() : dimBox,
|
||||
// isSmallBag ? Container() : shipmentWeightBox,
|
||||
// LocalTitle(textKey: "box.delivery_address"),
|
||||
// DefaultDeliveryAddress(
|
||||
// deliveryAddress: _deliveryAddress,
|
||||
// labelKey: "box.delivery_address",
|
||||
// onTap: () async {
|
||||
// DeliveryAddress _address = await Navigator.push(
|
||||
// context,
|
||||
// CupertinoPageRoute(
|
||||
// builder: (context) => DeliveryAddressList(
|
||||
// isAdminCreation: true,
|
||||
// deliveryAddress: _deliveryAddress)));
|
||||
// if (_address == null) return;
|
||||
// setState(() {
|
||||
// _deliveryAddress = _address;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
]),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
_isNew ? createBtn : saveBtn,
|
||||
SizedBox(
|
||||
height: 20,
|
||||
@@ -455,6 +500,65 @@ class _CartonEditorState extends State<CartonEditor> {
|
||||
);
|
||||
}
|
||||
|
||||
_addCarton(Carton carton) {
|
||||
if (carton == null) return;
|
||||
this._cartons.add(carton);
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
List<Widget> _getCartons(BuildContext context, List<Carton> cartons) {
|
||||
return cartons.map((c) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(color: Colors.grey[300]),
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding:
|
||||
new EdgeInsets.symmetric(horizontal: 15.0 - 5 / 2),
|
||||
child: Stack(
|
||||
alignment: AlignmentDirectional.bottomEnd,
|
||||
children: [
|
||||
Icon(
|
||||
MaterialCommunityIcons.package,
|
||||
color: primaryColor,
|
||||
size: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
new Expanded(
|
||||
child: new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Text(
|
||||
c.cartonNumber == null ? "" : c.cartonNumber,
|
||||
style: new TextStyle(fontSize: 15.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
CartonSize selectedCatonSize;
|
||||
Widget cartonSizeDropdown() {
|
||||
List<CartonSize> _cartonSizes =
|
||||
|
||||
Reference in New Issue
Block a user