update carton filter and merge api for shipment
This commit is contained in:
@@ -8,8 +8,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../domain/constants.dart';
|
||||
import '../../domain/entities/carton.dart';
|
||||
import '../../pagination/paginator_listview.dart';
|
||||
import '../carton_search/carton_search.dart';
|
||||
@@ -38,10 +36,9 @@ class _CartonListState extends State<CartonList> {
|
||||
|
||||
_init() async {
|
||||
var model = context.read<CartonModel>();
|
||||
_shipments = await context.read<FcsShipmentModel>().getAllShipments();
|
||||
_shipments.insert(0, FcsShipment(shipmentNumber: "All Shipments", id: all));
|
||||
_selectedShipment =
|
||||
model.shipment ?? FcsShipment(shipmentNumber: "All Shipments", id: all);
|
||||
_shipments = await context.read<FcsShipmentModel>().getShipments();
|
||||
_shipments.insert(0, model.defaultShipment);
|
||||
_selectedShipment = model.shipment ?? model.defaultShipment;
|
||||
model.loadPaginationCartons();
|
||||
|
||||
if (mounted) {
|
||||
@@ -309,7 +306,7 @@ class _CartonListState extends State<CartonList> {
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
await showModalBottomSheet(
|
||||
bool? updated = await showModalBottomSheet(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
isScrollControlled: true,
|
||||
@@ -323,6 +320,12 @@ class _CartonListState extends State<CartonList> {
|
||||
expand: false,
|
||||
builder: (_, controller) =>
|
||||
CartonFilter(controller: controller)));
|
||||
var model = context.read<CartonModel>();
|
||||
if (updated ?? false) {
|
||||
setState(() {
|
||||
_selectedShipment = model.shipment ?? model.defaultShipment;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user