add persisted theme toggle to RequestEditorPaneHome

This commit is contained in:
Matthew Krohn
2023-04-04 15:49:59 -07:00
parent 90823513ac
commit a7154aadfb
4 changed files with 84 additions and 2 deletions

View File

@@ -6,6 +6,9 @@ const String kDataBox = "data";
// sequence of ids
const String kDataBoxIds = "ids";
// dark theme boolean
const String kDataBoxTheme = "theme";
Future<void> openBoxes() async {
await Hive.initFlutter();
await Hive.openBox(kDataBox);
@@ -18,6 +21,9 @@ class HiveHandler {
dataBox = Hive.box(kDataBox);
}
dynamic getTheme() => dataBox.get(kDataBoxTheme);
Future<void> setTheme(bool? theme) => dataBox.put(kDataBoxTheme, theme);
dynamic getIds() => dataBox.get(kDataBoxIds);
Future<void> setIds(List<String>? ids) => dataBox.put(kDataBoxIds, ids);