mirror of
https://github.com/stonega/tsacdop
synced 2025-01-24 04:32:28 +01:00
7ba0552717
modified: lib/episodes/episodedetail.dart modified: lib/home/appbar/about.dart modified: lib/home/appbar/addpodcast.dart modified: lib/home/appbar/importompl.dart modified: lib/home/appbar/popupmenu.dart modified: lib/home/audio_player.dart modified: lib/home/audiopanel.dart modified: lib/home/homescroll.dart modified: lib/home/hometab.dart modified: lib/local_storage/key_value_storage.dart modified: lib/main.dart modified: lib/podcasts/podcastdetail.dart modified: lib/podcasts/podcastgroup.dart modified: lib/podcasts/podcastlist.dart modified: lib/podcasts/podcastmanage.dart modified: lib/util/episodegrid.dart
31 lines
635 B
Dart
31 lines
635 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:tsacdop/local_storage/key_value_storage.dart';
|
|
|
|
class SettingState extends ChangeNotifier {
|
|
KeyValueStorage storage = KeyValueStorage('themes');
|
|
int _theme;
|
|
|
|
int get theme => _theme;
|
|
void setTheme(int theme) {
|
|
_theme = theme;
|
|
notifyListeners();
|
|
_saveTheme(theme);
|
|
}
|
|
|
|
@override
|
|
void addListener(VoidCallback listener) {
|
|
super.addListener(listener);
|
|
_getTheme();
|
|
}
|
|
|
|
_getTheme() async {
|
|
_theme = await storage.getTheme();
|
|
}
|
|
|
|
_saveTheme(theme) async {
|
|
await storage.saveTheme(theme);
|
|
}
|
|
}
|