适配深色模式

This commit is contained in:
DelLevin-Home
2026-05-26 05:10:21 +08:00
parent b36f50827f
commit 73f3795e65
53 changed files with 3846 additions and 3211 deletions

View File

@@ -32,13 +32,16 @@ class AppProvider extends ChangeNotifier {
// 当前主界面选中的标签 (0: 观影1: 阅读2: 笔记)
int _mainTabIndex = 0;
// 当前底部导航选中的索引 (0: 主页1: 新增2: 我的)
int _bottomNavIndex = 0;
// 底部导航栏是否可见
bool _bottomNavVisible = true;
// 主题模式
ThemeMode _themeMode = ThemeMode.system;
/// 是否使用远程服务端(同步开关 + 已激活)
bool get _useRemote {
final prefs = UserPrefs();
@@ -134,6 +137,7 @@ class AppProvider extends ChangeNotifier {
int get bookStatusIndex => _bookStatusIndex;
bool get drawerOpen => _drawerOpen;
bool get bottomNavVisible => _bottomNavVisible;
ThemeMode get themeMode => _themeMode;
List<Movie> get movies => _movies;
List<Book> get books => _books;
List<Note> get notes => _notes;
@@ -167,6 +171,26 @@ class AppProvider extends ChangeNotifier {
}
}
void setThemeMode(ThemeMode mode) {
if (_themeMode != mode) {
_themeMode = mode;
notifyListeners();
}
}
void loadThemeMode() {
final prefs = UserPrefs();
switch (prefs.themeMode) {
case 1:
_themeMode = ThemeMode.light;
case 2:
_themeMode = ThemeMode.dark;
default:
_themeMode = ThemeMode.system;
}
notifyListeners();
}
void setMovieStatusIndex(int index) {
_movieStatusIndex = index;
notifyListeners();