mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-14 03:56:24 +00:00
Allow search widget to be constructed with or without an app bar
This commit is contained in:
parent
b6a5af08d8
commit
a3597c5d61
4 changed files with 31 additions and 11 deletions
|
|
@ -21,16 +21,33 @@ import "package:inventree/widget/location_list.dart";
|
|||
// Widget for performing database-wide search
|
||||
class SearchWidget extends StatefulWidget {
|
||||
|
||||
SearchWidget(this.hasAppbar);
|
||||
|
||||
final bool hasAppbar;
|
||||
|
||||
@override
|
||||
_SearchDisplayState createState() => _SearchDisplayState();
|
||||
_SearchDisplayState createState() => _SearchDisplayState(hasAppbar);
|
||||
|
||||
}
|
||||
|
||||
class _SearchDisplayState extends State<SearchWidget> {
|
||||
class _SearchDisplayState extends RefreshableState<SearchWidget> {
|
||||
|
||||
_SearchDisplayState(this.hasAppBar) : super();
|
||||
|
||||
final bool hasAppBar;
|
||||
|
||||
@override
|
||||
String getAppBarTitle(BuildContext context) => L10().search;
|
||||
|
||||
@override
|
||||
AppBar? buildAppBar(BuildContext context) {
|
||||
if (hasAppBar) {
|
||||
return super.buildAppBar(context);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
final TextEditingController searchController = TextEditingController();
|
||||
|
||||
Timer? debounceTimer;
|
||||
|
|
@ -333,7 +350,7 @@ class _SearchDisplayState extends State<SearchWidget> {
|
|||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget getBody(BuildContext context) {
|
||||
return Center(
|
||||
child: ListView(
|
||||
children: ListTile.divideTiles(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue