custom filters
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user