Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-29 12:47:14 +08:00
parent c7864ff4a3
commit cd26cf6d98
104 changed files with 482 additions and 391 deletions

View File

@@ -1,11 +1,31 @@
import 'package:PiliPlus/common/style.dart';
import 'package:PiliPlus/main.dart';
import 'package:PiliPlus/utils/extension/theme_ext.dart';
import 'package:PiliPlus/utils/storage_pref.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/cupertino.dart' show CupertinoThemeData;
import 'package:flutter/foundation.dart' show PlatformDispatcher;
import 'package:flutter/material.dart';
abstract final class ThemeUtils {
static late ThemeData lightTheme;
static late ThemeData darkTheme;
static late ThemeMode themeMode;
static ThemeData get theme {
if (themeMode == .dark ||
(themeMode == .system &&
PlatformDispatcher.instance.platformBrightness == .dark)) {
return darkTheme;
}
return lightTheme;
}
static bool get isDarkMode => theme.isDark;
static String themeUrl(bool isDark) =>
'native.theme=${isDark ? 2 : 1}&night=${isDark ? 1 : 0}';
static ThemeData getThemeData({
required ColorScheme colorScheme,
required bool isDynamic,
@@ -134,9 +154,6 @@ abstract final class ThemeUtils {
if (Pref.isPureBlackTheme) {
themeData = darkenTheme(themeData);
}
if (Pref.darkVideoPage) {
MyApp.darkThemeData = themeData;
}
}
return themeData;
}