add cartion filter and search
This commit is contained in:
@@ -2,9 +2,6 @@ import 'package:fcs/domain/entities/carton.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/carton/model/carton_model.dart';
|
||||
import 'package:fcs/pages/widgets/barcode_scanner.dart';
|
||||
import 'package:fcs/pages/widgets/local_popup_menu_button.dart';
|
||||
import 'package:fcs/pages/widgets/local_popupmenu.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';
|
||||
@@ -50,32 +47,12 @@ class PartSearchDelegate extends SearchDelegate<Carton> {
|
||||
|
||||
@override
|
||||
List<Widget> buildActions(BuildContext context) {
|
||||
var boxModel = Provider.of<CartonModel>(context);
|
||||
final popupMenu =
|
||||
StatefulBuilder(builder: (BuildContext context, StateSetter setState) {
|
||||
return LocalPopupMenuButton(
|
||||
popmenus: [
|
||||
LocalPopupMenu(
|
||||
id: 1,
|
||||
textKey: "box.weight",
|
||||
selected: boxModel.selectedIndexFilter == 1),
|
||||
LocalPopupMenu(
|
||||
id: 2,
|
||||
textKey: "box.name",
|
||||
selected: boxModel.selectedIndexFilter == 2)
|
||||
],
|
||||
popupMenuCallback: (p) => setState(() {
|
||||
boxModel.selectedIndexFilter = p.id;
|
||||
}));
|
||||
});
|
||||
|
||||
return [
|
||||
IconButton(
|
||||
icon: Icon(MaterialCommunityIcons.barcode_scan,
|
||||
size: 30, color: Colors.white),
|
||||
onPressed: () => _scan(context),
|
||||
),
|
||||
popupMenu,
|
||||
IconButton(
|
||||
icon: Icon(Icons.clear),
|
||||
onPressed: () => query = '',
|
||||
@@ -113,7 +90,6 @@ class PartSearchDelegate extends SearchDelegate<Carton> {
|
||||
child: ListView(
|
||||
children: snapshot.data!
|
||||
.map((u) => CartonListRow(
|
||||
key: ValueKey(u.id),
|
||||
carton: u,
|
||||
callbackCartonSelect: callbackCartonSelect,
|
||||
))
|
||||
@@ -143,18 +119,12 @@ class PartSearchDelegate extends SearchDelegate<Carton> {
|
||||
|
||||
@override
|
||||
Widget buildSuggestions(BuildContext context) {
|
||||
final cartonModel = Provider.of<CartonModel>(context);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 5),
|
||||
child: PaginatorListView<Carton>(
|
||||
paginatorListener: cartonModel.cartonsByFilter!,
|
||||
rowBuilder: (c) => CartonListRow(
|
||||
key: ValueKey(c.id),
|
||||
carton: c,
|
||||
callbackCartonSelect: callbackCartonSelect,
|
||||
),
|
||||
color: primaryColor,
|
||||
child: Center(
|
||||
child: Opacity(
|
||||
opacity: 0.2,
|
||||
child: Icon(MaterialCommunityIcons.package,
|
||||
size: 200, color: primaryColor)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user