add cartion filter and search

This commit is contained in:
tzw
2024-02-07 17:26:29 +06:30
parent 2d4cdb9620
commit caf20f4e67
39 changed files with 1274 additions and 1181 deletions

View File

@@ -1,13 +1,12 @@
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
import 'package:fcs/pages/widgets/local_app_bar.dart';
import 'package:fcs/pages/widgets/local_popupmenu.dart';
import 'package:fcs/domain/vo/local_popupmenu.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart';
import 'package:fcs/pagination/paginator_listview.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';
import '../../domain/entities/fcs_shipment.dart';
import 'fcs_shipment_editor.dart';
@@ -41,14 +40,12 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
Widget build(BuildContext context) {
var shipmentModel = Provider.of<FcsShipmentModel>(context);
return LocalProgress(
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: LocalAppBar(
labelKey: "FCSshipment.list.title", actions: [
//popupMenu,
_menuFilteringWidget(context),
]),
appBar: LocalAppBar(labelKey: "FCSshipment.list.title", actions: [
_menuFilteringWidget(context),
]),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
_newShipment();
@@ -67,7 +64,8 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
Navigator.of(context)
.push(CupertinoPageRoute(builder: (context) => FcsShipmentEditor()));
}
Widget _menuFilteringWidget(BuildContext context) {
Widget _menuFilteringWidget(BuildContext context) {
return PopupMenuButton<LocalPopupMenu>(
splashRadius: 25,
padding: const EdgeInsets.only(right: 15),
@@ -81,10 +79,10 @@ class _FcsShipmentListState extends State<FcsShipmentList> {
await context.read<FcsShipmentModel>().onChanged(choice.id);
},
icon: Stack(
alignment: Alignment.center,
alignment: Alignment.center,
children: <Widget>[
const Icon(
Ionicons.filter,
Icons.filter_list,
color: Colors.white,
),
_selectedIndex != 0

View File

@@ -153,4 +153,22 @@ class FcsShipmentModel extends BaseModel {
Future<String> report(FcsShipment fcsShipment) {
return Services.instance.fcsShipmentService.report(fcsShipment);
}
Future<List<FcsShipment>> getAllShipments() async {
List<FcsShipment> fcsShipments = [];
try {
var snaps = await FirebaseFirestore.instance
.collection("/$fcs_shipment_collection")
.where("is_deleted", isEqualTo: false)
.get(const GetOptions(source: Source.server));
fcsShipments = snaps.docs.map((documentSnapshot) {
var fcs =
FcsShipment.fromMap(documentSnapshot.data(), documentSnapshot.id);
return fcs;
}).toList();
} catch (e) {
log.warning("Error!! $e");
}
return fcsShipments;
}
}