diff --git a/README.md b/README.md index feb70cc..c406aa8 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,12 @@ web_android_shell/ ├── packages/ │ ├── web_shell_core/ # 核心库(WebView 引擎 + Bridge + 服务) │ └── web_android_shell/ # 旧版入口(已迁移至 apps/quanxue) -├── flavors/ # 品牌配置 YAML -│ └── quanxue.yaml +├── flavors/ # 品牌配置 + 品牌资源 +│ ├── quanxue.yaml # 品牌配置 +│ └── quanxue/ # 品牌资源(图标、启动页) +│ ├── icon.png +│ ├── icon_foreground.png +│ └── splash.png ├── tool/ │ ├── generate_app.dart # 一键生成新品牌应用 │ └── flutter_run_fresh.ps1 # Windows 调试脚本(自动杀旧进程) @@ -33,8 +37,13 @@ flutter run ```bash # 1) 在 flavors/ 下创建品牌配置 cp flavors/quanxue.yaml flavors/新品牌.yaml -# 2) 修改配置中的 app_name, application_id, app_key, theme -# 3) 运行生成脚本 +# 2) 修改配置中的 app_name, application_id, app_key, theme, branding +# 3) 准备品牌资源(参见下方规格要求) +mkdir flavors/新品牌 +cp 你的图标.png flavors/新品牌/icon.png +cp 你的前景图.png flavors/新品牌/icon_foreground.png +cp 你的启动图.png flavors/新品牌/splash.png +# 4) 运行生成脚本 dart run tool/generate_app.dart 新品牌 ``` @@ -42,8 +51,11 @@ dart run tool/generate_app.dart 新品牌 - 创建 Flutter 应用 → `apps/新品牌/` - 添加 `web_shell_core` 依赖 - 覆写 `MainActivity` 继承 `CoreShellActivity` +- 更新 `AndroidManifest.xml` 应用名 - 生成品牌入口 `main.dart` -- 配置 `flutter_launcher_icons` +- 复制品牌资源到生成目录 +- 添加 `flutter_launcher_icons` / `flutter_native_splash` 依赖 +- 自动生成应用图标和启动页 ### 3. 品牌配置格式 @@ -56,8 +68,24 @@ theme: bg_color: "0xFFFFFFFF" # 背景色 text_color: "0xFF1F2937" # 主文字色 muted_text_color: "0xFF6B7280" # 次要文字色 +branding: + icon: "icon.png" # 应用图标(相对于 flavors/<品牌>/) + icon_background: "#FFFFFF" # 自适应图标背景色 + icon_foreground: "icon_foreground.png" # 自适应图标前景 + splash: "splash.png" # 启动页图片 + splash_color: "#FFFFFF" # 启动页背景色 ``` +### 4. 品牌资源规格 + +| 资源 | 文件名 | 最小尺寸 | 格式 | 说明 | +|---|---|---|---|---| +| 应用图标 | `icon.png` | 1024×1024 | PNG | 正方形,用于生成各尺寸 launcher icon | +| 自适应图标前景 | `icon_foreground.png` | 1024×1024 | PNG (透明背景) | 主体内容需居中,四周留 **25% 安全区** | +| 启动页图片 | `splash.png` | 1152×1152 | PNG | 用于生成 Android 12+ 和旧版启动页 | + +> **提示:** 资源文件放置在 `flavors/<品牌名>/` 目录下,`branding` 中的路径相对于此目录。如果省略 `branding` 段,脚本会跳过图标和启动页生成。 + ## 调试说明 部分教育平板设备使用 `Ctrl+C` 结束 `flutter run` 后,旧进程可能留在后台影响 WebView 启动。 diff --git a/apps/quanxue/.metadata b/apps/quanxue/.metadata index d31e83a..05a325e 100644 --- a/apps/quanxue/.metadata +++ b/apps/quanxue/.metadata @@ -18,9 +18,6 @@ migration: - platform: android create_revision: 90673a4eef275d1a6692c26ac80d6d746d41a73a base_revision: 90673a4eef275d1a6692c26ac80d6d746d41a73a - - platform: ios - create_revision: 90673a4eef275d1a6692c26ac80d6d746d41a73a - base_revision: 90673a4eef275d1a6692c26ac80d6d746d41a73a # User provided section diff --git a/apps/quanxue/README.md b/apps/quanxue/README.md index 6b7e444..213693b 100644 --- a/apps/quanxue/README.md +++ b/apps/quanxue/README.md @@ -1,35 +1,17 @@ -# 全学通 (quanxue) +# quanxue -「全学通」品牌的 Android 平板 H5 壳应用。 +A new Flutter project. -## 概述 +## Getting Started -本应用是 `web_shell_core` 核心库的品牌实例。`main.dart` 仅 16 行代码,只负责传入品牌配置,所有业务逻辑由核心库提供。 +This project is a starting point for a Flutter application. -## 运行 +A few resources to get you started if this is your first Flutter project: -```bash -flutter run -``` +- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter) +- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources) -## 配置 - -| 配置项 | 值 | -|---|---| -| 应用名 | 全学通 | -| 包名 | `com.wanmake.quanxue` | -| 业务标识 | `quanxue_prod` | -| 主题色 | `#3ED37B` | - -品牌配置源文件:[`flavors/quanxue.yaml`](../../flavors/quanxue.yaml) - -## 构建 - -```bash -flutter build apk --release -``` - -## 依赖 - -- `web_shell_core`(本地 path 引用) -- `cupertino_icons`(兼容历史代码) +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/apps/quanxue/analysis_options.yaml b/apps/quanxue/analysis_options.yaml index f13d6ae..0d29021 100644 --- a/apps/quanxue/analysis_options.yaml +++ b/apps/quanxue/analysis_options.yaml @@ -1,9 +1,28 @@ -# Dart 分析器配置,用于在开发阶段发现错误、警告和代码规范问题。 -# 可通过 `flutter analyze` 执行静态检查。 +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml linter: - # 如需自定义规则,可在此处开启或关闭指定 lint。 + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. rules: - # avoid_print: false # 取消注释后可关闭 `avoid_print` 规则。 - # prefer_single_quotes: true # 取消注释后可开启 `prefer_single_quotes` 规则。 + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/apps/quanxue/android/app/build.gradle.kts b/apps/quanxue/android/app/build.gradle.kts index 1f16e22..5badcf2 100644 --- a/apps/quanxue/android/app/build.gradle.kts +++ b/apps/quanxue/android/app/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("com.android.application") id("kotlin-android") - // Flutter Gradle 插件必须放在 Android 与 Kotlin Gradle 插件之后应用。 + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id("dev.flutter.flutter-gradle-plugin") } @@ -20,10 +20,10 @@ android { } defaultConfig { - // 待补充:请替换成你自己的唯一应用标识。 + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.wanmake.quanxue" - // 下面这些值可以按应用实际需求调整。 - // 更多说明可参考:https://flutter.dev/to/review-gradle-config。 + // 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 +32,8 @@ android { buildTypes { release { - // 待补充:为 release 构建配置正式签名。 - // 当前先使用 debug 签名,确保 `flutter run --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") } } diff --git a/apps/quanxue/android/app/src/main/res/drawable-hdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-hdpi/android12splash.png new file mode 100644 index 0000000..80189a2 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-hdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/apps/quanxue/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..43c8bfc Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-hdpi/splash.png b/apps/quanxue/android/app/src/main/res/drawable-hdpi/splash.png new file mode 100644 index 0000000..80189a2 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-hdpi/splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-mdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-mdpi/android12splash.png new file mode 100644 index 0000000..ebc6c1a Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-mdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/apps/quanxue/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..1be13bd Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-mdpi/splash.png b/apps/quanxue/android/app/src/main/res/drawable-mdpi/splash.png new file mode 100644 index 0000000..ebc6c1a Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-mdpi/splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-night-hdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-night-hdpi/android12splash.png new file mode 100644 index 0000000..80189a2 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-night-hdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-night-mdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-night-mdpi/android12splash.png new file mode 100644 index 0000000..ebc6c1a Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-night-mdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-night-xhdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-night-xhdpi/android12splash.png new file mode 100644 index 0000000..0506459 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-night-xhdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png new file mode 100644 index 0000000..205ee70 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png new file mode 100644 index 0000000..003f7e1 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-v21/background.png b/apps/quanxue/android/app/src/main/res/drawable-v21/background.png new file mode 100644 index 0000000..8e21404 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-v21/background.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-v21/launch_background.xml b/apps/quanxue/android/app/src/main/res/drawable-v21/launch_background.xml index f74085f..3cc4948 100644 --- a/apps/quanxue/android/app/src/main/res/drawable-v21/launch_background.xml +++ b/apps/quanxue/android/app/src/main/res/drawable-v21/launch_background.xml @@ -1,12 +1,9 @@ - - - - - + + + + + + diff --git a/apps/quanxue/android/app/src/main/res/drawable-xhdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-xhdpi/android12splash.png new file mode 100644 index 0000000..0506459 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xhdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/apps/quanxue/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..dc8f258 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xhdpi/splash.png b/apps/quanxue/android/app/src/main/res/drawable-xhdpi/splash.png new file mode 100644 index 0000000..0506459 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xhdpi/splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/android12splash.png new file mode 100644 index 0000000..205ee70 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..7e4ac6f Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/splash.png b/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/splash.png new file mode 100644 index 0000000..205ee70 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xxhdpi/splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/android12splash.png b/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/android12splash.png new file mode 100644 index 0000000..003f7e1 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/android12splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..0598067 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/splash.png b/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/splash.png new file mode 100644 index 0000000..003f7e1 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable-xxxhdpi/splash.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable/background.png b/apps/quanxue/android/app/src/main/res/drawable/background.png new file mode 100644 index 0000000..8e21404 Binary files /dev/null and b/apps/quanxue/android/app/src/main/res/drawable/background.png differ diff --git a/apps/quanxue/android/app/src/main/res/drawable/launch_background.xml b/apps/quanxue/android/app/src/main/res/drawable/launch_background.xml index 304732f..3cc4948 100644 --- a/apps/quanxue/android/app/src/main/res/drawable/launch_background.xml +++ b/apps/quanxue/android/app/src/main/res/drawable/launch_background.xml @@ -1,12 +1,9 @@ - - - - - + + + + + + diff --git a/apps/quanxue/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/quanxue/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..c79c58a --- /dev/null +++ b/apps/quanxue/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,9 @@ + + + + + + + diff --git a/apps/quanxue/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/apps/quanxue/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index db77bb4..24ab9c5 100644 Binary files a/apps/quanxue/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/apps/quanxue/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/apps/quanxue/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/apps/quanxue/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 17987b7..a4f56a1 100644 Binary files a/apps/quanxue/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/apps/quanxue/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/apps/quanxue/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/apps/quanxue/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 09d4391..f7b8f9b 100644 Binary files a/apps/quanxue/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/apps/quanxue/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/apps/quanxue/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/apps/quanxue/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index d5f1c8d..c77c8f9 100644 Binary files a/apps/quanxue/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/apps/quanxue/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/apps/quanxue/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/apps/quanxue/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 4d6372e..3e9dbef 100644 Binary files a/apps/quanxue/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/apps/quanxue/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/apps/quanxue/android/app/src/main/res/values-night-v31/styles.xml b/apps/quanxue/android/app/src/main/res/values-night-v31/styles.xml new file mode 100644 index 0000000..1b8e45f --- /dev/null +++ b/apps/quanxue/android/app/src/main/res/values-night-v31/styles.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/apps/quanxue/android/app/src/main/res/values-night/styles.xml b/apps/quanxue/android/app/src/main/res/values-night/styles.xml index 06952be..dbc9ea9 100644 --- a/apps/quanxue/android/app/src/main/res/values-night/styles.xml +++ b/apps/quanxue/android/app/src/main/res/values-night/styles.xml @@ -5,6 +5,10 @@ @drawable/launch_background + false + false + false + shortEdges + + + + diff --git a/apps/quanxue/android/app/src/main/res/values/colors.xml b/apps/quanxue/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..c5d5899 --- /dev/null +++ b/apps/quanxue/android/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/apps/quanxue/android/app/src/main/res/values/styles.xml b/apps/quanxue/android/app/src/main/res/values/styles.xml index cb1ef88..0d1fa8f 100644 --- a/apps/quanxue/android/app/src/main/res/values/styles.xml +++ b/apps/quanxue/android/app/src/main/res/values/styles.xml @@ -5,6 +5,10 @@ @drawable/launch_background + false + false + false + shortEdges