update carton info
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/cargo_type.dart';
|
||||
import 'package:fcs/domain/entities/carton.dart';
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/vo/delivery_address.dart';
|
||||
@@ -23,6 +24,7 @@ import 'package:provider/provider.dart';
|
||||
import 'cargo_table.dart';
|
||||
import 'carton_editor.dart';
|
||||
import 'carton_package_table.dart';
|
||||
import 'carton_row.dart';
|
||||
import 'model/carton_model.dart';
|
||||
import 'widgets.dart';
|
||||
|
||||
@@ -43,8 +45,11 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
TextEditingController _widthController = new TextEditingController();
|
||||
TextEditingController _heightController = new TextEditingController();
|
||||
TextEditingController _lengthController = new TextEditingController();
|
||||
TextEditingController _cartonSizeController = new TextEditingController();
|
||||
double volumetricRatio = 0;
|
||||
double shipmentWeight = 0;
|
||||
String selectMixBoxType;
|
||||
List<Carton> _cartons = [];
|
||||
|
||||
bool isMixBox;
|
||||
bool isFromShipments;
|
||||
@@ -73,6 +78,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
_widthController.text = _box.width.toString();
|
||||
_heightController.text = _box.height.toString();
|
||||
_lengthController.text = _box.length.toString();
|
||||
_cartonSizeController.text = _box.cartonSizeName ?? "";
|
||||
_deliveryAddress = _box.deliveryAddress;
|
||||
isMixBox = _box.cartonType == carton_mix_box;
|
||||
isFromShipments = _box.cartonType == carton_from_shipments;
|
||||
@@ -81,6 +87,17 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
isEdiable = !isMixBox &&
|
||||
(isFromPackages || isSmallBag) &&
|
||||
_box.status == carton_packed_status;
|
||||
selectMixBoxType = _box.mixBoxType ?? "Mix Delivery";
|
||||
_cartons = [
|
||||
Carton(
|
||||
cartonNumber: "A100B-1#1",
|
||||
cargoTypes: [CargoType(name: "General", weight: 12)],
|
||||
userName: "Seven 7"),
|
||||
Carton(
|
||||
cartonNumber: "A100B-1#2",
|
||||
cargoTypes: [CargoType(name: "General", weight: 12)],
|
||||
userName: "Seven 7"),
|
||||
];
|
||||
}
|
||||
|
||||
_loadPackages() async {
|
||||
@@ -176,10 +193,10 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
],
|
||||
);
|
||||
|
||||
final shipmentWeightBox = DisplayText(
|
||||
text: shipmentWeight != null ? shipmentWeight.toStringAsFixed(2) : "",
|
||||
labelTextKey: "box.shipment_weight",
|
||||
iconData: MaterialCommunityIcons.weight,
|
||||
final cartonSizeBox = DisplayText(
|
||||
text: _cartonSizeController.text,
|
||||
labelTextKey: "box.carton_size",
|
||||
iconData: AntDesign.CodeSandbox,
|
||||
);
|
||||
final cargoTableBox = CargoTable(
|
||||
cargoTypes: _box.cargoTypes,
|
||||
@@ -190,6 +207,36 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
iconData: MaterialCommunityIcons.package,
|
||||
);
|
||||
|
||||
final mixTypeBox = Container(
|
||||
padding: EdgeInsets.only(top: 20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
child: LocalText(
|
||||
context,
|
||||
"box.mix_type",
|
||||
color: primaryColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
)),
|
||||
Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
Text(selectMixBoxType)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
return LocalProgress(
|
||||
inAsyncCall: _isLoading,
|
||||
child: Scaffold(
|
||||
@@ -222,7 +269,7 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: ListView(children: <Widget>[
|
||||
child: ListView(shrinkWrap: true, children: <Widget>[
|
||||
Center(child: getCartonNumberStatus(context, _box)),
|
||||
LocalTitle(textKey: "box.type.title"),
|
||||
cartonTypeBox,
|
||||
@@ -231,6 +278,15 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
isSmallBag ? mixCartonNumberBox : Container(),
|
||||
isMixBox ? Container() : fcsIDBox,
|
||||
isMixBox ? Container() : customerNameBox,
|
||||
isMixBox ? mixTypeBox : Container(),
|
||||
isMixBox ? LocalTitle(textKey: "boxes.title") : Container(),
|
||||
isMixBox
|
||||
? Column(
|
||||
children: _getCartons(
|
||||
context,
|
||||
this._cartons,
|
||||
))
|
||||
: Container(),
|
||||
isFromPackages || isSmallBag
|
||||
? CartonPackageTable(
|
||||
packages: _box.packages,
|
||||
@@ -241,8 +297,8 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
...(isFromPackages
|
||||
? [
|
||||
LocalTitle(textKey: "box.dimension"),
|
||||
cartonSizeBox,
|
||||
dimBox,
|
||||
shipmentWeightBox,
|
||||
]
|
||||
: []),
|
||||
isMixBox
|
||||
@@ -263,6 +319,12 @@ class _CartonInfoState extends State<CartonInfo> {
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _getCartons(BuildContext context, List<Carton> cartons) {
|
||||
return cartons.map((c) {
|
||||
return CartonRow(box: c);
|
||||
}).toList();
|
||||
}
|
||||
|
||||
_gotoEditor() async {
|
||||
bool updated = await Navigator.push<bool>(
|
||||
context,
|
||||
|
||||
Reference in New Issue
Block a user