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

Add separate search icons from home page

This commit is contained in:
Oliver Walters 2021-02-13 01:04:50 +11:00
parent 5c7629d4d1
commit 135b752d51
3 changed files with 46 additions and 16 deletions

@ -1 +1 @@
Subproject commit 045288ea2a1d6b2248de084fdbacafc2256e1313
Subproject commit cf76a2a70e96e49991a63bbde6d45911caaaf05f

View File

@ -41,7 +41,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
BuildContext _context;
void _search() {
void _searchParts() {
if (!InvenTreeAPI().checkConnection(context)) return;
showSearch(
@ -50,6 +50,15 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
);
}
void _searchStock() {
if (!InvenTreeAPI().checkConnection(context)) return;
showSearch(
context: context,
delegate: StockSearchDelegate()
);
}
void _scan(BuildContext context) {
if (!InvenTreeAPI().checkConnection(context)) return;
@ -207,11 +216,13 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
appBar: AppBar(
title: Text(I18N.of(context).appTitle),
actions: <Widget>[
/*
IconButton(
icon: FaIcon(FontAwesomeIcons.search),
tooltip: I18N.of(context).search,
onPressed: _search,
onPressed: _searchParts,
),
*/
],
),
drawer: new InvenTreeDrawer(context),
@ -225,17 +236,6 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
children: <Widget>[
IconButton(
icon: new FaIcon(FontAwesomeIcons.search),
tooltip: I18N.of(context).search,
onPressed: _search,
),
Text(I18N.of(context).search),
],
),
Column(
children: <Widget>[
IconButton(
@ -262,6 +262,19 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
Text(I18N.of(context).parts),
],
),
Column(
children: <Widget>[
IconButton(
icon: new FaIcon(FontAwesomeIcons.search),
tooltip: I18N.of(context).searchParts,
onPressed: _searchParts,
),
Text(I18N.of(context).searchParts),
],
),
// TODO - Re-add starred parts link
/*
Column(
children: <Widget>[
IconButton(
@ -273,6 +286,13 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
Text("Starred Parts"),
]
),
*/
],
),
Spacer(),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
children: <Widget>[
IconButton(
@ -283,7 +303,17 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
Text(I18N.of(context).stock),
],
),
],
Column(
children: <Widget>[
IconButton(
icon: new FaIcon(FontAwesomeIcons.search),
tooltip: I18N.of(context).searchStock,
onPressed: _searchStock,
),
Text(I18N.of(context).searchStock),
],
),
]
),
Spacer(),
// TODO - Re-add these when the features actually do something..

View File

@ -267,7 +267,7 @@ class StockSearchDelegate extends SearchDelegate<InvenTreeStockItem> {
return ListTile(
title: Text(item.partName),
subtitle: Text(item.partDescription),
subtitle: Text(item.locationName),
leading: InvenTreeAPI().getImage(
item.partThumbnail,
width: 40,