add carton editor for mix carton
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
// ignore_for_file: deprecated_member_use
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../domain/constants.dart';
|
||||
import '../../../domain/entities/carton.dart';
|
||||
import '../../../domain/entities/carton_size.dart';
|
||||
import '../../../domain/entities/fcs_shipment.dart';
|
||||
import '../../../domain/vo/local_step.dart';
|
||||
import '../../../helpers/theme.dart';
|
||||
import '../../widgets/local_text.dart';
|
||||
import '../../widgets/progress.dart';
|
||||
import '../../widgets/step_widget.dart';
|
||||
import '../model/carton_selection_model.dart';
|
||||
import 'carton_selection_widget.dart';
|
||||
import 'type_widget.dart';
|
||||
|
||||
class MixCartonEditor extends StatefulWidget {
|
||||
@@ -26,12 +35,21 @@ class _MixCartonEditorState extends State<MixCartonEditor> {
|
||||
LocalStep(lable: 'Cartons', stepType: StepType.CARTONS),
|
||||
LocalStep(lable: 'Submit', stepType: StepType.SUBMIT)
|
||||
];
|
||||
List<Carton> _cartions = [];
|
||||
|
||||
bool _isLoading = false;
|
||||
int currentStep = 0;
|
||||
double _length = 0;
|
||||
double _width = 0;
|
||||
double _height = 0;
|
||||
|
||||
FcsShipment? _shipment;
|
||||
String _cartionSizeType = standardCarton;
|
||||
CartonSize? _standardSize;
|
||||
bool _isLoading = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
context.read<CartonSelectionModel>().clearSelection();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@@ -98,57 +116,48 @@ class _MixCartonEditorState extends State<MixCartonEditor> {
|
||||
Widget getContent(int index) {
|
||||
var step = steps[index];
|
||||
if (step.stepType == StepType.TYPE) {
|
||||
return Expanded(child: TypeWidget(
|
||||
return Expanded(
|
||||
child: TypeWidget(
|
||||
shipment: _shipment,
|
||||
cartonSizeType: _cartionSizeType,
|
||||
standardSize: _standardSize,
|
||||
length: _length,
|
||||
width: _width,
|
||||
height: _height,
|
||||
onPrevious: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
// warehouse: _warehouse,
|
||||
// onSelectWarehouse: (w) {
|
||||
// setState(() {
|
||||
// _warehouse = w;
|
||||
// currentStep += 1;
|
||||
// });
|
||||
// },
|
||||
onContinue: (shipment, cartonSizeType,
|
||||
{standardSize, length, width, height}) {
|
||||
setState(() {
|
||||
_shipment = shipment;
|
||||
_cartionSizeType = cartonSizeType;
|
||||
_standardSize = standardSize;
|
||||
_length = length ?? 0;
|
||||
_width = width ?? 0;
|
||||
_height = height ?? 0;
|
||||
currentStep += 1;
|
||||
});
|
||||
},
|
||||
));
|
||||
} else if (step.stepType == StepType.CARTONS) {
|
||||
return Expanded(
|
||||
child: Text("cartons"),
|
||||
// child: StockAdjustmentProducts(
|
||||
// products: products,
|
||||
// onAdd: (ps) {
|
||||
// setState(() {
|
||||
// products = List.from(ps);
|
||||
// });
|
||||
// },
|
||||
// onRemove: (p) {
|
||||
// setState(() {
|
||||
// products.removeWhere((e) => e.id == p.id);
|
||||
// });
|
||||
// },
|
||||
// onRemoveAll: (ps) {
|
||||
// for (var e in ps) {
|
||||
// setState(() {
|
||||
// products.removeWhere((p) => p.id == e.id);
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// onContinue: (ps) {
|
||||
// if (products.isEmpty) {
|
||||
// showMsgDialog(context, 'Error', "Please select product");
|
||||
// return false;
|
||||
// }
|
||||
// setState(() {
|
||||
// products = List.from(ps);
|
||||
// currentStep += 1;
|
||||
// });
|
||||
// },
|
||||
// onPrevious: (ps) {
|
||||
// setState(() {
|
||||
// products = List.from(ps);
|
||||
// currentStep -= 1;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
child: CartonSelectionWidget(
|
||||
shipment: _shipment!,
|
||||
cartons: _cartions,
|
||||
onContinue: (cartons) {
|
||||
setState(() {
|
||||
_cartions = List.from(cartons);
|
||||
currentStep += 1;
|
||||
});
|
||||
},
|
||||
onPrevious: (cartons) {
|
||||
setState(() {
|
||||
_cartions = List.from(cartons);
|
||||
currentStep -= 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Expanded(
|
||||
|
||||
Reference in New Issue
Block a user