Added category add/remove (no recolour/rename for now)

This commit is contained in:
Imran Remtulla
2022-12-21 03:08:56 -05:00
parent e2f99c5e71
commit 99d7595f2d
3 changed files with 126 additions and 3 deletions

View File

@@ -1,5 +1,7 @@
// Exposes functions used to save/load app settings
import 'dart:convert';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
@@ -144,4 +146,11 @@ class SettingsProvider with ChangeNotifier {
prefs?.setString(settingId, value);
notifyListeners();
}
Map<String, int> get categories =>
Map<String, int>.from(jsonDecode(prefs?.getString('categories') ?? '{}'));
set categories(Map<String, int> cats) {
prefs?.setString('categories', jsonEncode(cats));
}
}