update carton list

This commit is contained in:
tzw
2024-02-15 16:41:49 +06:30
parent 2993ed78a3
commit ad5e61a6af
4 changed files with 144 additions and 97 deletions

View File

@@ -28,6 +28,7 @@ class _CartonListState extends State<CartonList> {
bool _isLoading = false;
List<FcsShipment> _shipments = [];
FcsShipment? _selectedShipment;
bool _down = true;
@override
void initState() {
@@ -120,105 +121,151 @@ class _CartonListState extends State<CartonList> {
),
body: Column(
children: [
shipmentFilterBox,
Wrap(
runSpacing: 8,
children: [
cartonModel.filterByConsingee != null
? Padding(
padding: const EdgeInsets.only(left: 15),
child: Row(
AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
transitionBuilder: (Widget child, Animation<double> animation) =>
FadeTransition(
opacity: animation,
child: SizeTransition(
child: child,
sizeFactor: animation,
axis: Axis.vertical,
),
),
child: _down
? Column(
children: [
shipmentFilterBox,
Wrap(
runSpacing: 8,
children: [
Wrap(
children: [
Row(
children: [
const Text("Consignee: ",
style: TextStyle(
fontSize: 12, color: Colors.grey)),
Text(
cartonModel.filterByConsingee!.name ??
"",
style: const TextStyle(
fontSize: 12, color: Colors.black)),
const SizedBox(width: 3),
Text(
cartonModel.filterByConsingee!.fcsID ??
"",
style: const TextStyle(
fontSize: 12, color: labelColor)),
],
)
],
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: InkResponse(
radius: 30,
onTap: () {
context
.read<CartonModel>()
.clearFilterConsignee();
},
child: const Icon(AntDesign.closecircleo,
size: 20, color: dangerColor),
),
)
cartonModel.filterByConsingee != null
? Padding(
padding: const EdgeInsets.only(left: 15),
child: Row(
children: [
Wrap(
children: [
Row(
children: [
const Text("Consignee: ",
style: TextStyle(
fontSize: 12,
color: Colors.grey)),
Text(
cartonModel
.filterByConsingee!
.name ??
"",
style: const TextStyle(
fontSize: 12,
color: Colors.black)),
const SizedBox(width: 3),
Text(
cartonModel
.filterByConsingee!
.fcsID ??
"",
style: const TextStyle(
fontSize: 12,
color: labelColor)),
],
)
],
),
Padding(
padding:
const EdgeInsets.only(left: 5),
child: InkResponse(
radius: 30,
onTap: () {
context
.read<CartonModel>()
.clearFilterConsignee();
},
child: const Icon(
AntDesign.closecircleo,
size: 20,
color: dangerColor),
),
)
],
),
)
: const SizedBox(),
cartonModel.filterBySender != null
? Padding(
padding: const EdgeInsets.only(left: 15),
child: Row(
children: [
Wrap(
children: [
Row(
children: [
const Text("Sender: ",
style: TextStyle(
fontSize: 12,
color: Colors.grey)),
Text(
cartonModel.filterBySender!
.name ??
"",
style: const TextStyle(
fontSize: 12,
color: Colors.black)),
const SizedBox(width: 3),
Text(
cartonModel.filterBySender!
.fcsID ??
"",
style: const TextStyle(
fontSize: 12,
color: labelColor)),
],
)
],
),
Padding(
padding:
const EdgeInsets.only(left: 5),
child: InkResponse(
radius: 30,
onTap: () {
context
.read<CartonModel>()
.clearFilterSender();
},
child: const Icon(
AntDesign.closecircleo,
size: 20,
color: dangerColor),
),
)
],
),
)
: const SizedBox(),
],
),
)
: const SizedBox(),
cartonModel.filterBySender != null
? Padding(
padding: const EdgeInsets.only(left: 15),
child: Row(
children: [
Wrap(
children: [
Row(
children: [
const Text("Sender: ",
style: TextStyle(
fontSize: 12, color: Colors.grey)),
Text(cartonModel.filterBySender!.name ?? "",
style: const TextStyle(
fontSize: 12, color: Colors.black)),
const SizedBox(width: 3),
Text(
cartonModel.filterBySender!.fcsID ?? "",
style: const TextStyle(
fontSize: 12, color: labelColor)),
],
)
],
),
Padding(
padding: const EdgeInsets.only(left: 5),
child: InkResponse(
radius: 30,
onTap: () {
context
.read<CartonModel>()
.clearFilterSender();
},
child: const Icon(AntDesign.closecircleo,
size: 20, color: dangerColor),
),
)
],
),
)
: const SizedBox(),
],
Divider(color: Colors.grey.shade400),
],
)
: const SizedBox(),
),
Divider(color: Colors.grey.shade400),
Expanded(
child: cartonModel.getBoxes == null
? const SizedBox()
: PaginatorListView<Carton>(
paginatorListener: cartonModel.getBoxes!,
rowBuilder: (p) => CartonListRow(box: p),
color: primaryColor),
color: primaryColor,
onScroll: ((down) {
if (_down == down) return;
setState(() {
_down = down;
});
}),
),
),
],
),