2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-22 23:10:48 +00:00

UX Overhaul ()

* Add "global actions" to title bar

* Implement actions

* Add "speed dial" action buttons

* tweak global action icons

* Refactor actions for "stock item" display

* Refactor "part" detail

* part category

* SupplierPart

* More updates

* Add BottomAppBar

* Add a global bottom app bar

* Move "edit" buttons back to the app bar

* tweaks

* Updates to drawer navigation menu

* home screen improvements

* text tweaks

* Fix appBarTitle for notifications widget

* Update "tabs" for category display

* Fix for attachment widget

* Update tabs for purchaseorder view

* Update part display

* Cleanup

* Add "BOM" tab to part detail widget

* Paginated list search cleanup

* Update release notes

* Update old function

* linting

* linting

* Tweaks to bottomappbar

- Increase icon size slightly
- Adjust "actions" icon
This commit is contained in:
Oliver
2023-04-08 23:59:11 +10:00
committed by GitHub
parent 74176cdda8
commit a8f87e2f5a
38 changed files with 979 additions and 1159 deletions

@ -13,15 +13,12 @@ import "package:inventree/settings/login.dart";
import "package:inventree/settings/settings.dart";
import "package:inventree/user_profile.dart";
import "package:inventree/inventree/notification.dart";
import "package:inventree/widget/category_display.dart";
import "package:inventree/widget/drawer.dart";
import "package:inventree/widget/location_display.dart";
import "package:inventree/widget/notifications.dart";
import "package:inventree/widget/part_list.dart";
import "package:inventree/widget/purchase_order_list.dart";
import "package:inventree/widget/search.dart";
import "package:inventree/widget/refreshable_state.dart";
import "package:inventree/widget/snacks.dart";
import "package:inventree/widget/spinner.dart";
import "package:inventree/widget/company_list.dart";
@ -35,7 +32,8 @@ class InvenTreeHomePage extends StatefulWidget {
_InvenTreeHomePageState createState() => _InvenTreeHomePageState();
}
class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
class _InvenTreeHomePageState extends State<InvenTreeHomePage> with BaseWidgetProperties {
_InvenTreeHomePageState() : super() {
// Load display settings
@ -64,11 +62,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
});
}
// Index of bottom navigation bar
int _tabIndex = 0;
// Number of outstanding notifications
int _notificationCounter = 0;
final homeKey = GlobalKey<ScaffoldState>();
bool homeShowPo = false;
bool homeShowSubscribed = false;
@ -76,8 +70,6 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
bool homeShowCustomers = false;
bool homeShowSuppliers = false;
final GlobalKey<_InvenTreeHomePageState> _homeKey = GlobalKey<_InvenTreeHomePageState>();
// Selected user profile
UserProfile? _profile;
@ -202,10 +194,10 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
return;
}
final notifications = await InvenTreeNotification().list();
// final notifications = await InvenTreeNotification().list();
setState(() {
_notificationCounter = notifications.length;
// _notificationCounter = notifications.length;
});
}
@ -416,78 +408,17 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
* Return the main body widget for display.
* This depends on the current value of _tabIndex
*/
@override
Widget getBody(BuildContext context) {
if (!InvenTreeAPI().isConnected()) {
return _connectionStatusWidget(context);
}
switch (_tabIndex) {
case 1: // Search widget
return SearchWidget(false);
case 2: // Notification widget
return NotificationWidget();
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.house),
label: L10().home,
),
BottomNavigationBarItem(
icon: FaIcon(FontAwesomeIcons.magnifyingGlass),
label: L10().search,
),
];
if (InvenTreeAPI().supportsNotifications) {
items.add(
BottomNavigationBarItem(
icon: _notificationCounter == 0 ? FaIcon(FontAwesomeIcons.bell) : Stack(
children: <Widget>[
FaIcon(FontAwesomeIcons.bell),
Positioned(
right: 0,
child: Container(
padding: EdgeInsets.all(2),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(20),
),
constraints: BoxConstraints(
minWidth: 12,
minHeight: 12,
),
child: Text(
"${_notificationCounter}",
style: TextStyle(
color: Colors.white,
fontSize: 9,
),
textAlign: TextAlign.center,
),
),
)
],
),
label: L10().notifications,
)
);
}
return items;
return ListView(
scrollDirection: Axis.vertical,
children: getListTiles(context),
);
}
@override
@ -497,7 +428,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
var connecting = !connected && InvenTreeAPI().isConnecting();
return Scaffold(
key: _homeKey,
key: homeKey,
appBar: AppBar(
title: Text(L10().appTitle),
actions: [
@ -512,17 +443,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
),
drawer: InvenTreeDrawer(context),
body: getBody(context),
bottomNavigationBar: connected ? BottomNavigationBar(
currentIndex: _tabIndex,
onTap: (int index) {
setState(() {
_tabIndex = index;
});
_refreshNotifications();
},
items: getNavBarItems(context),
) : null,
bottomNavigationBar: InvenTreeAPI().isConnected() ? buildBottomAppBar(context, homeKey) : null,
);
}
}