mirror of
https://github.com/stonega/tsacdop
synced 2025-01-24 12:41:53 +01:00
547aef80e9
modified: lib/class/settingstate.dart modified: lib/episodes/episodedetail.dart modified: lib/home/appbar/addpodcast.dart deleted: lib/home/audio_player.dart modified: lib/home/audiopanel.dart modified: lib/home/home.dart modified: lib/home/homescroll.dart modified: lib/local_storage/key_value_storage.dart modified: lib/local_storage/sqflite_localpodcast.dart modified: lib/main.dart modified: lib/podcasts/podcastdetail.dart modified: lib/podcasts/podcastgroup.dart modified: pubspec.lock modified: pubspec.yaml lib/home/audioplayer.dart
31 lines
641 B
Dart
31 lines
641 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;
|
|
setTheme(int theme) async{
|
|
_theme = theme;
|
|
notifyListeners();
|
|
await _saveTheme(theme);
|
|
}
|
|
|
|
@override
|
|
void addListener(VoidCallback listener) {
|
|
super.addListener(listener);
|
|
_getTheme();
|
|
}
|
|
|
|
_getTheme() async {
|
|
_theme = await storage.getTheme();
|
|
}
|
|
|
|
_saveTheme(theme) async {
|
|
await storage.saveTheme(theme);
|
|
}
|
|
}
|