2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-05-05 08:48:55 +00:00

Updates to search controller

This commit is contained in:
Oliver Walters 2022-05-04 11:53:11 +10:00
parent 6533cc4af6
commit 7ef7096e26
4 changed files with 14 additions and 10 deletions

View File

@ -640,6 +640,9 @@
"quantityPositive": "Quantity must be positive", "quantityPositive": "Quantity must be positive",
"@quantityPositive": {}, "@quantityPositive": {},
"queryEmpty": "Enter search query",
"@queryEmpty": {},
"queryNoResults": "No results for query", "queryNoResults": "No results for query",
"@queryNoResults": {}, "@queryNoResults": {},

View File

@ -378,11 +378,11 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
icon: _notificationCounter == 0 ? FaIcon(FontAwesomeIcons.bell) : Stack( icon: _notificationCounter == 0 ? FaIcon(FontAwesomeIcons.bell) : Stack(
children: <Widget>[ children: <Widget>[
FaIcon(FontAwesomeIcons.bell), FaIcon(FontAwesomeIcons.bell),
new Positioned( Positioned(
right: 0, right: 0,
child: new Container( child: Container(
padding: EdgeInsets.all(2), padding: EdgeInsets.all(2),
decoration: new BoxDecoration( decoration: BoxDecoration(
color: Colors.red, color: Colors.red,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
@ -390,9 +390,9 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
minWidth: 12, minWidth: 12,
minHeight: 12, minHeight: 12,
), ),
child: new Text( child: Text(
"${_notificationCounter}", "${_notificationCounter}",
style: new TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 9, fontSize: 9,
), ),

View File

@ -1,6 +1,4 @@
import "package:flutter/cupertino.dart";
import "package:flutter/material.dart"; import "package:flutter/material.dart";
import "package:font_awesome_flutter/font_awesome_flutter.dart"; import "package:font_awesome_flutter/font_awesome_flutter.dart";

View File

@ -21,7 +21,7 @@ import "package:inventree/widget/location_list.dart";
// Widget for performing database-wide search // Widget for performing database-wide search
class SearchWidget extends StatefulWidget { class SearchWidget extends StatefulWidget {
SearchWidget(this.hasAppbar); const SearchWidget(this.hasAppbar);
final bool hasAppbar; final bool hasAppbar;
@ -172,12 +172,15 @@ class _SearchDisplayState extends RefreshableState<SearchWidget> {
child: ListTile( child: ListTile(
title: TextField( title: TextField(
readOnly: false, readOnly: false,
decoration: InputDecoration(
helperText: L10().queryEmpty,
),
controller: searchController, controller: searchController,
onChanged: (String text) { onChanged: (String text) {
onSearchTextChanged(text); onSearchTextChanged(text);
}, },
), ),
leading: IconButton( trailing: IconButton(
icon: FaIcon(FontAwesomeIcons.backspace, color: Colors.red), icon: FaIcon(FontAwesomeIcons.backspace, color: Colors.red),
onPressed: () { onPressed: () {
searchController.clear(); searchController.clear();
@ -332,7 +335,7 @@ class _SearchDisplayState extends RefreshableState<SearchWidget> {
); );
} }
if (results.isEmpty) { if (results.isEmpty && searchController.text.isNotEmpty) {
tiles.add( tiles.add(
ListTile( ListTile(
title: Text(L10().queryNoResults), title: Text(L10().queryNoResults),