mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-31 05:15:42 +00:00 
			
		
		
		
	Add separate search icons from home page
This commit is contained in:
		| @@ -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.. | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user