custom filters

This commit is contained in:
davmar
2026-09-10 17:23:07 +02:00
parent 83295439d5
commit 2727f1baf2
15 changed files with 757 additions and 232 deletions
+22
View File
@@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../models/bank.dart';
import '../models/home_built_in_sections.dart';
import '../models/home_filter_widget.dart';
import '../models/overview_favourite.dart';
import '../models/transaction_meta.dart';
@@ -183,6 +184,27 @@ class StorageService {
return _prefs.setString(StorageKeys.homeFilterWidgets, encoded);
}
HomeBuiltInSections loadHomeBuiltInSections() {
final raw = _prefs.getString(StorageKeys.homeBuiltInSections);
if (raw == null || raw.isEmpty) return HomeBuiltInSections.defaults;
try {
final decoded = jsonDecode(raw);
if (decoded is! Map) return HomeBuiltInSections.defaults;
return HomeBuiltInSections.fromJson(
Map<String, dynamic>.from(decoded),
);
} catch (_) {
return HomeBuiltInSections.defaults;
}
}
Future<void> saveHomeBuiltInSections(HomeBuiltInSections sections) {
return _prefs.setString(
StorageKeys.homeBuiltInSections,
jsonEncode(sections.toJson()),
);
}
bool get useRemoteData => _prefs.getBool(StorageKeys.useRemoteData) ?? false;
Future<void> setUseRemoteData(bool value) {