From cd1f9dd17a447e4aa55f2755a2be7a943fd8992d Mon Sep 17 00:00:00 2001 From: Developer Date: Sat, 4 Apr 2026 19:11:49 +0800 Subject: [PATCH] release --- CHANGELOG.md | 363 ++----------------------------- android/app/build.gradle.kts | 10 - android/build.gradle.kts | 7 +- lib/main.dart | 90 +++++++- lib/utils/app_initializer.dart | 18 +- ohos/build-profile.json5 | 14 +- ohos/entry/src/main/module.json5 | 4 + pubspec.yaml | 2 +- web/manifest.json | 6 +- 9 files changed, 118 insertions(+), 396 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4eb3af0..fa5db29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. --- +## [1.4.2] - 2026-04-04 + +### 修复 +- 🐛 **修复三星平板卡 Logo 启动页的问题** + - 将屏幕适配从初始化阶段移到第一帧绘制后执行 + - 延迟 100ms 调用屏幕适配,避免在启动时阻塞 + - 为所有初始化步骤添加 try-catch 保护,即使某个初始化失败也能继续启动 + - 添加详细的调试日志,方便定位启动问题 + - 移除 AppInitializer 中的屏幕适配调用 + - 修改 MyApp 为 StatefulWidget,使用 WidgetsBindingObserver + - 涉及文件: + - `lib/main.dart` - 重构启动流程 + - `lib/utils/app_initializer.dart` - 优化初始化流程 + ## [1.4.1] - 2026-04-03 ### 新增 @@ -103,352 +117,6 @@ All notable changes to this project will be documented in this file. - 涉及文件: - `lib/views/home/home_part.dart` - 添加顶部内边距 -## [1.3.58] - 2026-04-03 - -### 优化 -- ✨ **优化主页诗词卡片布局,去除时间提示语下方的空白** - - 将时间提示语("夜深了,注意身体")改为 Positioned 在上层单独占位 - - 时间提示语不再占用布局空间,下方内容自动顶上来 - - 调整了复制提示框的位置,避免与时间提示语重叠 - - 涉及文件: - - `lib/views/home/home_part.dart` - 优化时间提示语布局 - -## [1.3.57] - 2026-04-03 - -### 修复 -- 🐛 **修复诗词答题页面底部操作按钮容器的深色模式适配** - - 修复了底部"上一题 提示 下一题"容器在深色模式下背景色不匹配的问题 - - 适配了按钮渐变、文字颜色、阴影等元素在深色模式下的显示 - - 将静态颜色 `AppConstants.primaryColor` 改为动态的 `primaryColor`,跟随主题色变化 - - 涉及文件: - - `lib/views/profile/level/poetry.dart` - 修复深色模式适配 - -## [1.3.56] - 2026-04-03 - -### 优化 -- 🎨 **修改主题颜色默认值为中国传统风格** - - 默认主题颜色从紫色改为书褐色 (0xFF8B4513),更符合中国传统诗词风格 - - 默认强调色从紫色改为明黄色 (Colors.yellow) - - 涉及文件: - - `lib/models/colors/theme_colors.dart` - 调整主题颜色和强调色顺序 -- 📋 **搜索项目中使用静态主题色的地方** - - 发现项目中多个文件使用 AppConstants.primaryColor 等静态颜色 - - 建议后续逐步改用 ThemeController 动态获取主题色 - -## [1.3.55] - 2026-04-03 - -### 修复 -- 🐛 **修复发现页面动画导致的卡死问题** - - 修复了使用 SingleTickerProviderStateMixin 但创建多个 AnimationController 导致的异常 - - 将 SingleTickerProviderStateMixin 改为 TickerProviderStateMixin - - 涉及文件: - - `lib/views/discover_page.dart` - 修复 ticker 提供者 - -## [1.3.54] - 2026-04-03 - -### 优化 -- ✨ **优化发现页面提示框的关闭动画** - - 点击关闭按钮时,提示框会有平滑的淡出和收缩动画 - - 下方的内容会自动顶上来占位,实现流畅的过渡效果 - - 涉及文件: - - `lib/views/discover_page.dart` - 添加动画控制器和过渡效果 - -## [1.3.53] - 2026-04-03 - -### 修复 -- 🐛 **修复声音设置不一致的问题** - - 修复了声音关闭时依旧有声音、有时候关闭时没声音的问题 - - 统一了 AudioManager 和 app_fun.dart 的默认值(都默认为 false,即静音) - - 修复了 AudioManager.setMuted() 没有保存到 SharedPreferences 的问题 - - 在 app_fun.dart 中加载设置时同步到 AudioManager - - 涉及文件: - - `lib/utils/audio_manager.dart` - 修复默认值和 setMuted 方法 - - `lib/views/profile/settings/app_fun.dart` - 修复设置加载和同步逻辑 - -## [1.3.52] - 2026-04-03 - -### 修复 -- 🐛 **彻底修复主页加载下一条诗词卡片时的闪白问题** - - 找到并修复了闪白的根本原因:home_page.dart 中每次 build 都会触发的 FadeTransition 动画 - - 移除了导致页面每次重新渲染都闪烁的动画代码 - - 简化了数据加载逻辑,移除了复杂的分步加载,改为一次性加载 - - 清理了不再需要的 AnimationController 和 SingleTickerProviderStateMixin - - 涉及文件: - - `lib/views/home/home_page.dart` - 移除 FadeTransition 动画和 AnimationController - - `lib/services/get/home_controller.dart` - 简化 `simulateSectionLoading()` 方法 - -## [1.3.51] - 2026-04-03 - -### 修复 -- 🐛 **主页加载下一条诗词卡片时的闪白问题** - - 修复切换诗词卡片时页面闪白的问题 - - 优化数据加载顺序,确保在显示骨架屏时旧数据仍然可见 - - 优化分步加载动画,将延迟从200ms缩短为150ms - - 在设置加载状态后立即调用update()通知UI更新 - - 涉及文件: - - `lib/services/get/home_controller.dart` - 优化 `loadNextPoetry()` 和 `simulateSectionLoading()` 方法 - -## [1.3.50] - 2026-04-03 - -### 新增 -- ✨ **分类页面底部提示** - - 在分类列表底部添加"到底了"提示 - - 防止列表项被全局底部导航栏遮住 - - 支持深色模式适配 - - 涉及文件: - - `lib/views/active/category_page.dart` - 添加 `_buildEndIndicator` 方法 - -### 优化 -- ⚡ **版本号管理优化** - - 删除 `AppConstants` 中重复的 `appVersion` 定义 - - 统一使用 `AppConfig.appVersion` 管理版本号 - - 更新版本号至 1.3.50 - - 涉及文件: - - `lib/constants/app_constants.dart` - 删除 `appVersion` 定义 - - `lib/config/app_config.dart` - 更新版本号 - - `lib/views/profile/profile_page.dart` - 更新引用 - -- ⚡ **Get.snackbar 消息样式优化** - - 字体颜色使用动态主题色,背景使用默认样式 - - 调用时重新获取 `ThemeController` 确保获取最新主题色 - - 涉及文件: - - `lib/views/profile/settings/learn-us.dart` - 复制成功提示 - - `lib/views/profile/per_card.dart` - 头像切换提示 - - `lib/views/profile/history_page.dart` - 分享和查看详情提示 - - `lib/views/profile/settings/offline-data.dart` - 离线数据页面所有消息提示 - - `lib/services/get/profile_controller.dart` - 开发计划、屏幕常亮等提示 - - `lib/services/get/favorites_controller.dart` - 收藏页面排序提示 - - `lib/services/get/discover_controller.dart` - 发现页面刷新提示 - - `lib/services/get/theme_controller.dart` - 主题切换提示 - -## [1.3.49] - 2026-04-03 - -### 修复 -- 🐛 **悬浮按钮管理器状态更新时机修复** - - 修复 `setState() or markNeedsBuild() called when widget tree was locked` 错误 - - 使用 `WidgetsBinding.instance.addPostFrameCallback` 延迟状态更新 - - 涉及文件: - - `lib/views/home/set/home-set.dart` - `init()`、`_restoreFromFlashing()`、`dispose()` 方法添加延迟更新 - -## [1.3.48] - 2026-04-03 - -### 修复 -- 🐛 **关怀页面用户类型主题色跟随修复** - - 修复用户类型选择按钮的主题色不跟随问题 - - 使用 `Obx` 包裹按钮,实时响应主题色变化 - - 涉及文件: - - `lib/views/home/care/care-page.dart` - `_buildUserTypeSelector` 方法添加响应式主题色 - -## [1.3.47] - 2026-04-03 - -### 优化 -- ⚡ **关怀模式开关点击区域优化** - - 点击关怀开关卡片的空白区域也可跳转至关怀页面 - - Switch 开关保持独立的开关功能 - - 涉及文件: - - `lib/views/home/care/care_widgets.dart` - `CareModeToggle` 组件添加整体点击跳转 - -## [1.3.46] - 2026-04-03 - -### 新增 -- ✨ **设置建议卡片新增统计跳转选项** - - 新增统计选项,跳转至 `EntirePage`(全站数据统计) - - 选项总数从8个增加到9个,布局调整为3页 - - 每页显示4个选项,第三页显示最后1个选项 - - 页面指示器更新为3个圆点 - - 涉及文件: - - `lib/controllers/settings/suggestions.dart` - 添加统计选项并调整布局 - -## [1.3.45] - 2026-04-03 - -### 新增 -- ✨ **设置建议卡片新增跳转选项** - - 新增诗词搜索选项,跳转至 `ActiveSearchPage` - - 新增调试页面选项,跳转至 `RatePage` - - 选项总数从6个增加到8个,每页显示4个选项 - - 涉及文件: - - `lib/controllers/settings/suggestions.dart` - 添加新选项并调整布局 - -## [1.3.44] - 2026-04-03 - -### 新增 -- ✨ **权限管理页面添加设置建议卡片** - - 在权限管理页面底部显示 `SuggestionsCard` 组件 - - 用户可在权限页面快速访问主题风格、关怀模式、使用教程等功能 - - 涉及文件: - - `lib/views/profile/guide/permission.dart` - 导入并添加 `SuggestionsCard` - -## [1.3.43] - 2026-04-03 - -### 新增 -- ✨ **设置建议卡片功能扩展** - - 新增关怀模式选项,跳转至 `CarePage` - - 新增使用教程选项,跳转至 `BeginnerPage` - - 选项支持左右滑动切换页面(PageView) - - 选项支持随机排序,每次展示卡片时自动重新排序 - - 添加页面指示器,显示当前所在页面 - - 涉及文件: - - `lib/controllers/settings/suggestions.dart` - 重构为 PageView 布局,添加随机排序功能 - -## [1.3.42] - 2026-04-03 - -### 新增 -- ✨ **设置建议卡片页面返回悬浮按钮** - - 从卡片进入的页面自动添加左侧返回悬浮长条按钮 - - 按钮位置在屏幕左侧中间(45%高度处) - - 5秒后自动消失,带有淡出动画 - - 支持深色/浅色模式,颜色跟随主题色 - - 涉及文件: - - `lib/controllers/settings/suggestions.dart` - 添加 `_PageWithBackButton` 包装组件 - -## [1.3.41] - 2026-04-03 - -### 优化 -- ⚡ **设置建议卡片布局与主题色支持** - - 修改卡片内选项布局:icon 和标题改为同一行,左右对齐 - - 卡片整体支持主题色,icon 颜色跟随主题色变化 - - 使用 `AppColors.primary` 动态获取当前主题色 - - 按钮背景使用主题色边框和半透明背景 - - 涉及文件: - - `lib/controllers/settings/suggestions.dart` - 布局重构,添加主题色支持 - - `lib/models/colors/app_colors.dart` - 使用动态颜色 - -## [1.3.40] - 2026-04-03 - -### 优化 -- ⚡ **个性化设置页面对话框优化** - - 开发中提示对话框添加"不再提醒"复选框,勾选后下次进入页面不再自动显示 - - 设置保存到 SharedPreferences,持久化存储用户选择 - - AppBar 右侧添加信息图标,点击可手动显示开发中提示对话框 - - 涉及文件: - - `lib/views/profile/theme/app-diy.dart` - 对话框优化,添加复选框和图标按钮 - -## [1.3.39] - 2026-04-03 - -### 新增 -- ✨ **主页诗词卡片骨架屏加载动画** - - 创建 `skeleton_widgets.dart`,实现骨架屏基础组件(SkeletonContainer) - - 修改 `home_part.dart`,所有区块(标题、诗词名、内容、关键词、简介)支持骨架屏加载状态 - - 修改 `care_poetry_page.dart`,关怀模式诗词页面支持骨架屏加载 - - 骨架屏采用渐变动画效果,防止加载时闪白 - - 支持深色/浅色模式,骨架颜色自动适配 - - 涉及文件: - - `lib/views/home/components/skeleton_widgets.dart` - 新建骨架屏组件 - - `lib/views/home/home_part.dart` - 集成骨架屏到各区块 - - `lib/views/home/care/care_poetry_page.dart` - 关怀模式骨架屏支持 - -### 优化 -- ⚡ **关怀开关自动隐藏功能** - - 主页左上角关怀按钮点击后,开关面板3秒内无操作自动消失 - - 用户与开关交互时重置定时器,延长显示时间 - - 涉及文件: - - `lib/services/get/care_controller.dart` - 添加自动隐藏定时器逻辑 - - `lib/views/home/home_page.dart` - 交互时重置定时器 - -## [1.3.38] - 2026-04-03 - -### 重构 -- 🔄 **诗词答题页面主题色支持与代码重构** - - 创建 `poetry-page.dart`,提取 UI 组件(PoetryOptionItem、PoetryOptionsLayout、PoetryTag) - - 修改 `poetry.dart`,使用新组件,添加主题色支持 - - 修改 `flow-anim.dart`,添加主题色支持 - - 修改 `distinguish.dart`,添加主题色支持 - - 支持动态主题色切换,所有组件颜色同步更新 - - 支持深色模式,背景色、文字颜色自动适配 - - 保持页面布局不变,功能完全兼容 - - 涉及文件: - - `lib/views/profile/level/poetry-page.dart` - 新建 UI 组件文件 - - `lib/views/profile/level/poetry.dart` - 重构主页面 - - `lib/views/profile/level/flow-anim.dart` - 添加主题色支持 - - `lib/views/profile/level/distinguish.dart` - 添加主题色支持 - -## [1.3.37] - 2026-04-02 - -### 新增 -- ✨ **主题颜色选择器重新设计** - - 新增中国传统色彩:书褐色(#8B4513)和宣纸色(#F5F5F0) - - 颜色选择器改为横向滚动列表,每个颜色显示圆形色块和中文名称 - - 选中状态显示勾选图标和发光阴影效果 - - 颜色名称采用中国风命名:紫韵、天蓝、翠绿、橙光、朱红、青碧、书褐、明黄、桃粉、湖青、罗兰、宣纸 - - 涉及文件: - - `lib/models/colors/theme_colors.dart` - 新增中国传统色彩 - - `lib/views/profile/theme/app-diy.dart` - 重新设计颜色选择器 - -## [1.3.36] - 2026-04-02 - -### 新增 -- ✨ **Profile 组件主题色支持** - - Bug列表页面、全站统计页面、投票凭证弹窗、Pop菜单、服务器信息弹窗支持主题色设置 - - 所有组件颜色动态响应主题色变化,包括按钮、卡片、图标、文本等 - - 新增 `AppColors` 类统一管理动态主题色,支持深色/浅色模式自动切换 - - 使用 iOS 风格系统颜色(蓝、绿、红、橙、紫等)保持一致性 - - 涉及文件: - - `lib/models/colors/app_colors.dart` - 新建动态颜色管理类 - - `lib/views/profile/components/bug_list_page.dart` - 支持主题色 - - `lib/views/profile/components/entire_page.dart` - 支持主题色 - - `lib/views/profile/components/login_register_dialog.dart` - 支持主题色 - - `lib/views/profile/components/pop-menu.dart` - 支持主题色 - - `lib/views/profile/components/server_info_dialog.dart` - 支持主题色 - - `lib/views/profile/level/distinguish.dart` - 支持主题色 - - `lib/views/profile/level/flow-anim.dart` - 支持主题色 - - `lib/views/profile/level/poetry.dart` - 支持主题色 - - `lib/views/profile/app-info.dart` - 支持主题色 - -## [1.3.35] - 2026-04-02 - -### 新增 -- ✨ **活跃页面主题色支持** - - 搜索页面、热门页面、分类页面、活跃度页面支持主题色设置 - - 所有组件颜色动态响应主题色变化,包括Tab栏、按钮、卡片边框等 - - 涉及文件: - - `lib/views/active/active_search_page.dart` - 支持主题色 - - `lib/views/active/popular_page.dart` - 支持主题色 - - `lib/views/active/category_page.dart` - 支持主题色 - - `lib/views/active/rate.dart` - 支持主题色 - -## [1.3.34] - 2026-04-02 - -### 新增 -- ✨ **多页面主题色支持** - - 发现页面、标签页面、收藏页面、响应式首页等多个页面支持主题色设置 - - 所有组件颜色动态响应主题色变化 - - 涉及文件: - - `lib/views/active/tags/corr_page.dart` - 支持主题色 - - `lib/views/discover_page.dart` - 支持主题色 - - `lib/views/favorites_page.dart` - 支持主题色 - - `lib/views/responsive_home_page.dart` - 支持主题色 - -## [1.3.33] - 2026-04-02 - -### 新增 -- ✨ **首页主题色支持** - - 首页诗词卡片、按钮、加载状态等组件支持主题色设置 - - 主题色变化时,首页所有相关组件会实时更新 - - 涉及文件: - - `lib/views/home/home_part.dart` - 支持主题色 - - `lib/views/home/set/home_components.dart` - 支持主题色 - -## [1.3.32] - 2026-04-02 - -### 新增 -- ✨ **个人卡片emoji头像点击切换功能** - - 点击头像可自动切换不同的emoji表情 - - 内置20个精选emoji头像:👤😊🎨🌟🦋🌺🍀🎯🚀💎🌈🎭🦊🐼🦁🐨🦄🐉🔥⚡ - - 添加触觉反馈,提升交互体验 - - 切换时显示SnackBar提示,告知用户新头像 - - 支持收起和展开状态下的头像切换 - - 涉及文件: - - `lib/views/profile/per_card.dart` - 添加头像切换功能 - -## [1.3.31] - 2026-04-02 - -### 优化 -- 🎨 **统一气泡提示样式为 Get.snackbar** - - 将 `home_components.dart` 中的所有 `PoetryStateManager.showSnackBar` 改为 `Get.snackbar` - - 使用透明毛玻璃样式,与调试信息气泡保持一致 - - 包括分享、复制等操作的提示 - - 涉及文件: - - `lib/views/home/home_components.dart` - 统一气泡样式 --- @@ -488,3 +156,6 @@ All notable changes to this project will be documented in this file. | 主题色支持 | 1 | ✅ 已完成 | | 性能优化 | 4 | 🔄 进行中 | | 新功能开发 | 5 | 📋 计划中 | + + + diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 499030d..dc9e6a4 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,7 +1,6 @@ plugins { id("com.android.application") id("kotlin-android") - // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } @@ -20,10 +19,7 @@ android { } defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "app.wushu.poes" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. minSdk = flutter.minSdkVersion targetSdk = flutter.targetSdkVersion versionCode = flutter.versionCode @@ -32,8 +28,6 @@ android { buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. signingConfig = signingConfigs.getByName("debug") } } @@ -43,16 +37,13 @@ flutter { source = "../.." } -// 为所有依赖的模块设置统一的 JVM 目标版本 configurations.all { resolutionStrategy { eachDependency { - // 这里可以添加依赖解析策略 } } } -// 为所有任务设置统一的 JVM 目标版本 allprojects { tasks.withType { sourceCompatibility = "17" @@ -66,7 +57,6 @@ allprojects { } } -// 强制所有模块使用相同的 JVM 版本 subprojects { tasks.withType { sourceCompatibility = "17" diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 2a6c9b0..17eb5f4 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -29,7 +29,6 @@ allprojects { } } -// 统一设置 JVM 版本 allprojects { tasks.withType { sourceCompatibility = "17" @@ -43,7 +42,6 @@ allprojects { } } -// 为所有子项目(包括依赖的模块)设置统一的 JVM 目标版本 subprojects { tasks.withType { sourceCompatibility = "17" @@ -57,23 +55,19 @@ subprojects { } } -// 为所有模块设置统一的 JVM 目标版本 subprojects { afterEvaluate { - // 为 Java 编译任务设置 JVM 版本 tasks.withType { sourceCompatibility = "17" targetCompatibility = "17" } - // 为 Kotlin 编译任务设置 JVM 版本 tasks.withType { kotlinOptions { jvmTarget = "17" } } - // 为 Android 模块设置编译选项 if (plugins.hasPlugin("com.android.library") || plugins.hasPlugin("com.android.application")) { extensions.findByType()?.apply { compileOptions { @@ -101,6 +95,7 @@ subprojects { val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) project.layout.buildDirectory.value(newSubprojectBuildDir) } + subprojects { project.evaluationDependsOn(":app") } diff --git a/lib/main.dart b/lib/main.dart index 3ac6246..69e21d6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,6 +4,7 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'utils/app_theme.dart'; import 'utils/app_initializer.dart'; import 'utils/force_guide_checker.dart'; +import 'utils/screen_adapter.dart'; import 'routes/app_routes.dart'; import 'constants/app_constants.dart'; import 'config/app_config.dart'; @@ -13,19 +14,34 @@ import 'views/profile/guide/sp-guide.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + debugPrint('[启动] 开始初始化...'); - await SharedPreferencesStorageController.init(); + try { + await SharedPreferencesStorageController.init(); + debugPrint('[启动] SharedPreferencesStorageController 初始化完成'); - // 初始化 AppConfig,动态获取版本号 - await AppConfig.init(); + // 初始化 AppConfig,动态获取版本号 + try { + await AppConfig.init(); + debugPrint('[启动] AppConfig 初始化完成'); + } catch (e) { + debugPrint('[启动] AppConfig 初始化异常: $e'); + } - // 初始化 ThemeController(在 AppInitializer 之前,确保主题最先加载) - Get.put(ThemeController(), permanent: true); + // 初始化 ThemeController(在 AppInitializer 之前,确保主题最先加载) + Get.put(ThemeController(), permanent: true); + debugPrint('[启动] ThemeController 初始化完成'); - // 检查是否需要显示引导页 - String initialRoute = await _getInitialRoute(); + // 检查是否需要显示引导页 + String initialRoute = await _getInitialRoute(); + debugPrint('[启动] 初始路由: $initialRoute'); - runApp(MyApp(initialRoute: initialRoute)); + runApp(MyApp(initialRoute: initialRoute)); + debugPrint('[启动] 应用启动完成'); + } catch (e) { + debugPrint('[启动] 异常: $e'); + runApp(MyApp(initialRoute: '/')); + } } Future _getInitialRoute() async { @@ -39,15 +55,65 @@ Future _getInitialRoute() async { } // 否则使用 AppInitializer 返回的初始路由 - final result = await AppInitializer.initialize(); - return result.initialRoute; + try { + final result = await AppInitializer.initialize(); + return result.initialRoute; + } catch (e) { + debugPrint('[启动] AppInitializer.initialize 异常: $e'); + return '/'; + } } -class MyApp extends StatelessWidget { +class MyApp extends StatefulWidget { final String initialRoute; const MyApp({super.key, required this.initialRoute}); + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State with WidgetsBindingObserver { + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addObserver(this); + } + + @override + void dispose() { + WidgetsBinding.instance.removeObserver(this); + super.dispose(); + } + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + // 在第一帧绘制后再执行屏幕适配 + WidgetsBinding.instance.addPostFrameCallback((_) { + debugPrint('[启动] 执行屏幕适配...'); + _setupScreenAdapter(); + }); + } + + void _setupScreenAdapter() { + try { + // 延迟调用屏幕适配,避免在启动时阻塞 + Future.delayed(const Duration(milliseconds: 100), () { + if (mounted) { + ScreenAdapter.setPreferredOrientations(); + ScreenAdapter.enableSystemUIOverlay(); + ScreenAdapter.setSystemUIOverlayStyle( + statusBarColor: Colors.transparent, + ); + debugPrint('[启动] 屏幕适配完成'); + } + }); + } catch (e) { + debugPrint('[启动] 屏幕适配异常: $e'); + } + } + @override Widget build(BuildContext context) { // 使用 Obx 监听主题变化 @@ -59,7 +125,7 @@ class MyApp extends StatelessWidget { theme: AppTheme.lightTheme, darkTheme: AppTheme.darkTheme, themeMode: themeController.currentThemeMode, - initialRoute: initialRoute, + initialRoute: widget.initialRoute, onGenerateRoute: AppRoutes.generateRoute, routes: {'/sp-guide': (context) => const SpGuidePage()}, ); diff --git a/lib/utils/app_initializer.dart b/lib/utils/app_initializer.dart index b886644..c435611 100644 --- a/lib/utils/app_initializer.dart +++ b/lib/utils/app_initializer.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../config/app_config.dart'; import '../routes/app_routes.dart'; -import 'screen_adapter.dart'; import 'force_guide_checker.dart'; import 'audio_manager.dart'; @@ -28,10 +27,13 @@ class AppInitializer { final guideCheckResult = await _checkGuideStatus(prefs); - _setupScreenAdapter(); - - // 初始化音频管理器 - await AudioManager().init(); + // 延迟初始化音频管理器,避免阻塞启动 + try { + await AudioManager().init(); + _log('音频管理器初始化完成'); + } catch (e) { + _log('音频管理器初始化异常: $e'); + } final initialRoute = await _getInitialRoute(prefs); @@ -92,12 +94,6 @@ class AppInitializer { } } - static void _setupScreenAdapter() { - ScreenAdapter.setPreferredOrientations(); - ScreenAdapter.enableSystemUIOverlay(); - ScreenAdapter.setSystemUIOverlayStyle(statusBarColor: Colors.transparent); - } - static Future _getInitialRoute(SharedPreferences prefs) async { return AppRoutes.getInitialRoute(prefs); } diff --git a/ohos/build-profile.json5 b/ohos/build-profile.json5 index ec28deb..d51d848 100644 --- a/ohos/build-profile.json5 +++ b/ohos/build-profile.json5 @@ -5,13 +5,13 @@ "name": "default", "type": "HarmonyOS", "material": { - "certpath": "C:/Users/无书/.ohos/config/default_ohos_hWyPJmkoRvc13RxcUC3NSaiad5bS6MHBrY9nkKd-288=.cer", + "certpath": "C:\\Users\\无书\\.ohos\\config\\default_ohos_hWyPJmkoRvc13RxcUC3NSaiad5bS6MHBrY9nkKd-288=.cer", "keyAlias": "debugKey", - "keyPassword": "0000001B9F9CD7BE9656EA6D4F9A5327FF3A781AE4390B5770AE9F11899E5D2E41DC6CFAE35F3D773EA569", - "profile": "C:/Users/无书/.ohos/config/default_ohos_hWyPJmkoRvc13RxcUC3NSaiad5bS6MHBrY9nkKd-288=.p7b", + "keyPassword": "0000001BDCE59CF329035B600E433CAB700C4AE16559081238E790CDFE37F7AB73BDBB71CD0F079BD5702B", + "profile": "C:\\Users\\无书\\.ohos\\config\\default_ohos_hWyPJmkoRvc13RxcUC3NSaiad5bS6MHBrY9nkKd-288=.p7b", "signAlg": "SHA256withECDSA", - "storeFile": "C:/Users/无书/.ohos/config/default_ohos_hWyPJmkoRvc13RxcUC3NSaiad5bS6MHBrY9nkKd-288=.p12", - "storePassword": "0000001B4F72565C12ADFAE3971EC101A38C3A89077228CBE98E6A272A0915464E4E5EF6EB9F14489F137D" + "storeFile": "C:\\Users\\无书\\.ohos\\config\\default_ohos_hWyPJmkoRvc13RxcUC3NSaiad5bS6MHBrY9nkKd-288=.p12", + "storePassword": "0000001BC77AD39EA9D28DC278EFD43AFA07D2E069731C1FDF82558FE0608857D134EF1BB89BC4674B6F57" } }, { @@ -20,11 +20,11 @@ "material": { "certpath": "D:/zhshu/520kiss123Release .cer", "keyAlias": "520kiss123", - "keyPassword": "0000001AD586935D353B00DE5EE72D3B3297601BC3C3AD419297BF3FA214B6D325F5554183B18AB114C0", + "keyPassword": "0000001AAF334677E7522B45BC3CAA1BE491DBBE5B832B990DADB9162D2E52F03259D18F4885EA34CE65", "profile": "D:/zhshu/520kiss123Release .p7b", "signAlg": "SHA256withECDSA", "storeFile": "D:/zhshu/520kiss123.p12", - "storePassword": "0000001A14B65B2F466A272826AF41CE48397F5E578AD1405965ED77571C43B2D995708C6411AABAFAF0" + "storePassword": "0000001A78654F120BD94B943B8BDE312943D887BCBF078C19FA10BEF86062CF1D4B348F26B61DC489C1" } } ], diff --git a/ohos/entry/src/main/module.json5 b/ohos/entry/src/main/module.json5 index 4bcb046..6052b04 100644 --- a/ohos/entry/src/main/module.json5 +++ b/ohos/entry/src/main/module.json5 @@ -80,6 +80,10 @@ }, {"name" : "ohos.permission.VIBRATE"}, + + + + ] } } diff --git a/pubspec.yaml b/pubspec.yaml index 97ceb41..c632514 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: poes -description: "A new Flutter project." +description: "腹有诗书气自华" publish_to: 'none' version: 1.4.1+26040202 diff --git a/web/manifest.json b/web/manifest.json index d416a7b..bc06036 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -1,11 +1,11 @@ { - "name": "flutter_application_2", - "short_name": "flutter_application_2", + "name": "情景诗词", + "short_name": "情景诗词", "start_url": ".", "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", - "description": "A new Flutter project.", + "description": "腹有诗书气自华", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [