mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
The "search" window is now a tab on the main screen
This commit is contained in:
parent
102b4e021b
commit
3fa68ec6da
@ -230,6 +230,9 @@ class InvenTreeAPI {
|
|||||||
|
|
||||||
int get apiVersion => _apiVersion;
|
int get apiVersion => _apiVersion;
|
||||||
|
|
||||||
|
// Notification support requires API v25 or newer
|
||||||
|
bool get supportsNotifications => isConnected() && apiVersion >= 25;
|
||||||
|
|
||||||
// Are plugins enabled on the server?
|
// Are plugins enabled on the server?
|
||||||
bool _pluginsEnabled = false;
|
bool _pluginsEnabled = false;
|
||||||
|
|
||||||
|
@ -308,6 +308,9 @@
|
|||||||
"description": "history"
|
"description": "history"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"home": "Home",
|
||||||
|
"@homeScreen": {},
|
||||||
|
|
||||||
"homeScreen": "Home Screen",
|
"homeScreen": "Home Screen",
|
||||||
"@homeScreen": {},
|
"@homeScreen": {},
|
||||||
|
|
||||||
@ -461,6 +464,9 @@
|
|||||||
"description": "Notes"
|
"description": "Notes"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"notifications": "Notifications",
|
||||||
|
"@notifications": {},
|
||||||
|
|
||||||
"noResponse": "No Response from Server",
|
"noResponse": "No Response from Server",
|
||||||
"@noResponse": {},
|
"@noResponse": {},
|
||||||
|
|
||||||
|
@ -174,7 +174,6 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
icon: FaIcon(FontAwesomeIcons.shapes),
|
icon: FaIcon(FontAwesomeIcons.shapes),
|
||||||
label: L10().parts,
|
label: L10().parts,
|
||||||
),
|
),
|
||||||
// TODO - Add the "actions" item back in
|
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: FaIcon(FontAwesomeIcons.wrench),
|
icon: FaIcon(FontAwesomeIcons.wrench),
|
||||||
label: L10().actions
|
label: L10().actions
|
||||||
|
@ -41,6 +41,9 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Index of bottom navigation bar
|
||||||
|
int _tabIndex = 0;
|
||||||
|
|
||||||
bool homeShowPo = false;
|
bool homeShowPo = false;
|
||||||
bool homeShowSubscribed = false;
|
bool homeShowSubscribed = false;
|
||||||
bool homeShowManufacturers = false;
|
bool homeShowManufacturers = false;
|
||||||
@ -52,17 +55,6 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
// Selected user profile
|
// Selected user profile
|
||||||
UserProfile? _profile;
|
UserProfile? _profile;
|
||||||
|
|
||||||
void _search(BuildContext context) {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => SearchWidget()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void _scan(BuildContext context) {
|
void _scan(BuildContext context) {
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
@ -224,16 +216,6 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
// Search widget
|
|
||||||
tiles.add(_listTile(
|
|
||||||
context,
|
|
||||||
L10().search,
|
|
||||||
FontAwesomeIcons.search,
|
|
||||||
callback: () {
|
|
||||||
_search(context);
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
// Parts
|
// Parts
|
||||||
tiles.add(_listTile(
|
tiles.add(_listTile(
|
||||||
context,
|
context,
|
||||||
@ -327,6 +309,52 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
return tiles;
|
return tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the main body widget for display.
|
||||||
|
* This depends on the current value of _tabIndex
|
||||||
|
*/
|
||||||
|
Widget getBody(BuildContext context) {
|
||||||
|
switch (_tabIndex) {
|
||||||
|
case 1: // Search widget
|
||||||
|
return SearchWidget();
|
||||||
|
case 2: // Notification widget
|
||||||
|
case 0: // Home widget
|
||||||
|
default:
|
||||||
|
return ListView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
children: getListTiles(context),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Construct the bottom navigation bar
|
||||||
|
*/
|
||||||
|
List<BottomNavigationBarItem> getNavBarItems(BuildContext context) {
|
||||||
|
|
||||||
|
List<BottomNavigationBarItem> items = <BottomNavigationBarItem>[
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.home),
|
||||||
|
label: L10().home,
|
||||||
|
),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.search),
|
||||||
|
label: L10().search,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
if (InvenTreeAPI().supportsNotifications) {
|
||||||
|
items.add(
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.bell),
|
||||||
|
label: L10().notifications,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
@ -345,10 +373,16 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
drawer: InvenTreeDrawer(context),
|
drawer: InvenTreeDrawer(context),
|
||||||
body: ListView(
|
body: getBody(context),
|
||||||
scrollDirection: Axis.vertical,
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
children: getListTiles(context),
|
currentIndex: _tabIndex,
|
||||||
)
|
onTap: (int index) {
|
||||||
|
setState(() {
|
||||||
|
_tabIndex = index;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items: getNavBarItems(context),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class SearchWidget extends StatefulWidget {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SearchDisplayState extends RefreshableState<SearchWidget> {
|
class _SearchDisplayState extends State<SearchWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) => L10().search;
|
String getAppBarTitle(BuildContext context) => L10().search;
|
||||||
@ -333,7 +333,7 @@ class _SearchDisplayState extends RefreshableState<SearchWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget getBody(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Center(
|
return Center(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: ListTile.divideTiles(
|
children: ListTile.divideTiles(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user