2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 10:15:32 +00:00

Expansion state is now saved on the session level, not per widget

This commit is contained in:
Oliver Walters
2020-04-06 23:01:11 +10:00
parent c7fbe99f53
commit aa8a3602e8
5 changed files with 38 additions and 25 deletions

View File

@ -2,20 +2,37 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'api.dart';
class InvenTreeUserPreferences {
class InvenTreePreferences {
static const String _SERVER = 'server';
static const String _USERNAME = 'username';
static const String _PASSWORD = 'password';
// Ensure we only ever create a single instance of the preferences class
static final InvenTreeUserPreferences _api = new InvenTreeUserPreferences._internal();
/* The following settings are not stored to persistent storage,
* instead they are only used as 'session preferences'.
* They are kept here as a convenience only.
*/
factory InvenTreeUserPreferences() {
// Expand subcategory list in PartCategory view
bool expandCategoryList = false;
// Expand part list in PartCategory view
bool expandPartList = true;
// Expand sublocation list in StockLocation view
bool expandLocationList = false;
// Expand item list in StockLocation view
bool expandStockList = true;
// Ensure we only ever create a single instance of the preferences class
static final InvenTreePreferences _api = new InvenTreePreferences._internal();
factory InvenTreePreferences() {
return _api;
}
InvenTreeUserPreferences._internal();
InvenTreePreferences._internal();
// Load saved login details, and attempt connection
void loadLoginDetails() async {