generated from dellevin/template
新增毛玻璃主题
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../services/changelog_service.dart';
|
||||
import '../../widgets/app_overlay.dart';
|
||||
|
||||
/// 更新日志页面
|
||||
class ChangelogPage extends StatefulWidget {
|
||||
@@ -55,7 +56,7 @@ class _ChangelogPageState extends State<ChangelogPage> {
|
||||
|
||||
void _showNoUpdateDialog(String localVersion) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
@@ -77,7 +78,7 @@ class _ChangelogPageState extends State<ChangelogPage> {
|
||||
|
||||
void _showUpdateDialog({required String version, String? localVersion}) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../utils/user_prefs.dart';
|
||||
import '../../utils/toast_util.dart';
|
||||
import '../../widgets/app_overlay.dart';
|
||||
|
||||
class FeatureSettingsPage extends StatefulWidget {
|
||||
const FeatureSettingsPage({super.key});
|
||||
@@ -442,7 +443,7 @@ class _FeatureSettingsPageState extends State<FeatureSettingsPage> {
|
||||
void _showDefaultTabPicker() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final enabled = _enabledTabs;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (ctx) => Container(
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:permission_handler/permission_handler.dart';
|
||||
import '../../services/font_download_manager.dart';
|
||||
import '../../utils/toast_util.dart';
|
||||
import '../../utils/user_prefs.dart';
|
||||
import '../../widgets/app_overlay.dart';
|
||||
|
||||
/// 字体选择页面
|
||||
///
|
||||
@@ -59,7 +60,7 @@ class _FontPickerPageState extends State<FontPickerPage> {
|
||||
/// 显示权限提示弹窗
|
||||
void _showPermissionDialog() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../providers/app_provider.dart';
|
||||
import '../../utils/user_prefs.dart';
|
||||
import '../../widgets/app_overlay.dart';
|
||||
|
||||
class LayoutSettingsPage extends StatefulWidget {
|
||||
const LayoutSettingsPage({super.key});
|
||||
@@ -337,7 +338,7 @@ class _LayoutSettingsPageState extends State<LayoutSettingsPage> {
|
||||
|
||||
void _showHomeModuleSheet() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
|
||||
@@ -380,7 +381,7 @@ class _LayoutSettingsPageState extends State<LayoutSettingsPage> {
|
||||
|
||||
void _showMovieSheet() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
|
||||
@@ -445,7 +446,7 @@ class _LayoutSettingsPageState extends State<LayoutSettingsPage> {
|
||||
|
||||
void _showBookSheet() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
|
||||
@@ -502,7 +503,7 @@ class _LayoutSettingsPageState extends State<LayoutSettingsPage> {
|
||||
|
||||
void _showNoteSheet() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
|
||||
@@ -538,7 +539,7 @@ class _LayoutSettingsPageState extends State<LayoutSettingsPage> {
|
||||
|
||||
void _showGameSheet() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(16))),
|
||||
|
||||
@@ -21,6 +21,7 @@ import '../explore/stroll_page.dart';
|
||||
import '../sync/cloud_sync_page.dart';
|
||||
import 'settings_page.dart';
|
||||
import 'watchlist_page.dart';
|
||||
import '../../widgets/app_overlay.dart';
|
||||
|
||||
/// 个人中心页面
|
||||
class ProfilePage extends StatefulWidget {
|
||||
@@ -1053,7 +1054,7 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
|
||||
void _showFeedbackDialog(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final email = 'dellevin99@gmail.com';
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
@@ -1210,7 +1211,7 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
|
||||
|
||||
Future<void> _pickAvatar() async {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
await showModalBottomSheet(
|
||||
await appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
@@ -1312,7 +1313,7 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
|
||||
|
||||
void _showBackupOptions(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
@@ -1414,7 +1415,7 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
|
||||
}
|
||||
options.add(('笔记', Icons.sticky_note_2_outlined, provider.notes.where((n) => !n.isDeleted).length));
|
||||
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: colors.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
@@ -1515,7 +1516,7 @@ class _ProfilePageState extends State<ProfilePage> with RouteAware {
|
||||
|
||||
void _showExportResult(BuildContext context, bool success, String message) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
icon: Icon(
|
||||
|
||||
@@ -20,6 +20,7 @@ import 'feature_settings_page.dart';
|
||||
import 'layout_settings_page.dart';
|
||||
import 'changelog_page.dart';
|
||||
import 'font_picker_page.dart';
|
||||
import '../../widgets/app_overlay.dart';
|
||||
|
||||
/// 设置页面
|
||||
class SettingsPage extends StatefulWidget {
|
||||
@@ -263,7 +264,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final nicknameController = TextEditingController(text: _userPrefs.nickname);
|
||||
final mottoController = TextEditingController(text: _userPrefs.motto);
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
@@ -351,11 +352,12 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
);
|
||||
}
|
||||
|
||||
static const _themeModeLabels = ['跟随系统', '浅色模式', '深色模式'];
|
||||
static const _themeModeLabels = ['跟随系统', '浅色模式', '深色模式', '毛玻璃'];
|
||||
static const _themeModeIcons = [
|
||||
Icons.brightness_auto,
|
||||
Icons.light_mode,
|
||||
Icons.dark_mode
|
||||
Icons.dark_mode,
|
||||
Icons.blur_on
|
||||
];
|
||||
|
||||
Widget _buildThemeModeSelector() {
|
||||
@@ -401,7 +403,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
|
||||
void _showThemeModePicker() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (ctx) => Container(
|
||||
@@ -464,6 +466,13 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
|
||||
Future<void> _setThemeMode(int mode) async {
|
||||
await _userPrefs.setThemeMode(mode);
|
||||
if (mode == 3) {
|
||||
if (mounted) {
|
||||
context.read<AppProvider>().enableFrosted();
|
||||
setState(() => _themeMode = mode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
final themeMode = switch (mode) {
|
||||
1 => ThemeMode.light,
|
||||
2 => ThemeMode.dark,
|
||||
@@ -527,7 +536,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
void _showColorSchemePicker() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final provider = context.read<AppProvider>();
|
||||
showModalBottomSheet(
|
||||
appModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (ctx) => Container(
|
||||
@@ -904,7 +913,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
|
||||
void _showStoragePermissionDialog() {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
@@ -945,7 +954,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
void _showClearCacheDialog(BuildContext pageContext) async {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
// 先扫描分析
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: pageContext,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => Center(child: CircularProgressIndicator(color: colors.primary)),
|
||||
@@ -968,7 +977,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
return;
|
||||
}
|
||||
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: pageContext,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
@@ -1038,7 +1047,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
|
||||
Future<void> _clearCacheData(BuildContext context) async {
|
||||
try {
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => const Center(child: CircularProgressIndicator()));
|
||||
@@ -1058,7 +1067,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
void _showCacheResult(
|
||||
BuildContext context, bool success, String message, bool cleaned) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
showDialog(
|
||||
appDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
icon: Icon(
|
||||
|
||||
Reference in New Issue
Block a user