blob: 3a65731014e00371de64fb69b50142df446c05da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import 'package:flutter/material.dart';
import '../settings/preferences.dart';
class ThemeProvider with ChangeNotifier {
bool synced = false;
ThemeData? _theme;
void syncFromPrefs() {
if (synced) return;
Preferences.getTheme().then((t) {
synced = true;
_theme = t;
notifyListeners();
});
}
ThemeData? get theme => _theme;
set theme(ThemeData? theme) {
Preferences.setTheme(theme);
_theme = theme;
notifyListeners();
}
}
|