mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: theme mode
This commit is contained in:
@@ -227,6 +227,7 @@ class MyApp extends StatelessWidget {
|
|||||||
refreshBackgroundColor: darkColorScheme.onSecondary,
|
refreshBackgroundColor: darkColorScheme.onSecondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
themeMode: GStorage.themeMode,
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:PiliPalaX/models/common/theme_type.dart';
|
import 'package:PiliPalaX/models/common/theme_type.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:PiliPalaX/models/model_owner.dart';
|
import 'package:PiliPalaX/models/model_owner.dart';
|
||||||
@@ -16,6 +17,19 @@ class GStorage {
|
|||||||
static late final Box<dynamic> setting;
|
static late final Box<dynamic> setting;
|
||||||
static late final Box<dynamic> video;
|
static late final Box<dynamic> video;
|
||||||
|
|
||||||
|
static ThemeMode get themeMode {
|
||||||
|
switch (setting.get(SettingBoxKey.themeMode,
|
||||||
|
defaultValue: ThemeType.system.code)) {
|
||||||
|
case 0:
|
||||||
|
return ThemeMode.light;
|
||||||
|
case 1:
|
||||||
|
return ThemeMode.dark;
|
||||||
|
case 2:
|
||||||
|
default:
|
||||||
|
return ThemeMode.system;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static Brightness get brightness {
|
static Brightness get brightness {
|
||||||
switch (setting.get(SettingBoxKey.themeMode,
|
switch (setting.get(SettingBoxKey.themeMode,
|
||||||
defaultValue: ThemeType.system.code)) {
|
defaultValue: ThemeType.system.code)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user