2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 10:45:29 +00:00

Stock display (#379)

* Display stock quantity more prominently

* Cleanup search widget

* Update for stock_detail widget

* More tweaks

* Change bottom bar icon

* Display boolean parameters appropriately

* Adds ability to edit part parameters

* Bump icon size a bit

* Improvements to filter options

- Allow filtering by "option" type
- To start with, filter stock by status code

* Remove debug message

* Remove getTriState method

- No longer needed
- Remove associated unit tests

* Adjust filters based on server API version

* Muted colors
This commit is contained in:
Oliver
2023-06-24 11:34:42 +10:00
committed by GitHub
parent 8076887e39
commit e9eb84eace
20 changed files with 278 additions and 167 deletions

View File

@ -126,7 +126,12 @@ class InvenTreeSettingsManager {
Future<dynamic> getValue(String key, dynamic backup) async {
final value = await store.record(key).get(await _db);
dynamic value = await store.record(key).get(await _db);
// Retrieve value
if (value == "__null__") {
value = null;
}
if (value == null) {
return backup;
@ -148,32 +153,11 @@ class InvenTreeSettingsManager {
}
}
// Load a tristate (true / false / null) setting
Future<bool?> getTriState(String key, dynamic backup) async {
final dynamic value = await getValue(key, backup);
if (value == null) {
return null;
} else if (value is bool) {
return value;
} else {
String s = value.toString().toLowerCase();
if (s.contains("t")) {
return true;
} else if (s.contains("f")) {
return false;
} else {
return null;
}
}
}
// Store a key:value pair in the database
Future<void> setValue(String key, dynamic value) async {
// Encode null values as strings
value ??= "null";
value ??= "__null__";
await store.record(key).put(await _db, value);
}