update carton filter
This commit is contained in:
@@ -118,6 +118,7 @@ const carton_invoiced_status = "invoiced";
|
|||||||
const carton_canceled_status = "canceled";
|
const carton_canceled_status = "canceled";
|
||||||
const all_status = "All stauts";
|
const all_status = "All stauts";
|
||||||
const all = "All";
|
const all = "All";
|
||||||
|
const see_all ="See All";
|
||||||
|
|
||||||
// shipment status
|
// shipment status
|
||||||
const shipment_pending_status = "pending";
|
const shipment_pending_status = "pending";
|
||||||
|
|||||||
@@ -486,11 +486,9 @@ class _CartonFilterState extends State<CartonFilter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_clearFilter() async {
|
_clearFilter() async {
|
||||||
await context.read<CartonModel>().filterCarton(
|
var model = context.read<CartonModel>();
|
||||||
FcsShipment(shipmentNumber: "All shipments", id: all),
|
await model.filterCarton(model.defaultShipment, User(id: all, name: "All"),
|
||||||
User(id: all, name: "All"),
|
User(id: all, name: "All"), all_status);
|
||||||
User(id: all, name: "All"),
|
|
||||||
all_status);
|
|
||||||
Navigator.pop(context, true);
|
Navigator.pop(context, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import '../../domain/constants.dart';
|
||||||
import '../../domain/entities/carton.dart';
|
import '../../domain/entities/carton.dart';
|
||||||
import '../../pagination/paginator_listview.dart';
|
import '../../pagination/paginator_listview.dart';
|
||||||
import '../carton_search/carton_search.dart';
|
import '../carton_search/carton_search.dart';
|
||||||
@@ -38,6 +39,11 @@ class _CartonListState extends State<CartonList> {
|
|||||||
var model = context.read<CartonModel>();
|
var model = context.read<CartonModel>();
|
||||||
_shipments = await context.read<FcsShipmentModel>().getShipments();
|
_shipments = await context.read<FcsShipmentModel>().getShipments();
|
||||||
_shipments.insert(0, model.defaultShipment);
|
_shipments.insert(0, model.defaultShipment);
|
||||||
|
if (_shipments.length > shipmentCountForCartonFilter) {
|
||||||
|
_shipments.insert(_shipments.length,
|
||||||
|
FcsShipment(shipmentNumber: "See All", id: see_all));
|
||||||
|
}
|
||||||
|
|
||||||
_selectedShipment = model.shipment ?? model.defaultShipment;
|
_selectedShipment = model.shipment ?? model.defaultShipment;
|
||||||
model.loadPaginationCartons();
|
model.loadPaginationCartons();
|
||||||
|
|
||||||
@@ -66,18 +72,22 @@ class _CartonListState extends State<CartonList> {
|
|||||||
child: ActionChip(
|
child: ActionChip(
|
||||||
shape: StadiumBorder(
|
shape: StadiumBorder(
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
color: _selectedShipment?.id == g.id
|
color: g.id == see_all
|
||||||
? primaryColor
|
? Colors.transparent
|
||||||
: Colors.grey.shade300)),
|
: _selectedShipment?.id == g.id
|
||||||
|
? primaryColor
|
||||||
|
: Colors.grey.shade300)),
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_filterShipment(g);
|
_filterShipment(g);
|
||||||
},
|
},
|
||||||
label: Text(g.shipmentNumber ?? "",
|
label: Text(g.shipmentNumber ?? "",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: _selectedShipment?.id == g.id
|
color: g.id == see_all
|
||||||
? primaryColor
|
? primaryColor
|
||||||
: labelColor,
|
: _selectedShipment?.id == g.id
|
||||||
|
? primaryColor
|
||||||
|
: labelColor,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontFamily: "Poppins")),
|
fontFamily: "Poppins")),
|
||||||
@@ -289,7 +299,8 @@ class _CartonListState extends State<CartonList> {
|
|||||||
),
|
),
|
||||||
model.filterByStatus != null ||
|
model.filterByStatus != null ||
|
||||||
model.filterBySender != null ||
|
model.filterBySender != null ||
|
||||||
model.filterByConsingee != null
|
model.filterByConsingee != null ||
|
||||||
|
model.shipment != null
|
||||||
? Positioned(
|
? Positioned(
|
||||||
bottom: 15,
|
bottom: 15,
|
||||||
right: 0,
|
right: 0,
|
||||||
@@ -305,31 +316,38 @@ class _CartonListState extends State<CartonList> {
|
|||||||
: Container()
|
: Container()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () {
|
||||||
bool? updated = await showModalBottomSheet(
|
_showFilter();
|
||||||
context: context,
|
|
||||||
useRootNavigator: true,
|
|
||||||
isScrollControlled: true,
|
|
||||||
useSafeArea: true,
|
|
||||||
shape: const RoundedRectangleBorder(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.vertical(top: Radius.circular(10))),
|
|
||||||
builder: (ctx) => DraggableScrollableSheet(
|
|
||||||
initialChildSize: 0.6,
|
|
||||||
minChildSize: 0.6,
|
|
||||||
expand: false,
|
|
||||||
builder: (_, controller) =>
|
|
||||||
CartonFilter(controller: controller)));
|
|
||||||
var model = context.read<CartonModel>();
|
|
||||||
if (updated ?? false) {
|
|
||||||
setState(() {
|
|
||||||
_selectedShipment = model.shipment ?? model.defaultShipment;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_showFilter() async {
|
||||||
|
bool? updated = await showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
useSafeArea: true,
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.vertical(top: Radius.circular(10))),
|
||||||
|
builder: (ctx) => DraggableScrollableSheet(
|
||||||
|
initialChildSize: 0.6,
|
||||||
|
minChildSize: 0.6,
|
||||||
|
expand: false,
|
||||||
|
builder: (_, controller) => CartonFilter(controller: controller)));
|
||||||
|
var model = context.read<CartonModel>();
|
||||||
|
if (updated ?? false) {
|
||||||
|
setState(() {
|
||||||
|
_selectedShipment = model.shipment ?? model.defaultShipment;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_filterShipment(FcsShipment shipment) async {
|
_filterShipment(FcsShipment shipment) async {
|
||||||
|
if (shipment.id == see_all) {
|
||||||
|
_showFilter();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedShipment = shipment;
|
_selectedShipment = shipment;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user