1
0
mirror of https://github.com/stonega/tsacdop synced 2025-01-24 04:32:28 +01:00
tsacdop-podcast-app-android/lib/class/settingstate.dart
stonegate 7ba0552717 modified: lib/class/settingstate.dart
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
2020-02-22 20:25:06 +08:00

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);
}
}