chore: 完成多模块迭代优化与依赖更新
本次提交包含多项更新: 1. 更新file_picker依赖到11.0.0-ohos.1版本 2. 清理SecureStorage、Catcher2配置冗余代码 3. 优化鸿蒙系统下HomeWidget调用方式 4. 重构编辑器导航栏图标与页面路由引用 5. 修复边框样式、简化空值判断逻辑 6. 移除冗余系统UI样式配置 7. 新增共享组件导出与自适应返回按钮 8. 批量替换路由引用为app_routes 9. 标记过时通知服务并补充注释 10. 新增引导页扫一扫功能卡片 11. 完善沉浸式状态栏配置逻辑 12. 为大量页面添加统一自适应返回按钮
This commit is contained in:
220
lib/app/app.dart
220
lib/app/app.dart
@@ -3,7 +3,7 @@
|
||||
/// 创建时间: 2026-04-20
|
||||
/// 更新时间: 2026-05-22
|
||||
/// 作用: MaterialApp.router + Riverpod 主题管理 + GlassTheme + flutter_animate
|
||||
/// 上次更新: 集成AppLifecycleGate前后台统一管理
|
||||
/// 上次更新: 集成KeyboardBackHandler桌面端快捷键返回
|
||||
/// ============================================================
|
||||
|
||||
import 'dart:async';
|
||||
@@ -17,11 +17,11 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:liquid_glass_widgets/liquid_glass_widgets.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter_quill/flutter_quill.dart'
|
||||
show FlutterQuillLocalizations;
|
||||
|
||||
import '../core/services/ui/status_bar_service.dart';
|
||||
import '../core/router/app_router.dart' show appRouter, rootNavigatorKey;
|
||||
import '../core/layout/ohos_app_shell.dart';
|
||||
import '../core/services/device/app_lock_service.dart';
|
||||
@@ -29,6 +29,7 @@ import '../core/services/performance/app_lifecycle_gate.dart';
|
||||
import '../core/theme/app_theme.dart';
|
||||
import '../core/utils/logger.dart';
|
||||
import '../core/utils/platform_utils.dart' as pu;
|
||||
import '../shared/widgets/keyboard_back_handler.dart';
|
||||
import '../features/mine/settings/providers/theme_settings_provider.dart';
|
||||
import '../features/mine/settings/presentation/font_management_notifier.dart';
|
||||
import '../l10n/app_locale.dart';
|
||||
@@ -173,12 +174,73 @@ class _XianyanAppState extends ConsumerState<XianyanApp>
|
||||
minTextAdapt: true,
|
||||
splitScreenMode: true,
|
||||
builder: (context, child) {
|
||||
if (pu.isOhos) {
|
||||
Log.i(
|
||||
'🟢 [OHOS] 使用 MaterialApp(home:) + OhosAppShell (liquidGlass=$liquidGlassReady)',
|
||||
);
|
||||
final ohosMaterialApp = MaterialApp(
|
||||
navigatorKey: rootNavigatorKey,
|
||||
Widget buildApp() {
|
||||
if (pu.isOhos) {
|
||||
Log.i(
|
||||
'🟢 [OHOS] 使用 MaterialApp(home:) + OhosAppShell (liquidGlass=$liquidGlassReady)',
|
||||
);
|
||||
final ohosMaterialApp = MaterialApp(
|
||||
navigatorKey: rootNavigatorKey,
|
||||
title: '闲言',
|
||||
debugShowCheckedModeBanner: false,
|
||||
scrollBehavior: const AppScrollBehavior(),
|
||||
locale: appLocale,
|
||||
supportedLocales: supportedLocales,
|
||||
localizationsDelegates: _localizationsDelegates,
|
||||
theme: theme,
|
||||
darkTheme: darkTheme,
|
||||
themeMode: themeMode,
|
||||
home: const OhosAppShell(),
|
||||
builder: (context, widget) {
|
||||
final botToastBuilder = BotToastInit();
|
||||
final botWidget = botToastBuilder(context, widget);
|
||||
return StatusBarStyleRegion(
|
||||
isDark: settings.isDark,
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
).copyWith(textScaler: TextScaler.noScaling),
|
||||
child: DefaultTextStyle(
|
||||
style: const TextStyle(),
|
||||
child: botWidget,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
return InheritedGoRouter(
|
||||
goRouter: appRouter,
|
||||
child: liquidGlassReady
|
||||
? GlassTheme(
|
||||
data: GlassThemeData(
|
||||
light: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 30.0,
|
||||
blur: settings.glassEnabled ? 3.0 : 0.0,
|
||||
refractiveIndex: 1.65,
|
||||
lightIntensity: 1.2,
|
||||
ambientStrength: 0.6,
|
||||
saturation: 1.2,
|
||||
),
|
||||
),
|
||||
dark: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 40.0,
|
||||
blur: settings.glassEnabled ? 5.0 : 0.0,
|
||||
lightIntensity: 1.5,
|
||||
refractiveIndex: 1.2,
|
||||
saturation: 1.1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: ohosMaterialApp,
|
||||
)
|
||||
: ohosMaterialApp,
|
||||
);
|
||||
}
|
||||
|
||||
final materialApp = MaterialApp.router(
|
||||
title: '闲言',
|
||||
debugShowCheckedModeBanner: false,
|
||||
scrollBehavior: const AppScrollBehavior(),
|
||||
@@ -188,25 +250,13 @@ class _XianyanAppState extends ConsumerState<XianyanApp>
|
||||
theme: theme,
|
||||
darkTheme: darkTheme,
|
||||
themeMode: themeMode,
|
||||
home: const OhosAppShell(),
|
||||
routerConfig: appRouter,
|
||||
builder: (context, widget) {
|
||||
final botToastBuilder = BotToastInit();
|
||||
final botWidget = botToastBuilder(context, widget);
|
||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
value: SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: settings.isDark
|
||||
? Brightness.light
|
||||
: Brightness.dark,
|
||||
statusBarBrightness: settings.isDark
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarIconBrightness: settings.isDark
|
||||
? Brightness.light
|
||||
: Brightness.dark,
|
||||
systemNavigationBarDividerColor: Colors.transparent,
|
||||
),
|
||||
|
||||
return StatusBarStyleRegion(
|
||||
isDark: settings.isDark,
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
@@ -220,107 +270,33 @@ class _XianyanAppState extends ConsumerState<XianyanApp>
|
||||
},
|
||||
);
|
||||
|
||||
return InheritedGoRouter(
|
||||
goRouter: appRouter,
|
||||
child: liquidGlassReady
|
||||
? GlassTheme(
|
||||
data: GlassThemeData(
|
||||
light: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 30.0,
|
||||
blur: settings.glassEnabled ? 3.0 : 0.0,
|
||||
refractiveIndex: 1.65,
|
||||
lightIntensity: 1.2,
|
||||
ambientStrength: 0.6,
|
||||
saturation: 1.2,
|
||||
),
|
||||
),
|
||||
dark: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 40.0,
|
||||
blur: settings.glassEnabled ? 5.0 : 0.0,
|
||||
lightIntensity: 1.5,
|
||||
refractiveIndex: 1.2,
|
||||
saturation: 1.1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: ohosMaterialApp,
|
||||
)
|
||||
: ohosMaterialApp,
|
||||
return GlassTheme(
|
||||
data: GlassThemeData(
|
||||
light: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 30.0,
|
||||
blur: settings.glassEnabled ? 3.0 : 0.0,
|
||||
refractiveIndex: 1.65,
|
||||
lightIntensity: 1.2,
|
||||
ambientStrength: 0.6,
|
||||
saturation: 1.2,
|
||||
),
|
||||
),
|
||||
dark: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 40.0,
|
||||
blur: settings.glassEnabled ? 5.0 : 0.0,
|
||||
lightIntensity: 1.5,
|
||||
refractiveIndex: 1.2,
|
||||
saturation: 1.1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: materialApp,
|
||||
);
|
||||
}
|
||||
|
||||
final materialApp = MaterialApp.router(
|
||||
title: '闲言',
|
||||
debugShowCheckedModeBanner: false,
|
||||
scrollBehavior: const AppScrollBehavior(),
|
||||
locale: appLocale,
|
||||
supportedLocales: supportedLocales,
|
||||
localizationsDelegates: _localizationsDelegates,
|
||||
theme: theme,
|
||||
darkTheme: darkTheme,
|
||||
themeMode: themeMode,
|
||||
routerConfig: appRouter,
|
||||
builder: (context, widget) {
|
||||
final botToastBuilder = BotToastInit();
|
||||
final botWidget = botToastBuilder(context, widget);
|
||||
|
||||
final isDark = settings.isDark;
|
||||
final wrappedWidget = AnnotatedRegion<SystemUiOverlayStyle>(
|
||||
value: SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: isDark
|
||||
? Brightness.light
|
||||
: Brightness.dark,
|
||||
statusBarBrightness: isDark
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarIconBrightness: isDark
|
||||
? Brightness.light
|
||||
: Brightness.dark,
|
||||
systemNavigationBarDividerColor: Colors.transparent,
|
||||
),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(
|
||||
context,
|
||||
).copyWith(textScaler: TextScaler.noScaling),
|
||||
child: DefaultTextStyle(
|
||||
style: const TextStyle(),
|
||||
child: botWidget,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return wrappedWidget;
|
||||
},
|
||||
);
|
||||
|
||||
return GlassTheme(
|
||||
data: GlassThemeData(
|
||||
light: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 30.0,
|
||||
blur: settings.glassEnabled ? 3.0 : 0.0,
|
||||
refractiveIndex: 1.65,
|
||||
lightIntensity: 1.2,
|
||||
ambientStrength: 0.6,
|
||||
saturation: 1.2,
|
||||
),
|
||||
),
|
||||
dark: GlassThemeVariant(
|
||||
settings: GlassThemeSettings(
|
||||
thickness: 40.0,
|
||||
blur: settings.glassEnabled ? 5.0 : 0.0,
|
||||
lightIntensity: 1.5,
|
||||
refractiveIndex: 1.2,
|
||||
saturation: 1.1,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: materialApp,
|
||||
);
|
||||
return KeyboardBackHandler(child: buildApp());
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user