update package and carton selection

This commit is contained in:
tzw
2024-03-04 17:09:47 +06:30
parent c66734d386
commit 1c4a9c2112
11 changed files with 236 additions and 237 deletions

View File

@@ -1,4 +1,5 @@
import 'package:fcs/pages/widgets/local_radio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:provider/provider.dart';
@@ -7,6 +8,7 @@ import '../../../domain/entities/carton_size.dart';
import '../../../domain/entities/fcs_shipment.dart';
import '../../../helpers/theme.dart';
import '../../domain/entities/user.dart';
import '../carton_size/carton_size_list.dart';
import '../carton_size/model/carton_size_model.dart';
import '../fcs_shipment/model/fcs_shipment_model.dart';
import '../main/util.dart';
@@ -120,7 +122,8 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
@override
Widget build(BuildContext context) {
List<CartonSize> cartonSizes = context.watch<CartonSizeModel>().cartonSizes;
List<CartonSize> cartonSizes =
context.watch<CartonSizeModel>().getCartonSizes;
bool isStandardSize = _cartonSizeType == standardCarton;
bool isCustomSize = _cartonSizeType == customCarton;
bool isNoneDefinedSize = _cartonSizeType == packageCartion;
@@ -277,6 +280,11 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
underline: Container(height: 1, color: Colors.grey),
onChanged: (newValue) {
setState(() {
if (newValue?.name == MANAGE_CARTONSIZE) {
_selectStandardSize = null;
_manageCartonSize();
return;
}
_selectStandardSize = newValue!;
});
},
@@ -285,16 +293,22 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
cartonSizes.map<DropdownMenuItem<CartonSize>>((CartonSize value) {
return DropdownMenuItem<CartonSize>(
value: value,
child: Row(
children: [
Text("${value.name} - ",
child: value.name == MANAGE_CARTONSIZE
? Text("${value.name}",
style: TextStyle(
color: isStandardSize ? Colors.black : labelColor)),
Text(
"${value.length.toInt()}”x${value.width.toInt()}”x${value.height.toInt()}",
style: TextStyle(color: labelColor)),
],
),
color: isStandardSize ? secondaryColor : labelColor))
: Row(
children: [
Text("${value.name} - ",
style: TextStyle(
color: isStandardSize
? Colors.black
: labelColor)),
Text(
"${value.length.toInt()}”x${value.width.toInt()}”x${value.height.toInt()}",
style: TextStyle(color: labelColor)),
],
),
);
}).toList(),
),
@@ -484,4 +498,11 @@ class _CartonSizeWidgetState extends State<CartonSizeWidget> {
],
);
}
_manageCartonSize() {
Navigator.push(
context,
CupertinoPageRoute(builder: (context) => CartonSizeList()),
);
}
}