diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3820a95
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,45 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.build/
+.buildlog/
+.history
+.svn/
+.swiftpm/
+migrate_working_dir/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# The .vscode folder contains launch configuration and tasks you configure in
+# VS Code which you may wish to be included in version control, so this line
+# is commented out by default.
+#.vscode/
+
+# Flutter/Dart/Pub related
+**/doc/api/
+**/ios/Flutter/.last_build_id
+.dart_tool/
+.flutter-plugins-dependencies
+.pub-cache/
+.pub/
+/build/
+/coverage/
+
+# Symbolication related
+app.*.symbols
+
+# Obfuscation related
+app.*.map.json
+
+# Android Studio will place build artifacts here
+/android/app/debug
+/android/app/profile
+/android/app/release
diff --git a/.metadata b/.metadata
new file mode 100644
index 0000000..042fa3e
--- /dev/null
+++ b/.metadata
@@ -0,0 +1,48 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: "6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef"
+ channel: "[user-branch]"
+
+project_type: app
+
+# Tracks metadata for the flutter migrate command
+migration:
+ platforms:
+ - platform: root
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ - platform: android
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ - platform: ios
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ - platform: linux
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ - platform: macos
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ - platform: web
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ - platform: windows
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ - platform: ohos
+ create_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+ base_revision: 6719fd2a7c56f183697c55b8a2ea5bcc2fea3cef
+
+ # User provided section
+
+ # List of Local paths (relative to this file) that should be
+ # ignored by the migrate tool.
+ #
+ # Files that are not part of the templates will be ignored by default.
+ unmanaged_files:
+ - 'lib/main.dart'
+ - 'ios/Runner.xcodeproj/project.pbxproj'
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..0a1319e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# mom_kitchen
+
+A new Flutter project.
+
+## Getting Started
+
+This project is a starting point for a Flutter application.
+
+A few resources to get you started if this is your first Flutter project:
+
+- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
+- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
+
+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/analysis_options.yaml b/analysis_options.yaml
new file mode 100644
index 0000000..0d29021
--- /dev/null
+++ b/analysis_options.yaml
@@ -0,0 +1,28 @@
+# 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:
+ # 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 # 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/android/.gitignore b/android/.gitignore
new file mode 100644
index 0000000..be3943c
--- /dev/null
+++ b/android/.gitignore
@@ -0,0 +1,14 @@
+gradle-wrapper.jar
+/.gradle
+/captures/
+/gradlew
+/gradlew.bat
+/local.properties
+GeneratedPluginRegistrant.java
+.cxx/
+
+# Remember to never publicly share your keystore.
+# See https://flutter.dev/to/reference-keystore
+key.properties
+**/*.keystore
+**/*.jks
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
new file mode 100644
index 0000000..ef23fb3
--- /dev/null
+++ b/android/app/build.gradle.kts
@@ -0,0 +1,44 @@
+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")
+}
+
+android {
+ namespace = "com.example.mom_kitchen"
+ compileSdk = flutter.compileSdkVersion
+ ndkVersion = flutter.ndkVersion
+
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+
+ kotlinOptions {
+ jvmTarget = JavaVersion.VERSION_11.toString()
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId = "com.example.mom_kitchen"
+ // 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
+ versionName = flutter.versionName
+ }
+
+ 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")
+ }
+ }
+}
+
+flutter {
+ source = "../.."
+}
diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
new file mode 100644
index 0000000..399f698
--- /dev/null
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..b0f69ff
--- /dev/null
+++ b/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/kotlin/com/example/mom_kitchen/MainActivity.kt b/android/app/src/main/kotlin/com/example/mom_kitchen/MainActivity.kt
new file mode 100644
index 0000000..51799ab
--- /dev/null
+++ b/android/app/src/main/kotlin/com/example/mom_kitchen/MainActivity.kt
@@ -0,0 +1,5 @@
+package com.example.mom_kitchen
+
+import io.flutter.embedding.android.FlutterActivity
+
+class MainActivity : FlutterActivity()
diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 0000000..f74085f
--- /dev/null
+++ b/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 0000000..304732f
--- /dev/null
+++ b/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..db77bb4
Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..17987b7
Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..09d4391
Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..d5f1c8d
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4d6372e
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..06952be
--- /dev/null
+++ b/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..cb1ef88
--- /dev/null
+++ b/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml
new file mode 100644
index 0000000..399f698
--- /dev/null
+++ b/android/app/src/profile/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/android/build.gradle.kts b/android/build.gradle.kts
new file mode 100644
index 0000000..dbee657
--- /dev/null
+++ b/android/build.gradle.kts
@@ -0,0 +1,24 @@
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+val newBuildDir: Directory =
+ rootProject.layout.buildDirectory
+ .dir("../../build")
+ .get()
+rootProject.layout.buildDirectory.value(newBuildDir)
+
+subprojects {
+ val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
+ project.layout.buildDirectory.value(newSubprojectBuildDir)
+}
+subprojects {
+ project.evaluationDependsOn(":app")
+}
+
+tasks.register("clean") {
+ delete(rootProject.layout.buildDirectory)
+}
diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html
new file mode 100644
index 0000000..3feb18a
--- /dev/null
+++ b/android/build/reports/problems/problems-report.html
@@ -0,0 +1,663 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Gradle Configuration Cache
+
+
+
+
+
+
+ Loading...
+
+
+
+
+
+
+
diff --git a/android/gradle.properties b/android/gradle.properties
new file mode 100644
index 0000000..f018a61
--- /dev/null
+++ b/android/gradle.properties
@@ -0,0 +1,3 @@
+org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..ac3b479
--- /dev/null
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts
new file mode 100644
index 0000000..fb605bc
--- /dev/null
+++ b/android/settings.gradle.kts
@@ -0,0 +1,26 @@
+pluginManagement {
+ val flutterSdkPath =
+ run {
+ val properties = java.util.Properties()
+ file("local.properties").inputStream().use { properties.load(it) }
+ val flutterSdkPath = properties.getProperty("flutter.sdk")
+ require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
+ flutterSdkPath
+ }
+
+ includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
+
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+
+plugins {
+ id("dev.flutter.flutter-plugin-loader") version "1.0.0"
+ id("com.android.application") version "8.9.1" apply false
+ id("org.jetbrains.kotlin.android") version "2.1.0" apply false
+}
+
+include(":app")
diff --git a/docs/superpowers/plans/2026-04-08-refactor-implementation.md b/docs/superpowers/plans/2026-04-08-refactor-implementation.md
new file mode 100644
index 0000000..c33470e
--- /dev/null
+++ b/docs/superpowers/plans/2026-04-08-refactor-implementation.md
@@ -0,0 +1,1971 @@
+# 全面重构实施计划
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** 实现 GetX 全局状态管理、组件 PageStandards 集成、路由守卫和组件复用
+
+**Architecture:** 使用 GetX 进行状态管理,所有组件使用 PageStandards 统一样式,实现路由守卫保护需要认证的页面
+
+**Tech Stack:** Flutter, GetX, PageStandards, Cupertino (iOS 风格)
+
+---
+
+## 文件结构
+
+### 新增文件
+
+```
+lib/src/
+├── controllers/
+│ ├── base/
+│ │ ├── base_controller.dart # 基础控制器
+│ │ └── paged_controller.dart # 分页控制器
+│ ├── home_controller.dart # 首页控制器
+│ ├── cart_controller.dart # 购物车控制器
+│ └── profile_controller.dart # 个人中心控制器
+├── widgets/
+│ ├── base/
+│ │ ├── standard_button.dart # 标准按钮
+│ │ ├── standard_text_field.dart # 标准输入框
+│ │ ├── standard_card.dart # 标准卡片
+│ │ └── standard_list_tile.dart # 标准列表项
+│ ├── interactive/
+│ │ ├── standard_dialog.dart # 标准对话框
+│ │ ├── standard_bottom_sheet.dart # 标准底部弹窗
+│ │ └── standard_picker.dart # 标准选择器
+│ └── states/
+│ ├── empty_state.dart # 空状态
+│ └── error_state.dart # 错误状态
+└── standards/
+ └── route_guard.dart # 路由守卫
+```
+
+### 修改文件
+
+```
+lib/
+├── src/
+│ ├── pages/
+│ │ ├── home_page.dart # 使用 HomeController
+│ │ ├── example_page.dart # 使用 PageStandards
+│ │ └── theme_demo_page.dart # 使用控制器
+│ ├── widgets/
+│ │ ├── product_card.dart # 使用 PageStandards
+│ │ ├── loading_indicator.dart # 使用 PageStandards
+│ │ └── skeleton_loader.dart # 使用 PageStandards
+│ └── standards/
+│ └── app_pages.dart # 添加 authLevel
+└── main.dart # 集成路由守卫
+```
+
+---
+
+## Task 1: 创建基础控制器
+
+**Files:**
+- Create: `lib/src/controllers/base/base_controller.dart`
+
+- [ ] **Step 1: 创建 BaseController**
+
+```dart
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/services/app_service.dart';
+import 'package:mom_kitchen/src/utils/app_logger.dart';
+
+abstract class BaseController extends GetxController {
+ final isLoading = false.obs;
+ final errorMessage = ''.obs;
+
+ Future runWithLoading(Future Function() action) async {
+ isLoading.value = true;
+ errorMessage.value = '';
+ try {
+ await action();
+ } catch (e) {
+ errorMessage.value = e.toString();
+ AppLogger.e('Controller error: $e');
+ } finally {
+ isLoading.value = false;
+ }
+ }
+
+ void clearError() {
+ errorMessage.value = '';
+ }
+}
+```
+
+- [ ] **Step 2: 创建 PagedController**
+
+**Files:**
+- Create: `lib/src/controllers/base/paged_controller.dart`
+
+```dart
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/controllers/base/base_controller.dart';
+
+abstract class PagedController extends BaseController {
+ final items = [].obs;
+ final currentPage = 1.obs;
+ final hasMore = true.obs;
+ final pageSize = 20;
+
+ Future> fetchPage(int page);
+
+ Future loadMore() async {
+ if (!hasMore.value || isLoading.value) return;
+
+ await runWithLoading(() async {
+ final newItems = await fetchPage(currentPage.value + 1);
+ if (newItems.isEmpty) {
+ hasMore.value = false;
+ } else {
+ items.addAll(newItems);
+ currentPage.value++;
+ }
+ });
+ }
+
+ Future refresh() async {
+ currentPage.value = 1;
+ hasMore.value = true;
+ items.clear();
+ await loadMore();
+ }
+
+ void clear() {
+ items.clear();
+ currentPage.value = 1;
+ hasMore.value = true;
+ }
+}
+```
+
+- [ ] **Step 3: 提交基础控制器**
+
+```bash
+git add lib/src/controllers/base/
+git commit -m "feat: add base controllers for GetX state management"
+```
+
+---
+
+## Task 2: 创建首页控制器
+
+**Files:**
+- Create: `lib/src/controllers/home_controller.dart`
+
+- [ ] **Step 1: 创建 HomeController**
+
+```dart
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/controllers/base/base_controller.dart';
+
+class ProductModel {
+ final String name;
+ final double price;
+ final String image;
+ final String category;
+
+ ProductModel({
+ required this.name,
+ required this.price,
+ required this.image,
+ required this.category,
+ });
+
+ factory ProductModel.fromMap(Map map) {
+ return ProductModel(
+ name: map['name'] ?? '',
+ price: (map['price'] as num?)?.toDouble() ?? 0.0,
+ image: map['image'] ?? '📦',
+ category: map['category'] ?? '',
+ );
+ }
+
+ Map toMap() {
+ return {
+ 'name': name,
+ 'price': price,
+ 'image': image,
+ 'category': category,
+ };
+ }
+}
+
+class HomeController extends BaseController {
+ final products = [].obs;
+ final categories = [].obs;
+ final selectedCategory = ''.obs;
+ final searchQuery = ''.obs;
+
+ @override
+ void onInit() {
+ super.onInit();
+ loadProducts();
+ }
+
+ Future loadProducts() async {
+ await runWithLoading(() async {
+ await Future.delayed(const Duration(milliseconds: 500));
+
+ final mockProducts = [
+ ProductModel(name: 'Organic Apples', price: 4.99, image: '🍎', category: 'Fruits'),
+ ProductModel(name: 'Fresh Milk', price: 3.49, image: '🥛', category: 'Dairy'),
+ ProductModel(name: 'Whole Wheat Bread', price: 2.99, image: '🍞', category: 'Bakery'),
+ ProductModel(name: 'Free Range Eggs', price: 5.99, image: '🥚', category: 'Dairy'),
+ ProductModel(name: 'Organic Tomatoes', price: 3.99, image: '🍅', category: 'Vegetables'),
+ ProductModel(name: 'Fresh Salmon', price: 12.99, image: '🐟', category: 'Seafood'),
+ ];
+
+ products.value = mockProducts;
+
+ final categorySet = {};
+ for (var product in mockProducts) {
+ categorySet.add(product.category);
+ }
+ categories.value = categorySet.toList();
+ });
+ }
+
+ List get filteredProducts {
+ var result = products.toList();
+
+ if (selectedCategory.value.isNotEmpty) {
+ result = result.where((p) => p.category == selectedCategory.value).toList();
+ }
+
+ if (searchQuery.value.isNotEmpty) {
+ result = result.where((p) =>
+ p.name.toLowerCase().contains(searchQuery.value.toLowerCase())
+ ).toList();
+ }
+
+ return result;
+ }
+
+ void selectCategory(String category) {
+ selectedCategory.value = category;
+ }
+
+ void search(String query) {
+ searchQuery.value = query;
+ }
+
+ void clearFilters() {
+ selectedCategory.value = '';
+ searchQuery.value = '';
+ }
+}
+```
+
+- [ ] **Step 2: 提交首页控制器**
+
+```bash
+git add lib/src/controllers/home_controller.dart
+git commit -m "feat: add HomeController for state management"
+```
+
+---
+
+## Task 3: 创建购物车控制器
+
+**Files:**
+- Create: `lib/src/controllers/cart_controller.dart`
+
+- [ ] **Step 1: 创建 CartController**
+
+```dart
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/controllers/base/base_controller.dart';
+import 'package:mom_kitchen/src/controllers/home_controller.dart';
+
+class CartItem {
+ final ProductModel product;
+ int quantity;
+
+ CartItem({
+ required this.product,
+ this.quantity = 1,
+ });
+
+ double get totalPrice => product.price * quantity;
+}
+
+class CartController extends BaseController {
+ final cartItems = [].obs;
+
+ @override
+ void onInit() {
+ super.onInit();
+ }
+
+ void addProduct(ProductModel product) {
+ final index = cartItems.indexWhere((item) => item.product.name == product.name);
+ if (index >= 0) {
+ cartItems[index].quantity++;
+ cartItems.refresh();
+ } else {
+ cartItems.add(CartItem(product: product));
+ }
+ }
+
+ void removeProduct(String productName) {
+ cartItems.removeWhere((item) => item.product.name == productName);
+ }
+
+ void updateQuantity(String productName, int quantity) {
+ final index = cartItems.indexWhere((item) => item.product.name == productName);
+ if (index >= 0) {
+ if (quantity <= 0) {
+ cartItems.removeAt(index);
+ } else {
+ cartItems[index].quantity = quantity;
+ cartItems.refresh();
+ }
+ }
+ }
+
+ void incrementQuantity(String productName) {
+ final index = cartItems.indexWhere((item) => item.product.name == productName);
+ if (index >= 0) {
+ cartItems[index].quantity++;
+ cartItems.refresh();
+ }
+ }
+
+ void decrementQuantity(String productName) {
+ final index = cartItems.indexWhere((item) => item.product.name == productName);
+ if (index >= 0) {
+ if (cartItems[index].quantity > 1) {
+ cartItems[index].quantity--;
+ cartItems.refresh();
+ } else {
+ cartItems.removeAt(index);
+ }
+ }
+ }
+
+ void clearCart() {
+ cartItems.clear();
+ }
+
+ double get totalPrice {
+ return cartItems.fold(0.0, (sum, item) => sum + item.totalPrice);
+ }
+
+ int get totalItems {
+ return cartItems.fold(0, (sum, item) => sum + item.quantity);
+ }
+
+ bool isInCart(String productName) {
+ return cartItems.any((item) => item.product.name == productName);
+ }
+
+ int getQuantity(String productName) {
+ final index = cartItems.indexWhere((item) => item.product.name == productName);
+ return index >= 0 ? cartItems[index].quantity : 0;
+ }
+}
+```
+
+- [ ] **Step 2: 提交购物车控制器**
+
+```bash
+git add lib/src/controllers/cart_controller.dart
+git commit -m "feat: add CartController for cart state management"
+```
+
+---
+
+## Task 4: 创建个人中心控制器
+
+**Files:**
+- Create: `lib/src/controllers/profile_controller.dart`
+
+- [ ] **Step 1: 创建 ProfileController**
+
+```dart
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/controllers/base/base_controller.dart';
+import 'package:mom_kitchen/src/services/app_service.dart';
+
+class UserModel {
+ final String id;
+ final String name;
+ final String email;
+ final String? avatar;
+
+ UserModel({
+ required this.id,
+ required this.name,
+ required this.email,
+ this.avatar,
+ });
+
+ factory UserModel.empty() {
+ return UserModel(
+ id: '',
+ name: '',
+ email: '',
+ );
+ }
+
+ bool get isEmpty => id.isEmpty;
+ bool get isNotEmpty => id.isNotEmpty;
+}
+
+class ProfileController extends BaseController {
+ final user = Rx(null);
+ final isLoggedIn = false.obs;
+
+ @override
+ void onInit() {
+ super.onInit();
+ checkLoginStatus();
+ }
+
+ Future checkLoginStatus() async {
+ await runWithLoading(() async {
+ final storage = AppService.instance.storage;
+ final userId = await storage.getString('user_id');
+ if (userId != null && userId.isNotEmpty) {
+ final name = await storage.getString('user_name') ?? 'User';
+ final email = await storage.getString('user_email') ?? '';
+ user.value = UserModel(
+ id: userId,
+ name: name,
+ email: email,
+ );
+ isLoggedIn.value = true;
+ }
+ });
+ }
+
+ Future login(String email, String password) async {
+ await runWithLoading(() async {
+ await Future.delayed(const Duration(seconds: 1));
+
+ final storage = AppService.instance.storage;
+ await storage.setString('user_id', 'user_123');
+ await storage.setString('user_name', 'Test User');
+ await storage.setString('user_email', email);
+
+ user.value = UserModel(
+ id: 'user_123',
+ name: 'Test User',
+ email: email,
+ );
+ isLoggedIn.value = true;
+ });
+ }
+
+ Future logout() async {
+ await runWithLoading(() async {
+ final storage = AppService.instance.storage;
+ await storage.remove('user_id');
+ await storage.remove('user_name');
+ await storage.remove('user_email');
+
+ user.value = null;
+ isLoggedIn.value = false;
+ });
+ }
+
+ Future updateProfile({String? name, String? avatar}) async {
+ if (user.value == null) return;
+
+ await runWithLoading(() async {
+ await Future.delayed(const Duration(milliseconds: 500));
+
+ final storage = AppService.instance.storage;
+
+ if (name != null) {
+ await storage.setString('user_name', name);
+ }
+
+ user.value = UserModel(
+ id: user.value!.id,
+ name: name ?? user.value!.name,
+ email: user.value!.email,
+ avatar: avatar ?? user.value!.avatar,
+ );
+ });
+ }
+}
+```
+
+- [ ] **Step 2: 提交个人中心控制器**
+
+```bash
+git add lib/src/controllers/profile_controller.dart
+git commit -m "feat: add ProfileController for user state management"
+```
+
+---
+
+## Task 5: 创建标准按钮组件
+
+**Files:**
+- Create: `lib/src/widgets/base/standard_button.dart`
+
+- [ ] **Step 1: 创建 StandardButton**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+enum StandardButtonType { primary, secondary, outline, text }
+
+class StandardButton extends StatelessWidget {
+ final String text;
+ final VoidCallback? onPressed;
+ final StandardButtonType type;
+ final bool isLoading;
+ final IconData? icon;
+ final bool isFullWidth;
+ final double? width;
+ final double? height;
+
+ const StandardButton({
+ super.key,
+ required this.text,
+ this.onPressed,
+ this.type = StandardButtonType.primary,
+ this.isLoading = false,
+ this.icon,
+ this.isFullWidth = false,
+ this.width,
+ this.height,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return GestureDetector(
+ onTap: isLoading ? null : onPressed,
+ child: Container(
+ width: isFullWidth ? double.infinity : width,
+ height: height ?? standards.scaledHeight(48),
+ padding: standards.scaledPadding(
+ EdgeInsets.symmetric(horizontal: 24, vertical: 12),
+ ),
+ decoration: _buildDecoration(standards),
+ child: _buildChild(standards),
+ ),
+ );
+ }
+
+ BoxDecoration _buildDecoration(PageStandards standards) {
+ switch (type) {
+ case StandardButtonType.primary:
+ return BoxDecoration(
+ color: standards.primaryColor,
+ borderRadius: BorderRadius.circular(standards.scaledRadius(12)),
+ );
+ case StandardButtonType.secondary:
+ return BoxDecoration(
+ color: standards.secondaryColor,
+ borderRadius: BorderRadius.circular(standards.scaledRadius(12)),
+ );
+ case StandardButtonType.outline:
+ return BoxDecoration(
+ border: Border.all(color: standards.primaryColor, width: 1.5),
+ borderRadius: BorderRadius.circular(standards.scaledRadius(12)),
+ );
+ case StandardButtonType.text:
+ return const BoxDecoration();
+ }
+ }
+
+ Widget _buildChild(PageStandards standards) {
+ if (isLoading) {
+ return Center(
+ child: CupertinoActivityIndicator(color: _getTextColor(standards)),
+ );
+ }
+
+ return Row(
+ mainAxisSize: isFullWidth ? MainAxisSize.max : MainAxisSize.min,
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ if (icon != null) ...[
+ Icon(icon, color: _getTextColor(standards), size: standards.fontSize + 4),
+ SizedBox(width: standards.scaledWidth(8)),
+ ],
+ Text(
+ text,
+ style: standards.textStyle.copyWith(
+ color: _getTextColor(standards),
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ],
+ );
+ }
+
+ Color _getTextColor(PageStandards standards) {
+ switch (type) {
+ case StandardButtonType.primary:
+ case StandardButtonType.secondary:
+ return CupertinoColors.white;
+ case StandardButtonType.outline:
+ case StandardButtonType.text:
+ return standards.primaryColor;
+ }
+ }
+}
+```
+
+- [ ] **Step 2: 提交标准按钮组件**
+
+```bash
+git add lib/src/widgets/base/standard_button.dart
+git commit -m "feat: add StandardButton component with PageStandards"
+```
+
+---
+
+## Task 6: 创建标准输入框组件
+
+**Files:**
+- Create: `lib/src/widgets/base/standard_text_field.dart`
+
+- [ ] **Step 1: 创建 StandardTextField**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+class StandardTextField extends StatelessWidget {
+ final String? placeholder;
+ final String? initialValue;
+ final ValueChanged? onChanged;
+ final VoidCallback? onEditingComplete;
+ final ValueChanged? onSubmitted;
+ final bool obscureText;
+ final TextInputType? keyboardType;
+ final TextEditingController? controller;
+ final FocusNode? focusNode;
+ final IconData? prefixIcon;
+ final IconData? suffixIcon;
+ final VoidCallback? onSuffixIconPressed;
+ final String? errorText;
+ final int? maxLines;
+ final bool enabled;
+ final bool autofocus;
+
+ const StandardTextField({
+ super.key,
+ this.placeholder,
+ this.initialValue,
+ this.onChanged,
+ this.onEditingComplete,
+ this.onSubmitted,
+ this.obscureText = false,
+ this.keyboardType,
+ this.controller,
+ this.focusNode,
+ this.prefixIcon,
+ this.suffixIcon,
+ this.onSuffixIconPressed,
+ this.errorText,
+ this.maxLines = 1,
+ this.enabled = true,
+ this.autofocus = false,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Container(
+ decoration: BoxDecoration(
+ color: standards.backgroundColor,
+ borderRadius: BorderRadius.circular(standards.scaledRadius(12)),
+ border: Border.all(
+ color: errorText != null
+ ? standards.secondaryColor
+ : standards.textColor.withOpacity(0.2),
+ ),
+ ),
+ child: Row(
+ children: [
+ if (prefixIcon != null)
+ Padding(
+ padding: EdgeInsets.only(left: standards.scaledWidth(12)),
+ child: Icon(
+ prefixIcon,
+ color: standards.textColor.withOpacity(0.5),
+ size: standards.fontSize + 4,
+ ),
+ ),
+ Expanded(
+ child: CupertinoTextField(
+ controller: controller,
+ focusNode: focusNode,
+ placeholder: placeholder,
+ placeholderStyle: TextStyle(
+ color: standards.textColor.withOpacity(0.5),
+ fontSize: standards.fontSize,
+ ),
+ style: TextStyle(
+ color: standards.textColor,
+ fontSize: standards.fontSize,
+ ),
+ onChanged: onChanged,
+ onEditingComplete: onEditingComplete,
+ onSubmitted: onSubmitted,
+ obscureText: obscureText,
+ keyboardType: keyboardType,
+ maxLines: maxLines,
+ enabled: enabled,
+ autofocus: autofocus,
+ decoration: const BoxDecoration(),
+ padding: standards.scaledPadding(
+ EdgeInsets.symmetric(horizontal: 12, vertical: 12),
+ ),
+ ),
+ ),
+ if (suffixIcon != null)
+ GestureDetector(
+ onTap: onSuffixIconPressed,
+ child: Padding(
+ padding: EdgeInsets.only(right: standards.scaledWidth(12)),
+ child: Icon(
+ suffixIcon,
+ color: standards.textColor.withOpacity(0.5),
+ size: standards.fontSize + 4,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (errorText != null) ...[
+ SizedBox(height: standards.scaledHeight(4)),
+ Padding(
+ padding: EdgeInsets.only(left: standards.scaledWidth(12)),
+ child: Text(
+ errorText!,
+ style: TextStyle(
+ color: standards.secondaryColor,
+ fontSize: standards.fontSize - 2,
+ ),
+ ),
+ ),
+ ],
+ ],
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交标准输入框组件**
+
+```bash
+git add lib/src/widgets/base/standard_text_field.dart
+git commit -m "feat: add StandardTextField component with PageStandards"
+```
+
+---
+
+## Task 7: 创建标准卡片组件
+
+**Files:**
+- Create: `lib/src/widgets/base/standard_card.dart`
+
+- [ ] **Step 1: 创建 StandardCard**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+class StandardCard extends StatelessWidget {
+ final Widget child;
+ final VoidCallback? onTap;
+ final EdgeInsetsGeometry? padding;
+ final EdgeInsetsGeometry? margin;
+ final Color? backgroundColor;
+ final double? borderRadius;
+ final bool showShadow;
+ final bool showBorder;
+ final Color? borderColor;
+
+ const StandardCard({
+ super.key,
+ required this.child,
+ this.onTap,
+ this.padding,
+ this.margin,
+ this.backgroundColor,
+ this.borderRadius,
+ this.showShadow = true,
+ this.showBorder = false,
+ this.borderColor,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return GestureDetector(
+ onTap: onTap,
+ child: Container(
+ margin: margin ?? standards.scaledPadding(EdgeInsets.all(8)),
+ padding: padding ?? standards.scaledPadding(EdgeInsets.all(16)),
+ decoration: BoxDecoration(
+ color: backgroundColor ?? standards.backgroundColor,
+ borderRadius: BorderRadius.circular(
+ borderRadius ?? standards.scaledRadius(16),
+ ),
+ boxShadow: showShadow
+ ? [
+ BoxShadow(
+ color: standards.textColor.withOpacity(0.05),
+ blurRadius: 10,
+ offset: const Offset(0, 4),
+ ),
+ ]
+ : null,
+ border: showBorder
+ ? Border.all(
+ color: borderColor ?? standards.textColor.withOpacity(0.1),
+ )
+ : null,
+ ),
+ child: child,
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交标准卡片组件**
+
+```bash
+git add lib/src/widgets/base/standard_card.dart
+git commit -m "feat: add StandardCard component with PageStandards"
+```
+
+---
+
+## Task 8: 创建标准列表项组件
+
+**Files:**
+- Create: `lib/src/widgets/base/standard_list_tile.dart`
+
+- [ ] **Step 1: 创建 StandardListTile**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+class StandardListTile extends StatelessWidget {
+ final IconData? leadingIcon;
+ final Widget? leading;
+ final String title;
+ final String? subtitle;
+ final Widget? trailing;
+ final VoidCallback? onTap;
+ final bool showChevron;
+ final EdgeInsetsGeometry? padding;
+
+ const StandardListTile({
+ super.key,
+ this.leadingIcon,
+ this.leading,
+ required this.title,
+ this.subtitle,
+ this.trailing,
+ this.onTap,
+ this.showChevron = false,
+ this.padding,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return GestureDetector(
+ onTap: onTap,
+ behavior: HitTestBehavior.opaque,
+ child: Container(
+ padding: padding ??
+ standards.scaledPadding(
+ EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+ ),
+ child: Row(
+ children: [
+ if (leading != null) leading!,
+ if (leadingIcon != null)
+ Container(
+ width: standards.scaledWidth(40),
+ height: standards.scaledHeight(40),
+ decoration: BoxDecoration(
+ color: standards.primaryColor.withOpacity(0.1),
+ borderRadius: BorderRadius.circular(standards.scaledRadius(10)),
+ ),
+ child: Icon(
+ leadingIcon,
+ color: standards.primaryColor,
+ size: standards.fontSize + 8,
+ ),
+ ),
+ if (leadingIcon != null || leading != null)
+ SizedBox(width: standards.scaledWidth(12)),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ title,
+ style: standards.textStyle.copyWith(
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ if (subtitle != null) ...[
+ SizedBox(height: standards.scaledHeight(2)),
+ Text(
+ subtitle!,
+ style: standards.textStyle.copyWith(
+ color: standards.textColor.withOpacity(0.6),
+ fontSize: standards.fontSize - 2,
+ ),
+ ),
+ ],
+ ],
+ ),
+ ),
+ if (trailing != null) trailing!,
+ if (showChevron)
+ Icon(
+ CupertinoIcons.chevron_right,
+ color: standards.textColor.withOpacity(0.4),
+ size: standards.fontSize + 4,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交标准列表项组件**
+
+```bash
+git add lib/src/widgets/base/standard_list_tile.dart
+git commit -m "feat: add StandardListTile component with PageStandards"
+```
+
+---
+
+## Task 9: 创建空状态组件
+
+**Files:**
+- Create: `lib/src/widgets/states/empty_state.dart`
+
+- [ ] **Step 1: 创建 EmptyState**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+import 'package:mom_kitchen/src/widgets/base/standard_button.dart';
+
+class EmptyState extends StatelessWidget {
+ final String? title;
+ final String? message;
+ final IconData? icon;
+ final String? emoji;
+ final String? buttonText;
+ final VoidCallback? onButtonPressed;
+
+ const EmptyState({
+ super.key,
+ this.title,
+ this.message,
+ this.icon,
+ this.emoji,
+ this.buttonText,
+ this.onButtonPressed,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+ final l10n = standards.l10n;
+
+ return Center(
+ child: Padding(
+ padding: standards.scaledPadding(EdgeInsets.all(32)),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ if (emoji != null)
+ Text(
+ emoji!,
+ style: TextStyle(fontSize: standards.scaledFontSize(64)),
+ )
+ else
+ Icon(
+ icon ?? CupertinoIcons.cube_box,
+ size: standards.scaledFontSize(64),
+ color: standards.textColor.withOpacity(0.4),
+ ),
+ SizedBox(height: standards.scaledHeight(16)),
+ Text(
+ title ?? l10n.noData,
+ style: standards.textStyle.copyWith(
+ fontSize: standards.fontSize + 4,
+ fontWeight: FontWeight.w600,
+ ),
+ textAlign: TextAlign.center,
+ ),
+ if (message != null) ...[
+ SizedBox(height: standards.scaledHeight(8)),
+ Text(
+ message!,
+ style: standards.textStyle.copyWith(
+ color: standards.textColor.withOpacity(0.6),
+ ),
+ textAlign: TextAlign.center,
+ ),
+ ],
+ if (buttonText != null && onButtonPressed != null) ...[
+ SizedBox(height: standards.scaledHeight(24)),
+ StandardButton(
+ text: buttonText!,
+ onPressed: onButtonPressed,
+ type: StandardButtonType.primary,
+ ),
+ ],
+ ],
+ ),
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交空状态组件**
+
+```bash
+git add lib/src/widgets/states/empty_state.dart
+git commit -m "feat: add EmptyState component with PageStandards"
+```
+
+---
+
+## Task 10: 创建错误状态组件
+
+**Files:**
+- Create: `lib/src/widgets/states/error_state.dart`
+
+- [ ] **Step 1: 创建 ErrorState**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+import 'package:mom_kitchen/src/widgets/base/standard_button.dart';
+
+class ErrorState extends StatelessWidget {
+ final String message;
+ final VoidCallback? onRetry;
+ final String? retryText;
+
+ const ErrorState({
+ super.key,
+ required this.message,
+ this.onRetry,
+ this.retryText,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+ final l10n = standards.l10n;
+
+ return Center(
+ child: Padding(
+ padding: standards.scaledPadding(EdgeInsets.all(32)),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ '⚠️',
+ style: TextStyle(fontSize: standards.scaledFontSize(64)),
+ ),
+ SizedBox(height: standards.scaledHeight(16)),
+ Text(
+ message,
+ style: standards.textStyle,
+ textAlign: TextAlign.center,
+ ),
+ if (onRetry != null) ...[
+ SizedBox(height: standards.scaledHeight(24)),
+ StandardButton(
+ text: retryText ?? l10n.retry,
+ onPressed: onRetry,
+ type: StandardButtonType.outline,
+ ),
+ ],
+ ],
+ ),
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交错误状态组件**
+
+```bash
+git add lib/src/widgets/states/error_state.dart
+git commit -m "feat: add ErrorState component with PageStandards"
+```
+
+---
+
+## Task 11: 创建标准对话框组件
+
+**Files:**
+- Create: `lib/src/widgets/interactive/standard_dialog.dart`
+
+- [ ] **Step 1: 创建 StandardDialog**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+class StandardDialog extends StatelessWidget {
+ final String title;
+ final String? message;
+ final String? confirmText;
+ final String? cancelText;
+ final VoidCallback? onConfirm;
+ final VoidCallback? onCancel;
+ final bool isDestructive;
+
+ const StandardDialog({
+ super.key,
+ required this.title,
+ this.message,
+ this.confirmText,
+ this.cancelText,
+ this.onConfirm,
+ this.onCancel,
+ this.isDestructive = false,
+ });
+
+ static Future show(
+ BuildContext context, {
+ required String title,
+ String? message,
+ String? confirmText,
+ String? cancelText,
+ bool isDestructive = false,
+ }) {
+ return showCupertinoDialog(
+ context: context,
+ builder: (context) => StandardDialog(
+ title: title,
+ message: message,
+ confirmText: confirmText,
+ cancelText: cancelText,
+ isDestructive: isDestructive,
+ ),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+ final l10n = standards.l10n;
+
+ return CupertinoAlertDialog(
+ title: Text(title, style: standards.textStyle),
+ content: message != null
+ ? Padding(
+ padding: const EdgeInsets.only(top: 8.0),
+ child: Text(message!, style: standards.textStyle),
+ )
+ : null,
+ actions: [
+ if (cancelText != null || onCancel != null)
+ CupertinoDialogAction(
+ onPressed: () {
+ Navigator.pop(context, false);
+ onCancel?.call();
+ },
+ child: Text(cancelText ?? l10n.cancel),
+ ),
+ CupertinoDialogAction(
+ isDestructiveAction: isDestructive,
+ onPressed: () {
+ Navigator.pop(context, true);
+ onConfirm?.call();
+ },
+ child: Text(confirmText ?? l10n.confirm),
+ ),
+ ],
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交标准对话框组件**
+
+```bash
+git add lib/src/widgets/interactive/standard_dialog.dart
+git commit -m "feat: add StandardDialog component with PageStandards"
+```
+
+---
+
+## Task 12: 创建标准底部弹窗组件
+
+**Files:**
+- Create: `lib/src/widgets/interactive/standard_bottom_sheet.dart`
+
+- [ ] **Step 1: 创建 StandardBottomSheet**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+class StandardBottomSheet extends StatelessWidget {
+ final String? title;
+ final Widget child;
+ final double? height;
+
+ const StandardBottomSheet({
+ super.key,
+ this.title,
+ required this.child,
+ this.height,
+ });
+
+ static Future show({
+ required BuildContext context,
+ String? title,
+ required Widget child,
+ double? height,
+ bool isScrollControlled = false,
+ }) {
+ return showModalBottomSheet(
+ context: context,
+ isScrollControlled: isScrollControlled,
+ backgroundColor: Colors.transparent,
+ builder: (context) => StandardBottomSheet(
+ title: title,
+ child: child,
+ height: height,
+ ),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return Container(
+ height: height,
+ decoration: BoxDecoration(
+ color: standards.backgroundColor,
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(standards.scaledRadius(20)),
+ ),
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Container(
+ margin: EdgeInsets.only(top: standards.scaledHeight(8)),
+ width: standards.scaledWidth(36),
+ height: standards.scaledHeight(4),
+ decoration: BoxDecoration(
+ color: standards.textColor.withOpacity(0.2),
+ borderRadius: BorderRadius.circular(standards.scaledRadius(2)),
+ ),
+ ),
+ if (title != null)
+ Padding(
+ padding: standards.scaledPadding(EdgeInsets.all(16)),
+ child: Text(
+ title!,
+ style: standards.textStyle.copyWith(
+ fontSize: standards.fontSize + 4,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ Flexible(child: child),
+ ],
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交标准底部弹窗组件**
+
+```bash
+git add lib/src/widgets/interactive/standard_bottom_sheet.dart
+git commit -m "feat: add StandardBottomSheet component with PageStandards"
+```
+
+---
+
+## Task 13: 创建标准选择器组件
+
+**Files:**
+- Create: `lib/src/widgets/interactive/standard_picker.dart`
+
+- [ ] **Step 1: 创建 StandardPicker**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+class StandardPickerItem {
+ final T value;
+ final String label;
+
+ StandardPickerItem({
+ required this.value,
+ required this.label,
+ });
+}
+
+class StandardPicker extends StatelessWidget {
+ final List> items;
+ final T? selectedValue;
+ final ValueChanged? onChanged;
+ final String? title;
+
+ const StandardPicker({
+ super.key,
+ required this.items,
+ this.selectedValue,
+ this.onChanged,
+ this.title,
+ });
+
+ static Future show({
+ required BuildContext context,
+ required List> items,
+ T? selectedValue,
+ String? title,
+ }) async {
+ final standards = PageStandards.of(context);
+
+ return await showCupertinoModalPopup(
+ context: context,
+ builder: (context) => Container(
+ height: standards.scaledHeight(300),
+ decoration: BoxDecoration(
+ color: standards.backgroundColor,
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(standards.scaledRadius(20)),
+ ),
+ ),
+ child: Column(
+ children: [
+ if (title != null)
+ Container(
+ padding: standards.scaledPadding(EdgeInsets.all(16)),
+ child: Text(
+ title!,
+ style: standards.textStyle.copyWith(
+ fontSize: standards.fontSize + 4,
+ fontWeight: FontWeight.w600,
+ ),
+ ),
+ ),
+ Expanded(
+ child: CupertinoPicker(
+ itemExtent: standards.scaledHeight(40),
+ scrollController: FixedExtentScrollController(
+ initialItem: selectedValue != null
+ ? items.indexWhere((e) => e.value == selectedValue)
+ : 0,
+ ),
+ onSelectedItemChanged: (index) {
+ Navigator.pop(context, items[index].value);
+ },
+ children: items
+ .map((item) => Center(
+ child: Text(
+ item.label,
+ style: standards.textStyle,
+ ),
+ ))
+ .toList(),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return Container(
+ height: standards.scaledHeight(200),
+ color: standards.backgroundColor,
+ child: CupertinoPicker(
+ itemExtent: standards.scaledHeight(40),
+ scrollController: FixedExtentScrollController(
+ initialItem: selectedValue != null
+ ? items.indexWhere((e) => e.value == selectedValue)
+ : 0,
+ ),
+ onSelectedItemChanged: (index) {
+ onChanged?.call(items[index].value);
+ },
+ children: items
+ .map((item) => Center(
+ child: Text(
+ item.label,
+ style: standards.textStyle,
+ ),
+ ))
+ .toList(),
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 2: 提交标准选择器组件**
+
+```bash
+git add lib/src/widgets/interactive/standard_picker.dart
+git commit -m "feat: add StandardPicker component with PageStandards"
+```
+
+---
+
+## Task 14: 创建路由守卫
+
+**Files:**
+- Create: `lib/src/standards/route_guard.dart`
+
+- [ ] **Step 1: 创建 RouteGuard**
+
+```dart
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/standards/app_pages.dart';
+import 'package:mom_kitchen/src/controllers/profile_controller.dart';
+
+enum AuthLevel { none, optional, required }
+
+class RouteGuard {
+ static bool canAccess(String route, {String? userId}) {
+ final pageInfo = PageRegistry.getPage(route);
+ if (pageInfo == null) return false;
+
+ final authLevel = pageInfo.metadata?['authLevel'] as AuthLevel? ?? AuthLevel.none;
+
+ switch (authLevel) {
+ case AuthLevel.none:
+ return true;
+ case AuthLevel.optional:
+ return true;
+ case AuthLevel.required:
+ return userId != null && userId.isNotEmpty;
+ }
+ }
+
+ static String? getRedirectRoute(String route, {String? userId}) {
+ if (canAccess(route, userId: userId)) return null;
+
+ return '/login';
+ }
+
+ static Future checkAuth(String route) async {
+ final profileController = Get.find();
+ await profileController.checkLoginStatus();
+
+ final userId = profileController.user.value?.id;
+ return canAccess(route, userId: userId);
+ }
+
+ static Future getAuthRedirect(String route) async {
+ final profileController = Get.find();
+ await profileController.checkLoginStatus();
+
+ final userId = profileController.user.value?.id;
+ return getRedirectRoute(route, userId: userId);
+ }
+}
+```
+
+- [ ] **Step 2: 提交路由守卫**
+
+```bash
+git add lib/src/standards/route_guard.dart
+git commit -m "feat: add RouteGuard for authentication"
+```
+
+---
+
+## Task 15: 重构 LoadingIndicator
+
+**Files:**
+- Modify: `lib/src/widgets/loading_indicator.dart`
+
+- [ ] **Step 1: 读取现有 LoadingIndicator**
+
+Run: Read `lib/src/widgets/loading_indicator.dart`
+
+- [ ] **Step 2: 重构 LoadingIndicator 使用 PageStandards**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+
+class LoadingIndicator extends StatelessWidget {
+ final double size;
+ final Color? color;
+
+ const LoadingIndicator({
+ super.key,
+ this.size = 32,
+ this.color,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return Center(
+ child: CupertinoActivityIndicator(
+ radius: standards.scaledRadius(size / 2),
+ color: color ?? standards.primaryColor,
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 3: 提交重构**
+
+```bash
+git add lib/src/widgets/loading_indicator.dart
+git commit -m "refactor: update LoadingIndicator to use PageStandards"
+```
+
+---
+
+## Task 16: 重构 ProductCard
+
+**Files:**
+- Modify: `lib/src/widgets/product_card.dart`
+
+- [ ] **Step 1: 读取现有 ProductCard**
+
+Run: Read `lib/src/widgets/product_card.dart`
+
+- [ ] **Step 2: 重构 ProductCard 使用 PageStandards**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+import 'package:mom_kitchen/src/controllers/home_controller.dart';
+
+class ProductCard extends StatelessWidget {
+ final ProductModel product;
+ final VoidCallback? onTap;
+ final VoidCallback? onAddToCart;
+
+ const ProductCard({
+ super.key,
+ required this.product,
+ this.onTap,
+ this.onAddToCart,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ return GestureDetector(
+ onTap: onTap,
+ child: Container(
+ decoration: BoxDecoration(
+ color: standards.backgroundColor,
+ borderRadius: BorderRadius.circular(standards.scaledRadius(16)),
+ boxShadow: [
+ BoxShadow(
+ color: standards.textColor.withOpacity(0.05),
+ blurRadius: 10,
+ offset: const Offset(0, 4),
+ ),
+ ],
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _buildImage(standards),
+ _buildInfo(standards),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _buildImage(PageStandards standards) {
+ return Expanded(
+ child: Container(
+ decoration: BoxDecoration(
+ color: standards.primaryColor.withOpacity(0.1),
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(standards.scaledRadius(16)),
+ ),
+ ),
+ child: Center(
+ child: Text(
+ product.image,
+ style: TextStyle(fontSize: standards.scaledFontSize(48)),
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget _buildInfo(PageStandards standards) {
+ return Padding(
+ padding: standards.scaledPadding(EdgeInsets.all(12)),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ product.name,
+ style: standards.textStyle.copyWith(
+ fontWeight: FontWeight.w600,
+ ),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ ),
+ SizedBox(height: standards.scaledHeight(4)),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '\$${product.price.toStringAsFixed(2)}',
+ style: standards.primaryTextStyle.copyWith(
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ if (onAddToCart != null)
+ GestureDetector(
+ onTap: onAddToCart,
+ child: Container(
+ padding: standards.scaledPadding(EdgeInsets.all(6)),
+ decoration: BoxDecoration(
+ color: standards.primaryColor,
+ borderRadius: BorderRadius.circular(
+ standards.scaledRadius(8),
+ ),
+ ),
+ child: Icon(
+ CupertinoIcons.plus,
+ color: CupertinoColors.white,
+ size: standards.fontSize,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+}
+```
+
+- [ ] **Step 3: 提交重构**
+
+```bash
+git add lib/src/widgets/product_card.dart
+git commit -m "refactor: update ProductCard to use PageStandards"
+```
+
+---
+
+## Task 17: 重构 HomePage 使用 GetX
+
+**Files:**
+- Modify: `lib/src/pages/home_page.dart`
+
+- [ ] **Step 1: 读取现有 HomePage**
+
+Run: Read `lib/src/pages/home_page.dart`
+
+- [ ] **Step 2: 重构 HomePage 使用 GetX 控制器**
+
+```dart
+import 'package:flutter/cupertino.dart';
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/controllers/home_controller.dart';
+import 'package:mom_kitchen/src/controllers/cart_controller.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+import 'package:mom_kitchen/src/widgets/product_card.dart';
+import 'package:mom_kitchen/src/widgets/states/empty_state.dart';
+import 'package:mom_kitchen/src/widgets/states/error_state.dart';
+import 'package:mom_kitchen/src/widgets/loading_indicator.dart';
+import 'package:mom_kitchen/src/widgets/responsive_grid.dart';
+import 'package:mom_kitchen/src/widgets/adaptive_scaffold.dart';
+
+class HomePage extends StatelessWidget {
+ const HomePage({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final homeController = Get.put(HomeController());
+ final cartController = Get.put(CartController());
+ final standards = PageStandards.of(context);
+
+ return CupertinoPageScaffold(
+ backgroundColor: standards.backgroundColor,
+ child: SafeArea(
+ child: Obx(() {
+ if (homeController.isLoading.value) {
+ return const LoadingIndicator();
+ }
+
+ if (homeController.errorMessage.value.isNotEmpty) {
+ return ErrorState(
+ message: homeController.errorMessage.value,
+ onRetry: () => homeController.loadProducts(),
+ );
+ }
+
+ return Column(
+ children: [
+ _buildSearchBar(homeController, standards),
+ _buildCategoryFilter(homeController, standards),
+ Expanded(
+ child: homeController.filteredProducts.isEmpty
+ ? const EmptyState(
+ emoji: '🔍',
+ title: 'No products found',
+ message: 'Try a different search or category',
+ )
+ : _buildProductGrid(
+ homeController,
+ cartController,
+ standards,
+ ),
+ ),
+ ],
+ );
+ }),
+ ),
+ );
+ }
+
+ Widget _buildSearchBar(HomeController controller, PageStandards standards) {
+ return Padding(
+ padding: standards.scaledPadding(EdgeInsets.all(16)),
+ child: Container(
+ decoration: BoxDecoration(
+ color: standards.backgroundColor,
+ borderRadius: BorderRadius.circular(standards.scaledRadius(12)),
+ border: Border.all(
+ color: standards.textColor.withOpacity(0.1),
+ ),
+ ),
+ child: CupertinoSearchTextField(
+ placeholder: 'Search products...',
+ style: TextStyle(color: standards.textColor),
+ placeholderStyle: TextStyle(
+ color: standards.textColor.withOpacity(0.5),
+ ),
+ decoration: null,
+ onChanged: controller.search,
+ ),
+ ),
+ );
+ }
+
+ Widget _buildCategoryFilter(HomeController controller, PageStandards standards) {
+ return Obx(() => Container(
+ height: standards.scaledHeight(44),
+ padding: EdgeInsets.symmetric(horizontal: standards.scaledWidth(16)),
+ child: ListView.builder(
+ scrollDirection: Axis.horizontal,
+ itemCount: controller.categories.length + 1,
+ itemBuilder: (context, index) {
+ final isSelected = index == 0
+ ? controller.selectedCategory.value.isEmpty
+ : controller.selectedCategory.value ==
+ controller.categories[index - 1];
+
+ return Padding(
+ padding: EdgeInsets.only(right: standards.scaledWidth(8)),
+ child: GestureDetector(
+ onTap: () {
+ if (index == 0) {
+ controller.selectCategory('');
+ } else {
+ controller.selectCategory(controller.categories[index - 1]);
+ }
+ },
+ child: Container(
+ padding: standards.scaledPadding(
+ EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ ),
+ decoration: BoxDecoration(
+ color: isSelected
+ ? standards.primaryColor
+ : standards.backgroundColor,
+ borderRadius: BorderRadius.circular(
+ standards.scaledRadius(20),
+ ),
+ border: Border.all(
+ color: isSelected
+ ? standards.primaryColor
+ : standards.textColor.withOpacity(0.2),
+ ),
+ ),
+ child: Text(
+ index == 0 ? 'All' : controller.categories[index - 1],
+ style: standards.textStyle.copyWith(
+ color: isSelected
+ ? CupertinoColors.white
+ : standards.textColor,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ),
+ ),
+ );
+ },
+ ),
+ ));
+ }
+
+ Widget _buildProductGrid(
+ HomeController homeController,
+ CartController cartController,
+ PageStandards standards,
+ ) {
+ return ResponsiveGrid(
+ crossAxisCount: 2,
+ crossAxisCountMedium: 3,
+ crossAxisCountLarge: 4,
+ childAspectRatio: 0.75,
+ spacing: 12,
+ runSpacing: 12,
+ children: homeController.filteredProducts
+ .map((product) => ProductCard(
+ product: product,
+ onAddToCart: () => cartController.addProduct(product),
+ ))
+ .toList(),
+ );
+ }
+}
+```
+
+- [ ] **Step 3: 提交重构**
+
+```bash
+git add lib/src/pages/home_page.dart
+git commit -m "refactor: update HomePage to use GetX state management"
+```
+
+---
+
+## Task 18: 更新 CHANGELOG.md
+
+**Files:**
+- Modify: `CHANGELOG.md`
+
+- [ ] **Step 1: 读取 CHANGELOG.md**
+
+Run: Read `CHANGELOG.md`
+
+- [ ] **Step 2: 添加版本更新日志**
+
+在文件顶部添加:
+
+```markdown
+## [1.3.0] - 2026-04-08
+
+### Added
+- GetX 全局状态管理系统
+ - BaseController 基础控制器
+ - PagedController 分页控制器
+ - HomeController 首页控制器
+ - CartController 购物车控制器
+ - ProfileController 个人中心控制器
+- 标准组件库
+ - StandardButton 标准按钮
+ - StandardTextField 标准输入框
+ - StandardCard 标准卡片
+ - StandardListTile 标准列表项
+- 状态组件
+ - EmptyState 空状态
+ - ErrorState 错误状态
+- 交互组件
+ - StandardDialog 标准对话框
+ - StandardBottomSheet 标准底部弹窗
+ - StandardPicker 标准选择器
+- RouteGuard 路由守卫系统
+
+### Changed
+- 重构 HomePage 使用 GetX 状态管理
+- 重构 ProductCard 使用 PageStandards
+- 重构 LoadingIndicator 使用 PageStandards
+
+### Technical
+- 统一状态管理为 GetX
+- 所有组件集成 PageStandards
+- 实现路由守卫认证机制
+```
+
+- [ ] **Step 3: 提交 CHANGELOG**
+
+```bash
+git add CHANGELOG.md
+git commit -m "docs: update CHANGELOG for v1.3.0"
+```
+
+---
+
+## 验收清单
+
+- [ ] 所有控制器正常工作
+- [ ] 所有组件使用 PageStandards
+- [ ] 路由守卫正常拦截
+- [ ] HomePage 使用 GetX
+- [ ] 代码分析无错误
+- [ ] 深色模式正常
+- [ ] 多语言正常
+
+---
+
+**创建时间:** 2026-04-08
+**作者:** AI Assistant
diff --git a/docs/superpowers/specs/2026-04-08-refactor-design.md b/docs/superpowers/specs/2026-04-08-refactor-design.md
new file mode 100644
index 0000000..f3795b9
--- /dev/null
+++ b/docs/superpowers/specs/2026-04-08-refactor-design.md
@@ -0,0 +1,301 @@
+# 全面重构设计方案
+
+## 概述
+
+本设计文档描述了对 Mom's Kitchen 项目进行全面重构的方案,包括:
+1. GetX 全局状态管理
+2. 组件使用 PageStandards
+3. 路由守卫系统
+4. 组件复用方案
+
+---
+
+## 一、GetX 全局状态管理
+
+### 1.1 架构设计
+
+```
+lib/src/controllers/
+├── base/
+│ ├── base_controller.dart # 基础控制器
+│ └── paged_controller.dart # 分页控制器
+├── home_controller.dart # 首页控制器
+├── cart_controller.dart # 购物车控制器
+├── profile_controller.dart # 个人中心控制器
+└── app_controller.dart # 应用全局控制器
+```
+
+### 1.2 基础控制器
+
+**BaseController:**
+- 提供 `isLoading` 状态
+- 提供 `errorMessage` 状态
+- 提供 `runWithLoading()` 方法封装异步操作
+
+**PagedController:**
+- 继承 BaseController
+- 提供 `items` 列表
+- 提供 `currentPage` 当前页码
+- 提供 `hasMore` 是否有更多数据
+- 提供 `loadMore()` 加载更多
+- 提供 `refresh()` 刷新数据
+
+### 1.3 页面控制器
+
+**HomeController:**
+- 管理产品列表
+- 管理分类列表
+- 管理搜索和筛选状态
+
+**CartController:**
+- 管理购物车商品
+- 计算总价
+- 添加/删除商品
+
+**ProfileController:**
+- 管理用户信息
+- 处理登录/登出
+
+### 1.4 页面使用方式
+
+- 使用 `Get.put()` 注册控制器
+- 使用 `Obx()` 或 `GetBuilder` 监听状态变化
+- 使用 `Get.find()` 获取控制器实例
+
+---
+
+## 二、组件使用 PageStandards
+
+### 2.1 组件库结构
+
+```
+lib/src/widgets/
+├── base/
+│ ├── standard_button.dart # 标准按钮
+│ ├── standard_text_field.dart # 标准输入框
+│ ├── standard_card.dart # 标准卡片
+│ └── standard_list_tile.dart # 标准列表项
+├── interactive/
+│ ├── standard_dialog.dart # 标准对话框
+│ ├── standard_bottom_sheet.dart # 标准底部弹窗
+│ └── standard_picker.dart # 标准选择器
+├── states/
+│ ├── loading_indicator.dart # 加载指示器
+│ ├── empty_state.dart # 空状态
+│ ├── error_state.dart # 错误状态
+│ └── skeleton_loader.dart # 骨架屏
+└── product_card.dart # 产品卡片(重构)
+```
+
+### 2.2 设计原则
+
+1. **所有组件必须使用 PageStandards**
+ - 颜色使用 `standards.primaryColor` 等
+ - 字体使用 `standards.textStyle` 等
+ - 尺寸使用 `standards.scaledWidth()` 等
+
+2. **支持多语言**
+ - 通过 `standards.l10n` 获取翻译
+
+3. **支持深色模式**
+ - 自动跟随主题变化
+
+### 2.3 标准按钮组件
+
+**StandardButton:**
+- 支持 4 种类型:primary、secondary、outline、text
+- 支持加载状态
+- 支持图标
+- 支持全宽
+
+---
+
+## 三、路由守卫系统
+
+### 3.1 认证级别
+
+```dart
+enum AuthLevel {
+ none, // 无需认证
+ optional, // 可选认证
+ required // 必须认证
+}
+```
+
+### 3.2 RouteGuard 类
+
+**功能:**
+- `canAccess()` - 检查是否可以访问
+- `getRedirectRoute()` - 获取重定向路由
+
+**使用方式:**
+- 在 PageInfo 的 metadata 中设置 `authLevel`
+- 在 GetPage 中调用 RouteGuard 进行验证
+
+### 3.3 集成方式
+
+```dart
+GetPage(
+ name: '/profile',
+ page: () {
+ final redirect = RouteGuard.getRedirectRoute('/profile', user: currentUser);
+ if (redirect != null) {
+ return LoginPage();
+ }
+ return const ProfilePage();
+ },
+),
+```
+
+---
+
+## 四、组件复用方案
+
+### 4.1 状态组件
+
+**LoadingIndicator:**
+- 显示加载动画
+- 支持自定义大小和颜色
+
+**EmptyState:**
+- 显示空状态提示
+- 支持自定义图标、标题、消息
+- 支持操作按钮
+
+**ErrorState:**
+- 显示错误信息
+- 支持重试按钮
+
+### 4.2 交互组件
+
+**StandardDialog:**
+- 标准对话框
+- 支持确认/取消按钮
+- 提供静态 `show()` 方法
+
+**StandardBottomSheet:**
+- 标准底部弹窗
+- 支持自定义内容
+
+**StandardPicker:**
+- 标准选择器
+- 支持单选/多选
+
+### 4.3 基础组件
+
+**StandardButton:**
+- 标准按钮
+- 支持 4 种样式
+
+**StandardTextField:**
+- 标准输入框
+- 支持验证
+
+**StandardCard:**
+- 标准卡片
+- 支持点击事件
+
+**StandardListTile:**
+- 标准列表项
+- 支持图标、标题、副标题
+
+---
+
+## 五、实施计划
+
+### 5.1 第一阶段:基础架构
+
+1. 创建 controllers/base/ 目录
+2. 实现 BaseController
+3. 实现 PagedController
+
+### 5.2 第二阶段:控制器迁移
+
+1. 创建 HomeController
+2. 创建 CartController
+3. 创建 ProfileController
+4. 重构现有页面使用控制器
+
+### 5.3 第三阶段:组件重构
+
+1. 创建 widgets/base/ 目录
+2. 实现 StandardButton
+3. 实现 StandardTextField
+4. 实现 StandardCard
+5. 实现 StandardListTile
+6. 重构 ProductCard
+
+### 5.4 第四阶段:状态组件
+
+1. 重构 LoadingIndicator
+2. 实现 EmptyState
+3. 实现 ErrorState
+4. 重构 SkeletonLoader
+
+### 5.5 第五阶段:交互组件
+
+1. 实现 StandardDialog
+2. 实现 StandardBottomSheet
+3. 实现 StandardPicker
+
+### 5.6 第六阶段:路由守卫
+
+1. 实现 RouteGuard
+2. 更新 PageInfo
+3. 更新 main.dart
+
+---
+
+## 六、文件清单
+
+### 新增文件
+
+| 文件路径 | 说明 |
+|----------|------|
+| `lib/src/controllers/base/base_controller.dart` | 基础控制器 |
+| `lib/src/controllers/base/paged_controller.dart` | 分页控制器 |
+| `lib/src/controllers/home_controller.dart` | 首页控制器 |
+| `lib/src/controllers/cart_controller.dart` | 购物车控制器 |
+| `lib/src/controllers/profile_controller.dart` | 个人中心控制器 |
+| `lib/src/controllers/app_controller.dart` | 应用全局控制器 |
+| `lib/src/widgets/base/standard_button.dart` | 标准按钮 |
+| `lib/src/widgets/base/standard_text_field.dart` | 标准输入框 |
+| `lib/src/widgets/base/standard_card.dart` | 标准卡片 |
+| `lib/src/widgets/base/standard_list_tile.dart` | 标准列表项 |
+| `lib/src/widgets/interactive/standard_dialog.dart` | 标准对话框 |
+| `lib/src/widgets/interactive/standard_bottom_sheet.dart` | 标准底部弹窗 |
+| `lib/src/widgets/interactive/standard_picker.dart` | 标准选择器 |
+| `lib/src/widgets/states/empty_state.dart` | 空状态 |
+| `lib/src/widgets/states/error_state.dart` | 错误状态 |
+| `lib/src/standards/route_guard.dart` | 路由守卫 |
+
+### 修改文件
+
+| 文件路径 | 修改内容 |
+|----------|----------|
+| `lib/src/pages/home_page.dart` | 使用 HomeController |
+| `lib/src/pages/example_page.dart` | 使用 PageStandards |
+| `lib/src/pages/theme_demo_page.dart` | 使用控制器 |
+| `lib/src/widgets/product_card.dart` | 使用 PageStandards |
+| `lib/src/widgets/loading_indicator.dart` | 使用 PageStandards |
+| `lib/src/widgets/skeleton_loader.dart` | 使用 PageStandards |
+| `lib/src/standards/app_pages.dart` | 添加 authLevel |
+| `lib/main.dart` | 集成路由守卫 |
+| `CHANGELOG.md` | 更新日志 |
+
+---
+
+## 七、验收标准
+
+1. ✅ 所有页面使用 GetX 状态管理
+2. ✅ 所有组件使用 PageStandards
+3. ✅ 路由守卫正常工作
+4. ✅ 组件可复用
+5. ✅ 代码分析无错误
+6. ✅ 深色模式正常切换
+7. ✅ 多语言正常工作
+
+---
+
+**创建时间:** 2026-04-08
+**作者:** AI Assistant
diff --git a/ios/.gitignore b/ios/.gitignore
new file mode 100644
index 0000000..7a7f987
--- /dev/null
+++ b/ios/.gitignore
@@ -0,0 +1,34 @@
+**/dgph
+*.mode1v3
+*.mode2v3
+*.moved-aside
+*.pbxuser
+*.perspectivev3
+**/*sync/
+.sconsign.dblite
+.tags*
+**/.vagrant/
+**/DerivedData/
+Icon?
+**/Pods/
+**/.symlinks/
+profile
+xcuserdata
+**/.generated/
+Flutter/App.framework
+Flutter/Flutter.framework
+Flutter/Flutter.podspec
+Flutter/Generated.xcconfig
+Flutter/ephemeral/
+Flutter/app.flx
+Flutter/app.zip
+Flutter/flutter_assets/
+Flutter/flutter_export_environment.sh
+ServiceDefinitions.json
+Runner/GeneratedPluginRegistrant.*
+
+# Exceptions to above rules.
+!default.mode1v3
+!default.mode2v3
+!default.pbxuser
+!default.perspectivev3
diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist
new file mode 100644
index 0000000..1dc6cf7
--- /dev/null
+++ b/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ App
+ CFBundleIdentifier
+ io.flutter.flutter.app
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ App
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ MinimumOSVersion
+ 13.0
+
+
diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig
new file mode 100644
index 0000000..592ceee
--- /dev/null
+++ b/ios/Flutter/Debug.xcconfig
@@ -0,0 +1 @@
+#include "Generated.xcconfig"
diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig
new file mode 100644
index 0000000..592ceee
--- /dev/null
+++ b/ios/Flutter/Release.xcconfig
@@ -0,0 +1 @@
+#include "Generated.xcconfig"
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..fa55352
--- /dev/null
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,616 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 54;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 97C146E61CF9000F007C117D /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 97C146ED1CF9000F007C117D;
+ remoteInfo = Runner;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; };
+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
+ 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 97C146EB1CF9000F007C117D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 331C8082294A63A400263BE5 /* RunnerTests */ = {
+ isa = PBXGroup;
+ children = (
+ 331C807B294A618700263BE5 /* RunnerTests.swift */,
+ );
+ path = RunnerTests;
+ sourceTree = "";
+ };
+ 9740EEB11CF90186004384FC /* Flutter */ = {
+ isa = PBXGroup;
+ children = (
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */,
+ );
+ name = Flutter;
+ sourceTree = "";
+ };
+ 97C146E51CF9000F007C117D = {
+ isa = PBXGroup;
+ children = (
+ 9740EEB11CF90186004384FC /* Flutter */,
+ 97C146F01CF9000F007C117D /* Runner */,
+ 97C146EF1CF9000F007C117D /* Products */,
+ 331C8082294A63A400263BE5 /* RunnerTests */,
+ );
+ sourceTree = "";
+ };
+ 97C146EF1CF9000F007C117D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146EE1CF9000F007C117D /* Runner.app */,
+ 331C8081294A63A400263BE5 /* RunnerTests.xctest */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 97C146F01CF9000F007C117D /* Runner */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146FA1CF9000F007C117D /* Main.storyboard */,
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */,
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
+ 97C147021CF9000F007C117D /* Info.plist */,
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
+ );
+ path = Runner;
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 331C8080294A63A400263BE5 /* RunnerTests */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
+ buildPhases = (
+ 331C807D294A63A400263BE5 /* Sources */,
+ 331C807F294A63A400263BE5 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 331C8086294A63A400263BE5 /* PBXTargetDependency */,
+ );
+ name = RunnerTests;
+ productName = RunnerTests;
+ productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
+ productType = "com.apple.product-type.bundle.unit-test";
+ };
+ 97C146ED1CF9000F007C117D /* Runner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
+ buildPhases = (
+ 9740EEB61CF901F6004384FC /* Run Script */,
+ 97C146EA1CF9000F007C117D /* Sources */,
+ 97C146EB1CF9000F007C117D /* Frameworks */,
+ 97C146EC1CF9000F007C117D /* Resources */,
+ 9705A1C41CF9048500538489 /* Embed Frameworks */,
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Runner;
+ productName = Runner;
+ productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 97C146E61CF9000F007C117D /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ BuildIndependentTargetsInParallel = YES;
+ LastUpgradeCheck = 1510;
+ ORGANIZATIONNAME = "";
+ TargetAttributes = {
+ 331C8080294A63A400263BE5 = {
+ CreatedOnToolsVersion = 14.0;
+ TestTargetID = 97C146ED1CF9000F007C117D;
+ };
+ 97C146ED1CF9000F007C117D = {
+ CreatedOnToolsVersion = 7.3.1;
+ LastSwiftMigration = 1100;
+ };
+ };
+ };
+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
+ compatibilityVersion = "Xcode 9.3";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 97C146E51CF9000F007C117D;
+ productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 97C146ED1CF9000F007C117D /* Runner */,
+ 331C8080294A63A400263BE5 /* RunnerTests */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 331C807F294A63A400263BE5 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 97C146EC1CF9000F007C117D /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
+ );
+ name = "Thin Binary";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
+ };
+ 9740EEB61CF901F6004384FC /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 331C807D294A63A400263BE5 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 97C146EA1CF9000F007C117D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 97C146ED1CF9000F007C117D /* Runner */;
+ targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C146FB1CF9000F007C117D /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "";
+ };
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C147001CF9000F007C117D /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 249021D3217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SUPPORTED_PLATFORMS = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Profile;
+ };
+ 249021D4217E4FDB00AE95B9 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.momKitchen;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Profile;
+ };
+ 331C8088294A63A400263BE5 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.momKitchen.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Debug;
+ };
+ 331C8089294A63A400263BE5 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.momKitchen.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Release;
+ };
+ 331C808A294A63A400263BE5 /* Profile */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ BUNDLE_LOADER = "$(TEST_HOST)";
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ GENERATE_INFOPLIST_FILE = YES;
+ MARKETING_VERSION = 1.0;
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.momKitchen.RunnerTests;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_VERSION = 5.0;
+ TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
+ };
+ name = Profile;
+ };
+ 97C147031CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 97C147041CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SUPPORTED_PLATFORMS = iphoneos;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 97C147061CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.momKitchen;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Debug;
+ };
+ 97C147071CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ ENABLE_BITCODE = NO;
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.example.momKitchen;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 331C8088294A63A400263BE5 /* Debug */,
+ 331C8089294A63A400263BE5 /* Release */,
+ 331C808A294A63A400263BE5 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147031CF9000F007C117D /* Debug */,
+ 97C147041CF9000F007C117D /* Release */,
+ 249021D3217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147061CF9000F007C117D /* Debug */,
+ 97C147071CF9000F007C117D /* Release */,
+ 249021D4217E4FDB00AE95B9 /* Profile */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 97C146E61CF9000F007C117D /* Project object */;
+}
diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..f9b0d7c
--- /dev/null
+++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
new file mode 100644
index 0000000..e3773d4
--- /dev/null
+++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..1d526a1
--- /dev/null
+++ b/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
new file mode 100644
index 0000000..f9b0d7c
--- /dev/null
+++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
@@ -0,0 +1,8 @@
+
+
+
+
+ PreviewsEnabled
+
+
+
diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift
new file mode 100644
index 0000000..6266644
--- /dev/null
+++ b/ios/Runner/AppDelegate.swift
@@ -0,0 +1,13 @@
+import Flutter
+import UIKit
+
+@main
+@objc class AppDelegate: FlutterAppDelegate {
+ override func application(
+ _ application: UIApplication,
+ didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
+ ) -> Bool {
+ GeneratedPluginRegistrant.register(with: self)
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+ }
+}
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 0000000..d36b1fa
--- /dev/null
+++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,122 @@
+{
+ "images" : [
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-83.5x83.5@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "Icon-App-1024x1024@1x.png",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
new file mode 100644
index 0000000..dc9ada4
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
new file mode 100644
index 0000000..7353c41
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
new file mode 100644
index 0000000..797d452
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
new file mode 100644
index 0000000..6ed2d93
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
new file mode 100644
index 0000000..4cd7b00
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
new file mode 100644
index 0000000..fe73094
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
new file mode 100644
index 0000000..321773c
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
new file mode 100644
index 0000000..797d452
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
new file mode 100644
index 0000000..502f463
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
new file mode 100644
index 0000000..0ec3034
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
new file mode 100644
index 0000000..0ec3034
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
new file mode 100644
index 0000000..e9f5fea
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
new file mode 100644
index 0000000..84ac32a
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
new file mode 100644
index 0000000..8953cba
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
new file mode 100644
index 0000000..0467bf1
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
new file mode 100644
index 0000000..0bedcf2
--- /dev/null
+++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
new file mode 100644
index 0000000..9da19ea
Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ
diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
new file mode 100644
index 0000000..9da19ea
Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ
diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
new file mode 100644
index 0000000..9da19ea
Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ
diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
new file mode 100644
index 0000000..89c2725
--- /dev/null
+++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -0,0 +1,5 @@
+# Launch Screen Assets
+
+You can customize the launch screen with your own desired assets by replacing the image files in this directory.
+
+You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 0000000..f2e259c
--- /dev/null
+++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard
new file mode 100644
index 0000000..f3c2851
--- /dev/null
+++ b/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
new file mode 100644
index 0000000..d6bfcab
--- /dev/null
+++ b/ios/Runner/Info.plist
@@ -0,0 +1,49 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ $(DEVELOPMENT_LANGUAGE)
+ CFBundleDisplayName
+ Mom Kitchen
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ mom_kitchen
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(FLUTTER_BUILD_NAME)
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ $(FLUTTER_BUILD_NUMBER)
+ LSRequiresIPhoneOS
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ CADisableMinimumFrameDurationOnPhone
+
+ UIApplicationSupportsIndirectInputEvents
+
+
+
diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h
new file mode 100644
index 0000000..308a2a5
--- /dev/null
+++ b/ios/Runner/Runner-Bridging-Header.h
@@ -0,0 +1 @@
+#import "GeneratedPluginRegistrant.h"
diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift
new file mode 100644
index 0000000..86a7c3b
--- /dev/null
+++ b/ios/RunnerTests/RunnerTests.swift
@@ -0,0 +1,12 @@
+import Flutter
+import UIKit
+import XCTest
+
+class RunnerTests: XCTestCase {
+
+ func testExample() {
+ // If you add code to the Runner application, consider adding tests here.
+ // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
+ }
+
+}
diff --git a/l10n.yaml b/l10n.yaml
new file mode 100644
index 0000000..f40adb9
--- /dev/null
+++ b/l10n.yaml
@@ -0,0 +1,7 @@
+arb-dir: lib/src/l10n
+template-arb-file: app_en.arb
+ooutput-localization-file: app_localizations.dart
+output-class: AppLocalizations
+supported-locales:
+ - en
+ - zh
\ No newline at end of file
diff --git a/lib/PAGE_STANDARDS.md b/lib/PAGE_STANDARDS.md
new file mode 100644
index 0000000..6b16e1a
--- /dev/null
+++ b/lib/PAGE_STANDARDS.md
@@ -0,0 +1,548 @@
+# 页面规范与验证系统
+
+本文档说明如何使用页面规范系统和页面验证系统,确保所有页面遵循统一的开发标准。
+
+---
+
+## 目录
+
+- [页面规范系统](#页面规范系统)
+ - [PageStandards 类](#pagestandards-类)
+ - [PageStandardsMixin 混入](#pagestandardsmixin-混入)
+ - [StandardPage 基类](#standardpage-基类)
+ - [扩展方法](#扩展方法)
+- [页面验证系统](#页面验证系统)
+ - [页面注册](#页面注册)
+ - [规范检查项](#规范检查项)
+ - [验证报告](#验证报告)
+- [最佳实践](#最佳实践)
+
+---
+
+## 页面规范系统
+
+### PageStandards 类
+
+`PageStandards` 是页面规范配置类,提供统一的页面构建标准。
+
+**包含的规范属性:**
+
+| 类别 | 属性 | 类型 | 说明 |
+|------|------|------|------|
+| **主题颜色** | `primaryColor` | Color | 主题色 |
+| | `secondaryColor` | Color | 次要色 |
+| | `textColor` | Color | 文字颜色 |
+| | `backgroundColor` | Color | 背景颜色 |
+| **字体大小** | `fontSize` | double | 基础字体大小 |
+| | `textStyle` | TextStyle | 主题文字样式 |
+| | `primaryTextStyle` | TextStyle | 主题色文字样式 |
+| | `secondaryTextStyle` | TextStyle | 次要色文字样式 |
+| **动画配置** | `animationEnabled` | bool | 动画开关 |
+| | `animationSpeed` | double | 动画速度 |
+| | `animationIntensity` | double | 动画强度 |
+| | `animationPreset` | AnimationPreset | 动画预设 |
+| | `animationCurve` | AnimationCurveType | 动画曲线 |
+| **响应式布局** | `scaleEnabled` | bool | 缩放开关 |
+| | `screenWidth` | double | 屏幕宽度 |
+| | `screenHeight` | double | 屏幕高度 |
+| | `statusBarHeight` | double | 状态栏高度 |
+| | `bottomBarHeight` | double | 底部安全区高度 |
+| **多语言** | `l10n` | AppLocalizations | 多语言实例 |
+| | `currentLocale` | Locale | 当前语言 |
+| | `languageCode` | String | 语言代码 |
+| **屏幕方向** | `orientation` | Orientation | 当前方向 |
+| | `isPortrait` | bool | 是否竖屏 |
+| | `isLandscape` | bool | 是否横屏 |
+| **消息样式** | `toastStyle` | ToastStyle | 消息提示样式 |
+| **状态栏** | `isStatusBarImmersive` | bool | 状态栏沉浸开关 |
+| | `systemUiOverlayStyle` | SystemUiOverlayStyle | 系统UI样式 |
+| **深色模式** | `isDarkMode` | bool | 是否深色模式 |
+| | `brightness` | Brightness | 当前亮度 |
+| **设备类型** | `deviceType` | DeviceType | 设备类型 |
+| | `isMobile` | bool | 是否手机 |
+| | `isTablet` | bool | 是否平板 |
+| | `isWeb` | bool | 是否 Web |
+| | `isDesktop` | bool | 是否桌面端 |
+| | `isHarmonyOS` | bool | 是否鸿蒙 |
+
+**缩放方法:**
+
+| 方法 | 参数 | 返回值 | 说明 |
+|------|------|--------|------|
+| `scaledWidth()` | double | double | 缩放宽度 |
+| `scaledHeight()` | double | double | 缩放高度 |
+| `scaledFontSize()` | double | double | 缩放字体 |
+| `scaledRadius()` | double | double | 缩放圆角 |
+| `scaledPadding()` | EdgeInsets | EdgeInsets | 缩放内边距 |
+| `scaledMargin()` | EdgeInsets | EdgeInsets | 缩放外边距 |
+
+**使用示例:**
+
+```dart
+final standards = PageStandards.of(context);
+
+// 获取主题色
+Container(
+ color: standards.backgroundColor,
+ child: Text(
+ 'Hello',
+ style: standards.textStyle,
+ ),
+);
+
+// 使用缩放方法
+Container(
+ width: standards.scaledWidth(100),
+ height: standards.scaledHeight(50),
+ padding: standards.scaledPadding(EdgeInsets.all(16)),
+);
+```
+
+---
+
+### PageStandardsMixin 混入
+
+使用 `PageStandardsMixin` 可以自动注入页面规范,无需手动创建 `PageStandards` 实例。
+
+**使用示例:**
+
+```dart
+class MyPage extends StatefulWidget {
+ const MyPage({super.key});
+
+ @override
+ State createState() => _MyPageState();
+}
+
+class _MyPageState extends State with PageStandardsMixin {
+ @override
+ Widget build(BuildContext context) {
+ return CupertinoPageScaffold(
+ backgroundColor: backgroundColor, // 直接访问主题背景色
+ child: Column(
+ children: [
+ Text(
+ l10n.appTitle, // 直接访问多语言
+ style: textStyle, // 直接访问主题文字样式
+ ),
+ Container(
+ width: scaledWidth(100), // 使用缩放方法
+ height: scaledHeight(50),
+ ),
+ ],
+ ),
+ );
+ }
+}
+```
+
+---
+
+### StandardPage 基类
+
+`StandardPage` 和 `StandardPageState` 是标准页面基类,自动集成了 `PageStandardsMixin`。
+
+**使用示例:**
+
+```dart
+class MyPage extends StandardPage {
+ const MyPage({super.key});
+
+ @override
+ State createState() => _MyPageState();
+}
+
+class _MyPageState extends StandardPageState {
+ @override
+ Widget buildPage(BuildContext context) {
+ return CupertinoPageScaffold(
+ backgroundColor: backgroundColor,
+ child: Text(
+ l10n.appTitle,
+ style: textStyle,
+ ),
+ );
+ }
+}
+```
+
+---
+
+### 扩展方法
+
+`PageStandardsExtension` 为 `BuildContext` 提供了便捷的扩展方法。
+
+**使用示例:**
+
+```dart
+Widget build(BuildContext context) {
+ return Container(
+ color: context.backgroundColor, // 主题背景色
+ child: Text(
+ context.l10n.appTitle, // 多语言
+ style: TextStyle(
+ color: context.textColor, // 主题字体色
+ fontSize: context.fontSize, // 主题字体大小
+ ),
+ ),
+ );
+}
+```
+
+**可用的扩展方法:**
+
+| 扩展属性 | 类型 | 说明 |
+|----------|------|------|
+| `context.standards` | PageStandards | 完整规范实例 |
+| `context.l10n` | AppLocalizations | 多语言实例 |
+| `context.primaryColor` | Color | 主题色 |
+| `context.textColor` | Color | 文字颜色 |
+| `context.backgroundColor` | Color | 背景颜色 |
+| `context.fontSize` | double | 字体大小 |
+
+---
+
+## 页面验证系统
+
+### 页面注册
+
+所有页面必须在 `AppPages` 中注册,以便进行规范验证。
+
+**注册位置:** `lib/src/standards/app_pages.dart`
+
+**注册示例:**
+
+```dart
+import 'package:mom_kitchen/src/standards/page_validator.dart';
+import 'package:mom_kitchen/src/pages/my_page.dart';
+
+class AppPages {
+ static final List pages = [
+ PageInfo(
+ route: '/my_page',
+ name: '我的页面',
+ description: '示例页面说明',
+ requiredStandards: [
+ StandardCheck.themeColors, // 主题颜色
+ StandardCheck.textColors, // 字体颜色
+ StandardCheck.fontSize, // 字体大小
+ StandardCheck.animation, // 动画配置
+ StandardCheck.responsive, // 响应式布局
+ StandardCheck.localization, // 多语言
+ ],
+ builder: () => const MyPage(),
+ metadata: { // 可选的元数据
+ 'icon': 'person',
+ 'category': 'user',
+ },
+ ),
+ ];
+}
+```
+
+**PageInfo 属性说明:**
+
+| 属性 | 类型 | 必填 | 说明 |
+|------|------|------|------|
+| `route` | String | ✅ | 路由路径 |
+| `name` | String | ✅ | 页面名称 |
+| `description` | String | ✅ | 页面描述 |
+| `requiredStandards` | List\ | ✅ | 必须遵循的规范 |
+| `builder` | Widget Function() | ✅ | 页面构建函数 |
+| `metadata` | Map\? | ❌ | 自定义元数据 |
+
+---
+
+### 规范检查项
+
+`StandardCheck` 枚举定义了 12 种规范检查项:
+
+| 检查项 | 标签 | 说明 |
+|--------|------|------|
+| `themeColors` | 主题颜色 | 检查是否使用主题色、次要色 |
+| `textColors` | 字体颜色 | 检查是否使用主题字体色 |
+| `fontSize` | 字体大小 | 检查是否使用主题字体大小 |
+| `spacing` | 间距规范 | 检查是否使用标准间距 |
+| `animation` | 动画配置 | 检查是否遵循动画配置 |
+| `responsive` | 响应式布局 | 检查是否适配不同屏幕 |
+| `localization` | 多语言 | 检查是否使用多语言 |
+| `orientation` | 屏幕方向 | 检查是否处理屏幕方向 |
+| `toastStyle` | 消息样式 | 检查是否使用标准消息样式 |
+| `statusBarImmersive` | 状态栏沉浸 | 检查是否处理状态栏沉浸 |
+| `darkMode` | 深色模式 | 检查是否支持深色模式 |
+| `deviceType` | 设备类型 | 检查是否适配不同设备类型 |
+
+---
+
+### 验证报告
+
+**开发模式自动验证:**
+
+在开发模式下(`kDebugMode == true`),页面验证系统会自动:
+1. 检测页面是否已注册
+2. 验证页面是否遵循规范
+3. 在控制台输出验证结果
+
+**控制台输出示例:**
+
+```
+✅ 已注册 3 个页面
+ - 首页 (/)
+ - 主题设置 (/theme)
+ - 示例页面 (/example)
+
+🔍 开始验证页面: 首页 (/)
+ ✓ 主题颜色
+ ✓ 字体颜色
+ ✓ 字体大小
+ ✓ 多语言
+ ✓ 深色模式
+✅ 页面验证完成: 首页
+```
+
+**未注册页面错误:**
+
+```
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+❌ 页面未注册错误
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+路由: /unknown_page
+
+该页面未在 AppPages 中注册,请检查:
+1. 是否已在 AppPages.pages 中添加页面信息
+2. 路由名称是否正确
+3. 是否调用了 AppPages.registerAll()
+
+已注册的页面:
+ - /: 首页
+ - /theme: 主题设置
+ - /example: 示例页面
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+```
+
+**手动获取验证报告:**
+
+```dart
+// 获取验证历史
+final history = PageValidator.history;
+
+// 获取失败的验证结果
+final failed = PageValidator.getFailedResults();
+
+// 生成验证报告
+final report = PageValidator.generateReport();
+print('总检查数: ${report['totalChecks']}');
+print('通过: ${report['passed']}');
+print('失败: ${report['failed']}');
+print('通过率: ${report['passRate']}%');
+
+// 打印报告
+PageValidator.printReport();
+```
+
+**调试面板:**
+
+```dart
+// 在页面中显示调试面板
+if (kDebugMode) {
+ showCupertinoDialog(
+ context: context,
+ builder: (context) => const PageValidationDebugPanel(),
+ );
+}
+```
+
+---
+
+## 最佳实践
+
+### 1. 创建新页面
+
+**推荐方式:** 继承 `StandardPage` 基类
+
+```dart
+class NewPage extends StandardPage {
+ const NewPage({super.key});
+
+ @override
+ State createState() => _NewPageState();
+}
+
+class _NewPageState extends StandardPageState {
+ @override
+ Widget buildPage(BuildContext context) {
+ return CupertinoPageScaffold(
+ backgroundColor: backgroundColor,
+ navigationBar: CupertinoNavigationBar(
+ middle: Text(l10n.appTitle),
+ ),
+ child: SafeArea(
+ child: ListView(
+ padding: scaledPadding(EdgeInsets.all(16)),
+ children: [
+ Text(
+ l10n.welcomeMessage,
+ style: textStyle,
+ ),
+ SizedBox(height: scaledHeight(20)),
+ CupertinoButton.filled(
+ onPressed: _handlePress,
+ child: Text(l10n.getStarted),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ void _handlePress() {
+ // 处理点击
+ }
+}
+```
+
+### 2. 注册新页面
+
+在 `lib/src/standards/app_pages.dart` 中添加:
+
+```dart
+PageInfo(
+ route: '/new_page',
+ name: '新页面',
+ description: '新页面说明',
+ requiredStandards: [
+ StandardCheck.themeColors,
+ StandardCheck.textColors,
+ StandardCheck.fontSize,
+ StandardCheck.localization,
+ StandardCheck.darkMode,
+ ],
+ builder: () => const NewPage(),
+),
+```
+
+### 3. 添加路由
+
+在 `lib/main.dart` 的 `getPages` 中添加:
+
+```dart
+GetPage(
+ name: '/new_page',
+ page: () {
+ AppPages.validateRoute('/new_page');
+ return const NewPage();
+ },
+),
+```
+
+### 4. 响应式布局
+
+使用 `LayoutBuilder` 和 `PageStandards` 实现响应式:
+
+```dart
+@override
+Widget buildPage(BuildContext context) {
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ if (isTablet && isLandscape) {
+ return _buildTabletLandscape(constraints);
+ } else if (isTablet) {
+ return _buildTabletPortrait(constraints);
+ } else if (isMobile && isLandscape) {
+ return _buildMobileLandscape(constraints);
+ } else {
+ return _buildMobilePortrait(constraints);
+ }
+ },
+ );
+}
+
+Widget _buildMobilePortrait(BoxConstraints constraints) {
+ return CupertinoPageScaffold(
+ backgroundColor: backgroundColor,
+ child: Column(
+ children: [
+ Expanded(
+ child: ListView(
+ padding: scaledPadding(EdgeInsets.all(16)),
+ children: [
+ // 竖屏布局
+ ],
+ ),
+ ),
+ ],
+ ),
+ );
+}
+```
+
+### 5. 深色模式支持
+
+确保所有颜色使用主题值:
+
+```dart
+// ❌ 错误:硬编码颜色
+Container(
+ color: Colors.white,
+ child: Text(
+ 'Hello',
+ style: TextStyle(color: Colors.black),
+ ),
+)
+
+// ✅ 正确:使用主题值
+Container(
+ color: backgroundColor,
+ child: Text(
+ 'Hello',
+ style: textStyle,
+ ),
+)
+```
+
+### 6. 多语言支持
+
+确保所有文本使用多语言:
+
+```dart
+// ❌ 错误:硬编码文本
+Text('欢迎使用')
+
+// ✅ 正确:使用多语言
+Text(l10n.welcomeMessage)
+```
+
+### 7. 动画配置
+
+使用 `AnimationService` 的配置:
+
+```dart
+AnimatedContainer(
+ duration: AppService.instance.animation.config.baseDuration,
+ curve: AppService.instance.animation.config.curve,
+ // ...
+)
+```
+
+---
+
+## 文件结构
+
+```
+lib/src/standards/
+├── page_standards.dart # 页面规范系统
+├── page_validator.dart # 页面验证系统
+└── app_pages.dart # 页面注册表
+```
+
+---
+
+## 相关文档
+
+- [README.md](./README.md) - 项目基础支撑库说明
+- [CHANGELOG.md](../../CHANGELOG.md) - 更新日志
+
+---
+
+**最后更新时间:** 2026-04-08
+**维护者:** Mom's Kitchen 开发团队
diff --git a/lib/README.md b/lib/README.md
new file mode 100644
index 0000000..106a47a
--- /dev/null
+++ b/lib/README.md
@@ -0,0 +1,739 @@
+# Mom's Kitchen 项目基础支撑库说明
+
+## 项目架构
+
+```
+lib/
+├── main.dart # 应用入口
+├── src/
+│ ├── config/ # 配置文件
+│ │ ├── api_config.dart # API 配置
+│ │ └── app_config.dart # 应用配置
+│ ├── l10n/ # 国际化
+│ │ ├── app_en.arb # 英文翻译
+│ │ ├── app_zh.arb # 中文翻译
+│ │ ├── app_zh_Hant.arb # 繁体中文翻译
+│ │ ├── app_localizations.dart # 生成的本地化代码
+│ │ ├── app_localizations_en.dart # 英文实现
+│ │ ├── app_localizations_zh.dart # 中文实现
+│ │ └── app_localizations_zh_hant.dart # 繁体中文实现
+│ ├── models/ # 数据模型
+│ │ └── theme_model.dart # 主题模型
+│ ├── pages/ # 页面
+│ │ ├── cart_page.dart # 购物车页面
+│ │ ├── example_page.dart # 示例页面
+│ │ ├── home_page.dart # 首页
+│ │ └── theme_demo_page.dart # 主题设置页面
+│ ├── services/ # 服务层
+│ │ ├── api_service.dart # 网络请求服务
+│ │ ├── app_info_service.dart # 应用信息服务
+│ │ ├── app_service.dart # 应用服务(统一管理)
+│ │ ├── animation_service.dart # 动画管理服务
+│ │ ├── logger_service.dart # 日志管理服务
+│ │ ├── notification_service.dart # 通知服务
+│ │ ├── orientation_service.dart # 屏幕方向服务
+│ │ ├── permission_service.dart # 权限管理服务
+│ │ ├── screen_util_config.dart # 屏幕适配配置
+│ │ ├── storage_service.dart # 本地存储服务
+│ │ ├── theme_service.dart # 主题管理服务
+│ │ └── toast_service.dart # 消息提示服务
+│ ├── standards/ # 页面规范
+│ │ ├── app_pages.dart # 页面注册表
+│ │ ├── page_standards.dart # 页面规范系统
+│ │ └── page_validator.dart # 页面验证系统
+│ ├── utils/ # 工具类
+│ │ ├── app_logger.dart # 全局日志工具
+│ │ ├── common_utils.dart # 通用工具
+│ │ ├── date_utils.dart # 日期工具
+│ │ ├── network_utils.dart # 网络工具
+│ │ ├── platform_utils.dart # 平台识别工具
+│ │ └── string_utils.dart # 字符串工具
+│ └── widgets/ # 通用组件
+│ ├── adaptive_page_interface.dart # 自适应页面接口
+│ ├── adaptive_scaffold.dart # 自适应布局组件
+│ ├── error_widget.dart # 错误组件
+│ ├── loading_indicator.dart # 加载指示器
+│ ├── product_card.dart # 产品卡片
+│ └── skeleton_loader.dart # 骨架屏
+```
+
+## 已使用的依赖库
+
+### 核心库
+
+| 库名 | 版本 | 用途 | 使用位置 |
+|------|------|------|----------|
+| `cupertino_icons` | ^1.0.8 | iOS 风格图标 | 全局使用 |
+| `flutter_localizations` | SDK | 国际化支持 | main.dart, app_localizations.dart |
+| `intl` | ^0.20.2 | 国际化工具 | l10n 文件, date_utils.dart |
+| `get` | git | 状态管理、路由管理、依赖注入 | ThemeService, AnimationService, main.dart 等 |
+
+### 网络与存储
+
+| 库名 | 版本 | 用途 | 使用位置 |
+|------|------|------|----------|
+| `dio` | ^5.9.2 | 网络请求 | ApiService |
+| `dio_cache_interceptor` | ^3.5.0 | Dio 网络请求缓存 | ApiService |
+| `shared_preferences` | git | 本地键值存储 | StorageService, ThemeService, AnimationService |
+| `connectivity_plus` | git | 网络状态检测 | ApiService, NetworkUtils |
+| `path_provider` | git | 文件路径获取 | LoggerService |
+
+### 平台与工具
+
+| 库名 | 版本 | 用途 | 使用位置 |
+|------|------|------|----------|
+| `flutter_local_notifications` | git | 本地通知 | NotificationService |
+| `package_info_plus` | git | 应用信息 | AppInfoService |
+| `fluttertoast` | git | Toast 消息提示 | ToastService |
+| `share_plus` | git | 分享功能 | CommonUtils |
+| `permission_handler` | git | 权限管理 | PermissionService |
+| `device_info_plus` | git | 设备信息 | 待开发 |
+| `logger` | ^2.7.0 | 日志管理 | LoggerService |
+| `pretty_dio_logger` | ^1.4.0 | Dio 日志美化 | ApiService |
+
+### UI 与动画
+
+| 库名 | 版本 | 用途 | 使用位置 |
+|------|------|------|----------|
+| `flutter_adaptive_scaffold` | git | 自适应布局 | AdaptivePageInterface, AdaptiveScaffold |
+| `animations` | git | 页面过渡动画 | AnimationService |
+| `flutter_screenutil` | 本地 v5.9.3 | 屏幕适配 | 全局使用(支持鸿蒙) |
+
+## 尚未使用的依赖库
+
+| 库名 | 版本 | 用途 | 建议使用场景 |
+|------|------|------|--------------|
+| `pigeon` | git | Flutter 与原生平台通信 | 需要调用原生 API 时使用 |
+| `orientation` | git | 屏幕方向控制 | 已改用 Flutter 原生 SystemChrome |
+| `platform_info` | ^5.0.0 | 平台识别 | 已改用 dart:io 的 Platform |
+
+## 建议添加的基础库
+
+| 库名 | 用途 | 优先级 |
+|------|------|--------|
+| `image_picker` | 图片选择、拍照 | 高 |
+| `url_launcher` | 打开 URL、拨打电话 | 高 |
+| `path_provider` | 文件路径获取 | 中 |
+| `camera` | 相机访问 | 中 |
+| `geolocator` | 地理定位 | 中 |
+| `fl_chart` | 图表库 | 低 |
+| `sqflite` | SQLite 数据库 | 低 |
+
+## 核心服务说明
+
+### 1. ApiService(网络请求服务)
+
+**功能:**
+- 基于 Dio 封装的网络请求
+- 支持缓存拦截器
+- 网络状态检测
+- 统一错误处理
+
+**使用示例:**
+```dart
+final api = AppService.instance.api;
+final response = await api.get('/products');
+```
+
+### 2. StorageService(本地存储服务)
+
+**功能:**
+- 基于 shared_preferences 封装
+- 支持键值对存储
+- 支持对象序列化
+
+**使用示例:**
+```dart
+final storage = AppService.instance.storage;
+await storage.setString('key', 'value');
+final value = storage.getString('key');
+```
+
+### 3. ThemeService(主题管理服务)
+
+**功能:**
+- 动态切换白天/夜间模式
+- 自定义主题色、次要色
+- 字体大小调节
+- 动画强度调节
+- 状态栏沉浸设置
+- 主题持久化存储
+
+**使用示例:**
+```dart
+final theme = AppService.instance.theme;
+await theme.toggleThemeMode();
+await theme.setPrimaryColor(Colors.blue);
+```
+
+### 4. OrientationService(屏幕方向服务)
+
+**功能:**
+- 锁定屏幕方向
+- 解锁屏幕方向
+- 获取当前屏幕方向
+
+**使用示例:**
+```dart
+final orientation = AppService.instance.orientation;
+await orientation.lockPortrait();
+await orientation.unlockOrientation();
+```
+
+### 5. NotificationService(通知服务)
+
+**功能:**
+- 本地通知管理
+- 定时通知
+- 进度通知
+- 大文本通知
+- 图片通知
+- 通知权限请求
+
+**使用示例:**
+```dart
+final notification = AppService.instance.notification;
+
+// 请求权限
+await notification.requestPermission();
+
+// 显示普通通知
+await notification.showNotification(
+ id: 1,
+ title: '标题',
+ body: '内容',
+);
+
+// 显示定时通知
+await notification.scheduleNotification(
+ id: 2,
+ title: '提醒',
+ body: '该吃饭了!',
+ scheduledDate: DateTime.now().add(Duration(hours: 1)),
+);
+
+// 取消通知
+await notification.cancelNotification(1);
+```
+
+### 6. AppInfoService(应用信息服务)
+
+**功能:**
+- 获取应用名称
+- 获取包名
+- 获取版本号
+- 获取构建号
+- 版本比较
+- 更新检测
+
+**使用示例:**
+```dart
+final appInfo = AppService.instance.appInfo;
+
+// 获取版本信息
+print('版本: ${appInfo.version}');
+print('构建号: ${appInfo.buildNumber}');
+print('完整版本: ${appInfo.fullVersion}');
+
+// 检查是否需要更新
+if (appInfo.needsUpdate('2.0.0')) {
+ print('需要更新应用');
+}
+
+// 获取应用信息摘要
+print(appInfo.appInfoString);
+```
+
+### 7. ToastService(消息提示服务)
+
+**功能:**
+- 4 种消息类型:信息、成功(积极)、警告、错误(消极)
+- 4 种显示样式:GetX、FlutterToast、默认、混合
+- 样式动态切换
+- 支持自定义显示时长
+
+**消息类型:**
+- `MessageType.info` - 普通信息(蓝色)
+- `MessageType.success` - 成功/积极消息(绿色)
+- `MessageType.warning` - 警告消息(橙色)
+- `MessageType.error` - 错误/消极消息(红色)
+
+**显示样式:**
+- `ToastStyle.getx` - GetX 默认样式
+- `ToastStyle.fluttertoast` - FlutterToast 样式
+- `ToastStyle.default_` - 默认样式(Cupertino 风格)
+- `ToastStyle.hybrid` - 混合样式(推荐)
+
+**使用示例:**
+```dart
+final toast = AppService.instance.toast;
+
+// 设置显示样式
+toast.setStyle(ToastStyle.hybrid);
+
+// 显示信息消息
+await toast.info('这是一条信息');
+
+// 显示成功消息(积极)
+await toast.success('操作成功!');
+
+// 显示警告消息
+await toast.warning('请注意!');
+
+// 显示错误消息(消极)
+await toast.error('操作失败!');
+
+// 自定义显示
+await toast.show(
+ '自定义消息',
+ type: MessageType.info,
+ style: ToastStyle.getx,
+ duration: Duration(seconds: 3),
+);
+
+// 取消所有消息
+toast.cancelAll();
+```
+
+### 8. PermissionService(权限管理服务)
+
+**功能:**
+- 支持 15 种常见权限类型(相机、麦克风、相册、位置等)
+- 跨平台权限适配(iOS、Android、HarmonyOS、Web、Windows、macOS、Linux)
+- 权限状态记录和查询功能
+- 批量权限检查和请求功能
+
+**使用示例:**
+```dart
+final permission = AppService.instance.permission;
+
+// 检查单个权限
+final status = await permission.checkPermission(PermissionType.camera);
+if (status.isGranted) {
+ // 权限已授予
+}
+
+// 请求单个权限
+final result = await permission.requestPermission(PermissionType.camera);
+if (result.isGranted) {
+ // 权限已授予
+}
+
+// 批量检查权限
+final permissions = [
+ PermissionType.camera,
+ PermissionType.microphone,
+ PermissionType.photos,
+];
+final statuses = await permission.checkPermissions(permissions);
+
+// 批量请求权限
+final results = await permission.requestPermissions(permissions);
+
+// 获取所有权限状态
+final allStatuses = permission.getAllPermissionStatuses();
+```
+
+### 9. AnimationService(动画管理服务)
+
+**功能:**
+- 使用 `animations` 库实现专业动画效果
+- 支持动画开关、速度、强度、曲线四种参数调节
+- 提供 7 种预设模式(Standard、Fast、Slow、Smooth、Bouncy、Minimal、None)
+- 支持 9 种动画曲线类型
+- 配置持久化存储,应用重启后保持设置
+
+**预设模式:**
+- `AnimationPreset.standard` - 标准动画(默认)
+- `AnimationPreset.fast` - 快速动画
+- `AnimationPreset.slow` - 慢速动画
+- `AnimationPreset.smooth` - 平滑动画
+- `AnimationPreset.bouncy` - 弹性动画
+- `AnimationPreset.minimal` - 最小动画
+- `AnimationPreset.none` - 无动画
+
+**使用示例:**
+```dart
+final animation = AppService.instance.animation;
+
+// 获取动画配置
+print('动画已启用: ${animation.enabled}');
+print('动画速度: ${animation.speed}');
+print('动画强度: ${animation.intensity}');
+print('动画曲线: ${animation.curveType}');
+
+// 设置动画参数
+await animation.setEnabled(true);
+await animation.setSpeed(1.5);
+await animation.setIntensity(1.2);
+await animation.setCurveType(AnimationCurveType.easeInOut);
+await animation.setPreset(AnimationPreset.smooth);
+
+// 使用动画组件
+AnimatedButton(
+ onPressed: () => print('点击'),
+ child: Text('动画按钮'),
+);
+
+AnimatedCard(
+ onTap: () => print('点击卡片'),
+ child: Text('动画卡片'),
+);
+
+// 页面转场动画
+PageTransitions.fadeThrough(
+ child: NewPage(),
+);
+```
+
+### 10. LoggerService(日志管理服务)
+
+**功能:**
+- 支持日志开关、级别、文件写入配置
+- 支持 5 种日志级别(Debug、Info、Warning、Error、Off)
+- 支持控制台输出和文件输出
+- 支持日志文件自动清理(按大小和数量)
+- 配置持久化存储
+
+**使用示例:**
+```dart
+// 使用 AppLogger 全局工具类
+AppLogger.d('调试信息');
+AppLogger.i('普通信息');
+AppLogger.w('警告信息');
+AppLogger.e('错误信息');
+
+// 或使用 LoggerService
+final logger = AppService.instance.logger;
+logger.debug('调试信息');
+logger.info('普通信息');
+logger.warning('警告信息');
+logger.error('错误信息');
+
+// 配置日志
+await AppLogger.setEnabled(true);
+await AppLogger.setWriteToFile(true);
+
+// 获取日志文件
+final files = await AppLogger.getLogFiles();
+final content = await AppLogger.getLogContent();
+
+// 清空日志
+await AppLogger.clearLogs();
+```
+
+### 11. ScreenUtilConfig(屏幕适配配置)
+
+**功能:**
+- 设计稿尺寸配置(默认 375x812)
+- 最小字体适配开关
+- 分屏模式开关
+- 缩放开关控制
+- 配置持久化存储
+
+**使用示例:**
+```dart
+// 初始化
+final screenUtil = AppService.instance.screenUtil;
+screenUtil.initScreenUtil(context);
+
+// 或异步初始化
+await screenUtil.ensureScreenSizeAndInit(context);
+
+// 配置设计稿尺寸
+await screenUtil.setDesignSize(Size(375, 812));
+await screenUtil.setDesignWidth(375);
+await screenUtil.setDesignHeight(812);
+
+// 配置适配选项
+await screenUtil.setMinTextAdapt(true);
+await screenUtil.setSplitScreenMode(true);
+await screenUtil.setScaleEnabled(true);
+
+// 使用扩展方法
+Container(
+ width: 100.w, // 按设计稿比例缩放
+ height: 50.h,
+ padding: EdgeInsets.all(16.w),
+ child: Text(
+ 'Hello',
+ style: TextStyle(fontSize: 14.sp), // 字体缩放
+ ),
+)
+
+// 禁用缩放时,扩展方法返回原始值
+await screenUtil.setScaleEnabled(false);
+// 此时 100.w 返回 100.0
+```
+
+## 页面规范系统
+
+> 📖 详细文档请查看 [PAGE_STANDARDS.md](./PAGE_STANDARDS.md)
+
+页面规范系统提供统一的页面构建标准,确保所有页面遵循统一的开发规范。
+
+### 核心组件
+
+| 组件 | 说明 |
+|------|------|
+| `PageStandards` | 页面规范配置类 |
+| `PageStandardsMixin` | 页面混入,自动注入规范 |
+| `StandardPage` | 标准页面基类 |
+| `PageValidator` | 页面验证器 |
+| `PageRegistry` | 页面注册表 |
+
+### 快速使用
+
+```dart
+class MyPage extends StandardPage {
+ const MyPage({super.key});
+
+ @override
+ State createState() => _MyPageState();
+}
+
+class _MyPageState extends StandardPageState {
+ @override
+ Widget buildPage(BuildContext context) {
+ return CupertinoPageScaffold(
+ backgroundColor: backgroundColor, // 自动获取主题背景色
+ child: Text(
+ l10n.appTitle, // 自动获取多语言
+ style: textStyle, // 自动获取主题文字样式
+ ),
+ );
+ }
+}
+```
+
+---
+
+## 主题系统说明
+
+> 📖 页面主题使用详见 [PAGE_STANDARDS.md](./PAGE_STANDARDS.md#页面规范系统)
+
+### 主题属性
+
+创建新页面时,**必须读取所有主题值**:
+
+```dart
+@override
+Widget build(BuildContext context) {
+ final theme = AppService.instance.theme;
+
+ final isDarkMode = theme.isDarkMode;
+ final primaryColor = theme.primaryColor;
+ final secondaryColor = theme.secondaryColor;
+ final fontSize = theme.fontSize;
+ final textColor = theme.textColor;
+ final backgroundColor = theme.backgroundColor;
+
+ return CupertinoPageScaffold(
+ backgroundColor: backgroundColor,
+ child: Text('Hello', style: TextStyle(color: textColor)),
+ );
+}
+```
+
+### 主题属性说明
+
+| 属性 | 类型 | 说明 | 默认值 |
+|------|------|------|--------|
+| `isDarkMode` | bool | 是否为深色模式 | false |
+| `primaryColor` | Color | 主题色 | Colors.blue |
+| `secondaryColor` | Color | 次要色 | Colors.orange |
+| `fontSize` | double | 基础字体大小 | 16.0 |
+| `textColor` | Color | 文字颜色 | Colors.black |
+| `backgroundColor` | Color | 背景颜色 | Colors.white |
+
+---
+
+## 国际化说明
+
+### 支持的语言
+
+- 英文(en)
+- 中文(zh)
+- 繁体中文(zh_Hant)
+
+### 使用方法
+
+```dart
+final l10n = AppLocalizations.of(context)!;
+Text(l10n.appTitle)
+```
+
+### 添加新的翻译
+
+1. 编辑 `lib/src/l10n/app_en.arb` 和 `lib/src/l10n/app_zh.arb`
+2. 运行 `flutter gen-l10n` 生成代码
+
+## 注意事项
+
+### 1. 组件风格
+
+- **优先使用 iOS 风格组件**(Cupertino)
+- 若 iOS 无对应组件,再使用 Material 组件
+- 示例:使用 `CupertinoButton` 而非 `ElevatedButton`
+
+### 2. 响应式布局
+
+- 使用 `LayoutBuilder` 和 `MediaQuery` 实现响应式
+- 支持横竖屏切换
+- 适配不同屏幕尺寸
+
+### 3. 骨架屏与动画
+
+- 页面加载时显示骨架屏
+- 使用 `AnimationService` 统一管理动画
+- 动画参数可在设置中调节(开关、速度、强度、曲线)
+- 使用 `AnimatedButton`、`AnimatedCard` 等动画组件
+
+### 4. 网络图片加载
+
+- 使用 `Image.network` 加载网络图片
+- 添加 `loadingBuilder` 和 `errorBuilder`
+- 示例:
+```dart
+Image.network(
+ url,
+ loadingBuilder: (context, child, loadingProgress) {
+ if (loadingProgress == null) return child;
+ return const CupertinoActivityIndicator();
+ },
+ errorBuilder: (context, error, stackTrace) {
+ return const Icon(CupertinoIcons.exclamationmark_circle);
+ },
+)
+```
+
+### 5. 平台识别
+
+使用 `PlatformUtils` 识别平台:
+
+```dart
+final platform = PlatformUtils();
+if (platform.isIOS) {
+ // iOS 特定逻辑
+} else if (platform.isAndroid) {
+ // Android 特定逻辑
+} else if (platform.isHarmonyOS) {
+ // 鸿蒙特定逻辑
+}
+```
+
+### 6. 状态管理
+
+使用 GetX 进行状态管理:
+
+```dart
+// 定义响应式变量
+final count = 0.obs;
+
+// 更新值
+count.value++;
+
+// 监听变化
+Obx(() => Text('${count.value}'))
+```
+
+### 7. 路由管理
+
+使用 GetX 进行路由管理:
+
+```dart
+// 跳转到新页面
+Get.to(const NewPage());
+
+// 返回上一页
+Get.back();
+
+// 替换当前页面
+Get.off(const NewPage());
+
+// 清空栈并跳转
+Get.offAll(const HomePage());
+```
+
+### 8. 依赖注入
+
+使用 GetX 进行依赖注入:
+
+```dart
+// 注册服务
+Get.put(ThemeService());
+
+// 获取服务
+final theme = Get.find();
+```
+
+## 开发规范
+
+### 1. 文件命名
+
+- 文件名使用小写下划线:`theme_service.dart`
+- 类名使用大驼峰:`ThemeService`
+
+### 2. 导入顺序
+
+```dart
+// 1. Flutter SDK
+import 'package:flutter/material.dart';
+import 'package:flutter/cupertino.dart';
+
+// 2. 第三方库
+import 'package:get/get.dart';
+
+// 3. 项目内部文件
+import 'package:mom_kitchen/src/services/app_service.dart';
+```
+
+### 3. 注释规范
+
+- 使用中文注释
+- 公共方法必须添加注释说明
+- 复杂逻辑添加行内注释
+
+### 4. 代码风格
+
+- 使用 `const` 构造函数
+- 使用 `final` 定义不可变变量
+- 避免使用 `dynamic`,明确类型
+
+## 常见问题
+
+### Q1: 如何添加新的主题属性?
+
+1. 在 `ThemeService` 中添加新的响应式变量
+2. 在 `_loadTheme()` 和 `_saveTheme()` 中添加加载和保存逻辑
+3. 添加 getter 方法
+4. 在 `getThemeData()` 中应用新属性
+5. 更新本文档的主题属性表格
+
+### Q2: 如何添加新的语言支持?
+
+1. 在 `l10n.yaml` 中添加新的语言代码
+2. 创建对应的 ARB 文件:`app_xx.arb`
+3. 运行 `flutter gen-l10n` 生成代码
+
+### Q3: 如何使用未使用的库?
+
+参考本文档"尚未使用的依赖库"表格中的建议使用场景,在相应的服务或页面中集成。
+
+### Q4: 如何创建新页面?
+
+请参考 [PAGE_STANDARDS.md](./PAGE_STANDARDS.md#最佳实践) 中的最佳实践部分。
+
+---
+
+## 相关文档
+
+| 文档 | 说明 |
+|------|------|
+| [PAGE_STANDARDS.md](./PAGE_STANDARDS.md) | 页面规范与验证系统详细说明 |
+| [CHANGELOG.md](../../CHANGELOG.md) | 项目更新日志 |
+
+---
+
+**最后更新时间:** 2026-04-08
+**维护者:** Mom's Kitchen 开发团队
diff --git a/lib/main.dart b/lib/main.dart
new file mode 100644
index 0000000..b2c6688
--- /dev/null
+++ b/lib/main.dart
@@ -0,0 +1,164 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/foundation.dart';
+import 'package:get/get.dart';
+import 'package:mom_kitchen/src/services/app_service.dart';
+import 'package:mom_kitchen/src/services/orientation_service.dart';
+import 'package:mom_kitchen/src/pages/home_page.dart';
+import 'package:mom_kitchen/src/pages/theme_demo_page.dart';
+import 'package:mom_kitchen/src/l10n/app_localizations.dart';
+import 'package:mom_kitchen/src/standards/app_pages.dart';
+import 'package:mom_kitchen/src/standards/page_validator.dart';
+
+void main() async {
+ WidgetsFlutterBinding.ensureInitialized();
+
+ await AppService.instance.init();
+
+ await OrientationService().lockPortrait();
+
+ AppPages.registerAll();
+
+ runApp(const MyApp());
+}
+
+class MyApp extends StatelessWidget {
+ const MyApp({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final themeService = AppService.instance.theme;
+
+ return GetMaterialApp(
+ title: 'Mom\'s Kitchen',
+ localizationsDelegates: AppLocalizations.localizationsDelegates,
+ supportedLocales: AppLocalizations.supportedLocales,
+ theme: ThemeData(
+ useMaterial3: true,
+ colorScheme: ColorScheme.fromSeed(
+ seedColor: themeService.primaryColor,
+ brightness: themeService.isDarkMode
+ ? Brightness.dark
+ : Brightness.light,
+ ),
+ ),
+ darkTheme: ThemeData(
+ useMaterial3: true,
+ colorScheme: ColorScheme.fromSeed(
+ seedColor: themeService.primaryColor,
+ brightness: Brightness.dark,
+ ),
+ ),
+ themeMode: themeService.isDarkMode ? ThemeMode.dark : ThemeMode.light,
+ home: const HomePage(),
+ getPages: [
+ GetPage(
+ name: '/',
+ page: () {
+ AppPages.validateRoute('/');
+ return const HomePage();
+ },
+ ),
+ GetPage(
+ name: '/theme',
+ page: () {
+ AppPages.validateRoute('/theme');
+ return const ThemeDemoPage();
+ },
+ ),
+ ],
+ onGenerateRoute: (settings) {
+ AppPages.validateRoute(settings.name ?? '');
+ return null;
+ },
+ navigatorObservers: [PageRoutingObserver()],
+ );
+ }
+}
+
+class HomeScreen extends StatelessWidget {
+ const HomeScreen({super.key});
+
+ @override
+ Widget build(BuildContext context) {
+ final l10n = AppLocalizations.of(context)!;
+ final themeService = AppService.instance.theme;
+
+ return CupertinoPageScaffold(
+ navigationBar: CupertinoNavigationBar(
+ middle: Text(l10n.appTitle),
+ backgroundColor: themeService.backgroundColor.withValues(alpha: 0.95),
+ ),
+ child: Center(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ l10n.welcomeMessage,
+ style: TextStyle(
+ fontSize: 24,
+ fontWeight: FontWeight.bold,
+ color: themeService.textColor,
+ ),
+ ),
+ const SizedBox(height: 20),
+ Text(
+ l10n.appDescription,
+ style: TextStyle(
+ fontSize: 16,
+ color: themeService.textColor.withValues(alpha: 0.6),
+ ),
+ ),
+ const SizedBox(height: 40),
+ CupertinoButton.filled(
+ onPressed: () {
+ Get.to(const HomePage());
+ },
+ child: Text(l10n.getStarted),
+ ),
+ const SizedBox(height: 20),
+ CupertinoButton.filled(
+ onPressed: () {
+ Get.to(const ThemeDemoPage());
+ },
+ child: Text(l10n.themeSettings),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+class PageRoutingObserver extends NavigatorObserver {
+ @override
+ void didPush(Route route, Route? previousRoute) {
+ super.didPush(route, previousRoute);
+ _validateRoute(route.settings.name, previousRoute?.settings.name);
+ }
+
+ @override
+ void didPop(Route route, Route? previousRoute) {
+ super.didPop(route, previousRoute);
+ _validateRoute(previousRoute?.settings.name, route.settings.name);
+ }
+
+ @override
+ void didReplace({Route? newRoute, Route? oldRoute}) {
+ super.didReplace(newRoute: newRoute, oldRoute: oldRoute);
+ _validateRoute(newRoute?.settings.name, oldRoute?.settings.name);
+ }
+
+ void _validateRoute(String? routeName, String? previousRouteName) {
+ final currentRoute = routeName ?? previousRouteName;
+ if (currentRoute == null || currentRoute.isEmpty) return;
+
+ AppPages.validateRoute(currentRoute);
+
+ if (kDebugMode && navigator?.context != null) {
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ PageValidator.validate(navigator!.context, currentRoute);
+ });
+ }
+ }
+}
diff --git a/lib/src/config/api_config.dart b/lib/src/config/api_config.dart
new file mode 100644
index 0000000..396d479
--- /dev/null
+++ b/lib/src/config/api_config.dart
@@ -0,0 +1,68 @@
+class ApiConfig {
+ // 认证相关
+ static const String login = '/auth/login';
+ static const String register = '/auth/register';
+ static const String logout = '/auth/logout';
+ static const String refreshToken = '/auth/refresh';
+
+ // 用户相关
+ static const String userProfile = '/user/profile';
+ static const String updateProfile = '/user/update';
+ static const String changePassword = '/user/change-password';
+
+ // 产品相关
+ static const String products = '/products';
+ static const String productDetail = '/products/{id}';
+ static const String productCategories = '/products/categories';
+ static const String productSearch = '/products/search';
+
+ // 购物车相关
+ static const String cart = '/cart';
+ static const String addToCart = '/cart/add';
+ static const String updateCart = '/cart/update';
+ static const String removeFromCart = '/cart/remove';
+
+ // 订单相关
+ static const String orders = '/orders';
+ static const String orderDetail = '/orders/{id}';
+ static const String createOrder = '/orders/create';
+ static const String cancelOrder = '/orders/{id}/cancel';
+
+ // 支付相关
+ static const String paymentMethods = '/payment/methods';
+ static const String createPayment = '/payment/create';
+ static const String verifyPayment = '/payment/verify';
+
+ // 地址相关
+ static const String addresses = '/addresses';
+ static const String addAddress = '/addresses/add';
+ static const String updateAddress = '/addresses/{id}/update';
+ static const String deleteAddress = '/addresses/{id}/delete';
+
+ // 通知相关
+ static const String notifications = '/notifications';
+ static const String markAsRead = '/notifications/{id}/read';
+
+ // 评论相关
+ static const String productReviews = '/products/{id}/reviews';
+ static const String addReview = '/products/{id}/reviews/add';
+
+ // 优惠券相关
+ static const String coupons = '/coupons';
+ static const String applyCoupon = '/coupons/apply';
+
+ // 公共相关
+ static const String banners = '/banners';
+ static const String settings = '/settings';
+ static const String about = '/about';
+ static const String contact = '/contact';
+
+ // 替换路径参数
+ static String replaceParams(String path, Map params) {
+ var result = path;
+ params.forEach((key, value) {
+ result = result.replaceAll('{$key}', value.toString());
+ });
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/lib/src/config/app_config.dart b/lib/src/config/app_config.dart
new file mode 100644
index 0000000..1c2278d
--- /dev/null
+++ b/lib/src/config/app_config.dart
@@ -0,0 +1,63 @@
+import 'package:mom_kitchen/src/services/app_info_service.dart';
+
+class AppConfig {
+ // 应用名称
+ static String get appName => 'Mom\'s Kitchen';
+
+ // 应用版本(从 AppInfoService 获取)
+ static String get appVersion => AppInfoService().version;
+
+ // 应用构建号(从 AppInfoService 获取)
+ static String get buildNumber => AppInfoService().buildNumber;
+
+ // 完整版本信息(从 AppInfoService 获取)
+ static String get fullVersion => AppInfoService().fullVersion;
+
+ // API 基础 URL
+ static const String baseUrl = 'https://api.example.com';
+
+ // 超时时间(秒)
+ static const int timeoutSeconds = 10;
+
+ // 缓存时间(天)
+ static const int cacheDays = 7;
+
+ // 分页大小
+ static const int pageSize = 20;
+
+ // 存储键值
+ static const Map storageKeys = {
+ 'token': 'auth_token',
+ 'user': 'user_info',
+ 'language': 'app_language',
+ 'theme': 'app_theme',
+ };
+
+ // 支持的语言
+ static const List supportedLanguages = [
+ 'en', // English
+ 'zh', // Chinese
+ ];
+
+ // 默认语言
+ static const String defaultLanguage = 'en';
+
+ // 主题模式
+ static const Map themeModes = {
+ 'light': 'light',
+ 'dark': 'dark',
+ 'system': 'system',
+ };
+
+ // 默认主题
+ static const String defaultTheme = 'system';
+
+ // 获取应用信息
+ static Map get appInfo => {
+ 'appName': appName,
+ 'appVersion': appVersion,
+ 'buildNumber': buildNumber,
+ 'fullVersion': fullVersion,
+ 'baseUrl': baseUrl,
+ };
+}
diff --git a/lib/src/l10n/app_en.arb b/lib/src/l10n/app_en.arb
new file mode 100644
index 0000000..49ab658
--- /dev/null
+++ b/lib/src/l10n/app_en.arb
@@ -0,0 +1,17 @@
+{
+ "@@locale": "en",
+ "appTitle": "Mom's Kitchen",
+ "welcomeMessage": "Welcome to Mom's Kitchen!",
+ "appDescription": "Your favorite food delivery app",
+ "getStarted": "Get Started",
+ "themeSettings": "Theme Settings",
+ "darkMode": "Dark Mode",
+ "statusBarImmersive": "Status Bar Immersive",
+ "fontSize": "Font Size",
+ "primaryColor": "Primary Color",
+ "secondaryColor": "Secondary Color",
+ "resetToDefault": "Reset to Default",
+ "preview": "Preview",
+ "sampleText": "This is a sample text to preview the theme settings.",
+ "sampleButton": "Sample Button"
+}
\ No newline at end of file
diff --git a/lib/src/l10n/app_localizations.dart b/lib/src/l10n/app_localizations.dart
new file mode 100644
index 0000000..819e631
--- /dev/null
+++ b/lib/src/l10n/app_localizations.dart
@@ -0,0 +1,231 @@
+import 'dart:async';
+
+import 'package:flutter/foundation.dart';
+import 'package:flutter/widgets.dart';
+import 'package:flutter_localizations/flutter_localizations.dart';
+import 'package:intl/intl.dart' as intl;
+
+import 'app_localizations_en.dart';
+import 'app_localizations_zh.dart';
+
+// ignore_for_file: type=lint
+
+/// Callers can lookup localized strings with an instance of AppLocalizations
+/// returned by `AppLocalizations.of(context)`.
+///
+/// Applications need to include `AppLocalizations.delegate()` in their app's
+/// `localizationDelegates` list, and the locales they support in the app's
+/// `supportedLocales` list. For example:
+///
+/// ```dart
+/// import 'l10n/app_localizations.dart';
+///
+/// return MaterialApp(
+/// localizationsDelegates: AppLocalizations.localizationsDelegates,
+/// supportedLocales: AppLocalizations.supportedLocales,
+/// home: MyApplicationHome(),
+/// );
+/// ```
+///
+/// ## Update pubspec.yaml
+///
+/// Please make sure to update your pubspec.yaml to include the following
+/// packages:
+///
+/// ```yaml
+/// dependencies:
+/// # Internationalization support.
+/// flutter_localizations:
+/// sdk: flutter
+/// intl: any # Use the pinned version from flutter_localizations
+///
+/// # Rest of dependencies
+/// ```
+///
+/// ## iOS Applications
+///
+/// iOS applications define key application metadata, including supported
+/// locales, in an Info.plist file that is built into the application bundle.
+/// To configure the locales supported by your app, you’ll need to edit this
+/// file.
+///
+/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
+/// Then, in the Project Navigator, open the Info.plist file under the Runner
+/// project’s Runner folder.
+///
+/// Next, select the Information Property List item, select Add Item from the
+/// Editor menu, then select Localizations from the pop-up menu.
+///
+/// Select and expand the newly-created Localizations item then, for each
+/// locale your application supports, add a new item and select the locale
+/// you wish to add from the pop-up menu in the Value field. This list should
+/// be consistent with the languages listed in the AppLocalizations.supportedLocales
+/// property.
+abstract class AppLocalizations {
+ AppLocalizations(String locale)
+ : localeName = intl.Intl.canonicalizedLocale(locale.toString());
+
+ final String localeName;
+
+ static AppLocalizations? of(BuildContext context) {
+ return Localizations.of(context, AppLocalizations);
+ }
+
+ static const LocalizationsDelegate delegate =
+ _AppLocalizationsDelegate();
+
+ /// A list of this localizations delegate along with the default localizations
+ /// delegates.
+ ///
+ /// Returns a list of localizations delegates containing this delegate along with
+ /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
+ /// and GlobalWidgetsLocalizations.delegate.
+ ///
+ /// Additional delegates can be added by appending to this list in
+ /// MaterialApp. This list does not have to be used at all if a custom list
+ /// of delegates is preferred or required.
+ static const List> localizationsDelegates =
+ >[
+ delegate,
+ GlobalMaterialLocalizations.delegate,
+ GlobalCupertinoLocalizations.delegate,
+ GlobalWidgetsLocalizations.delegate,
+ ];
+
+ /// A list of this localizations delegate's supported locales.
+ static const List supportedLocales = [
+ Locale('en'),
+ Locale('zh'),
+ Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'),
+ ];
+
+ /// No description provided for @appTitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Mom\'s Kitchen'**
+ String get appTitle;
+
+ /// No description provided for @welcomeMessage.
+ ///
+ /// In en, this message translates to:
+ /// **'Welcome to Mom\'s Kitchen!'**
+ String get welcomeMessage;
+
+ /// No description provided for @appDescription.
+ ///
+ /// In en, this message translates to:
+ /// **'Your favorite food delivery app'**
+ String get appDescription;
+
+ /// No description provided for @getStarted.
+ ///
+ /// In en, this message translates to:
+ /// **'Get Started'**
+ String get getStarted;
+
+ /// No description provided for @themeSettings.
+ ///
+ /// In en, this message translates to:
+ /// **'Theme Settings'**
+ String get themeSettings;
+
+ /// No description provided for @darkMode.
+ ///
+ /// In en, this message translates to:
+ /// **'Dark Mode'**
+ String get darkMode;
+
+ /// No description provided for @statusBarImmersive.
+ ///
+ /// In en, this message translates to:
+ /// **'Status Bar Immersive'**
+ String get statusBarImmersive;
+
+ /// No description provided for @fontSize.
+ ///
+ /// In en, this message translates to:
+ /// **'Font Size'**
+ String get fontSize;
+
+ /// No description provided for @primaryColor.
+ ///
+ /// In en, this message translates to:
+ /// **'Primary Color'**
+ String get primaryColor;
+
+ /// No description provided for @secondaryColor.
+ ///
+ /// In en, this message translates to:
+ /// **'Secondary Color'**
+ String get secondaryColor;
+
+ /// No description provided for @resetToDefault.
+ ///
+ /// In en, this message translates to:
+ /// **'Reset to Default'**
+ String get resetToDefault;
+
+ /// No description provided for @preview.
+ ///
+ /// In en, this message translates to:
+ /// **'Preview'**
+ String get preview;
+
+ /// No description provided for @sampleText.
+ ///
+ /// In en, this message translates to:
+ /// **'This is a sample text to preview the theme settings.'**
+ String get sampleText;
+
+ /// No description provided for @sampleButton.
+ ///
+ /// In en, this message translates to:
+ /// **'Sample Button'**
+ String get sampleButton;
+}
+
+class _AppLocalizationsDelegate
+ extends LocalizationsDelegate {
+ const _AppLocalizationsDelegate();
+
+ @override
+ Future load(Locale locale) {
+ return SynchronousFuture(lookupAppLocalizations(locale));
+ }
+
+ @override
+ bool isSupported(Locale locale) =>
+ ['en', 'zh'].contains(locale.languageCode);
+
+ @override
+ bool shouldReload(_AppLocalizationsDelegate old) => false;
+}
+
+AppLocalizations lookupAppLocalizations(Locale locale) {
+ // Lookup logic when language+script codes are specified.
+ switch (locale.languageCode) {
+ case 'zh':
+ {
+ switch (locale.scriptCode) {
+ case 'Hant':
+ return AppLocalizationsZhHant();
+ }
+ break;
+ }
+ }
+
+ // Lookup logic when only language code is specified.
+ switch (locale.languageCode) {
+ case 'en':
+ return AppLocalizationsEn();
+ case 'zh':
+ return AppLocalizationsZh();
+ }
+
+ throw FlutterError(
+ 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
+ 'an issue with the localizations generation tool. Please file an issue '
+ 'on GitHub with a reproducible sample app and the gen-l10n configuration '
+ 'that was used.',
+ );
+}
diff --git a/lib/src/l10n/app_localizations_en.dart b/lib/src/l10n/app_localizations_en.dart
new file mode 100644
index 0000000..f8ff4a3
--- /dev/null
+++ b/lib/src/l10n/app_localizations_en.dart
@@ -0,0 +1,53 @@
+// ignore: unused_import
+import 'package:intl/intl.dart' as intl;
+import 'app_localizations.dart';
+
+// ignore_for_file: type=lint
+
+/// The translations for English (`en`).
+class AppLocalizationsEn extends AppLocalizations {
+ AppLocalizationsEn([String locale = 'en']) : super(locale);
+
+ @override
+ String get appTitle => 'Mom\'s Kitchen';
+
+ @override
+ String get welcomeMessage => 'Welcome to Mom\'s Kitchen!';
+
+ @override
+ String get appDescription => 'Your favorite food delivery app';
+
+ @override
+ String get getStarted => 'Get Started';
+
+ @override
+ String get themeSettings => 'Theme Settings';
+
+ @override
+ String get darkMode => 'Dark Mode';
+
+ @override
+ String get statusBarImmersive => 'Status Bar Immersive';
+
+ @override
+ String get fontSize => 'Font Size';
+
+ @override
+ String get primaryColor => 'Primary Color';
+
+ @override
+ String get secondaryColor => 'Secondary Color';
+
+ @override
+ String get resetToDefault => 'Reset to Default';
+
+ @override
+ String get preview => 'Preview';
+
+ @override
+ String get sampleText =>
+ 'This is a sample text to preview the theme settings.';
+
+ @override
+ String get sampleButton => 'Sample Button';
+}
diff --git a/lib/src/l10n/app_localizations_zh.dart b/lib/src/l10n/app_localizations_zh.dart
new file mode 100644
index 0000000..a358922
--- /dev/null
+++ b/lib/src/l10n/app_localizations_zh.dart
@@ -0,0 +1,99 @@
+// ignore: unused_import
+import 'package:intl/intl.dart' as intl;
+import 'app_localizations.dart';
+
+// ignore_for_file: type=lint
+
+/// The translations for Chinese (`zh`).
+class AppLocalizationsZh extends AppLocalizations {
+ AppLocalizationsZh([String locale = 'zh']) : super(locale);
+
+ @override
+ String get appTitle => '妈妈的厨房';
+
+ @override
+ String get welcomeMessage => '欢迎来到妈妈的厨房!';
+
+ @override
+ String get appDescription => '您最喜爱的美食配送应用';
+
+ @override
+ String get getStarted => '开始使用';
+
+ @override
+ String get themeSettings => '主题设置';
+
+ @override
+ String get darkMode => '深色模式';
+
+ @override
+ String get statusBarImmersive => '状态栏沉浸';
+
+ @override
+ String get fontSize => '字体大小';
+
+ @override
+ String get primaryColor => '主题色';
+
+ @override
+ String get secondaryColor => '次要色';
+
+ @override
+ String get resetToDefault => '重置为默认';
+
+ @override
+ String get preview => '预览';
+
+ @override
+ String get sampleText => '这是一段示例文本,用于预览主题设置。';
+
+ @override
+ String get sampleButton => '示例按钮';
+}
+
+/// The translations for Chinese, using the Han script (`zh_Hant`).
+class AppLocalizationsZhHant extends AppLocalizationsZh {
+ AppLocalizationsZhHant() : super('zh_Hant');
+
+ @override
+ String get appTitle => '媽媽的廚房';
+
+ @override
+ String get welcomeMessage => '歡迎來到媽媽的廚房!';
+
+ @override
+ String get appDescription => '您最喜愛的美食配送應用';
+
+ @override
+ String get getStarted => '開始使用';
+
+ @override
+ String get themeSettings => '主題設置';
+
+ @override
+ String get darkMode => '深色模式';
+
+ @override
+ String get statusBarImmersive => '狀態欄沉浸';
+
+ @override
+ String get fontSize => '字體大小';
+
+ @override
+ String get primaryColor => '主題色';
+
+ @override
+ String get secondaryColor => '次要色';
+
+ @override
+ String get resetToDefault => '重置為預設';
+
+ @override
+ String get preview => '預覽';
+
+ @override
+ String get sampleText => '這是一段示例文本,用於預覽主題設置。';
+
+ @override
+ String get sampleButton => '示例按鈕';
+}
diff --git a/lib/src/l10n/app_localizations_zh_hant.dart b/lib/src/l10n/app_localizations_zh_hant.dart
new file mode 100644
index 0000000..81fb2c6
--- /dev/null
+++ b/lib/src/l10n/app_localizations_zh_hant.dart
@@ -0,0 +1,52 @@
+// ignore: unused_import
+import 'package:intl/intl.dart' as intl;
+import 'app_localizations.dart';
+
+// ignore_for_file: type=lint
+
+/// The translations for Traditional Chinese (`zh_Hant`).
+class AppLocalizationsZhHant extends AppLocalizations {
+ AppLocalizationsZhHant([String locale = 'zh_Hant']) : super(locale);
+
+ @override
+ String get appTitle => '媽媽的廚房';
+
+ @override
+ String get welcomeMessage => '歡迎來到媽媽的廚房!';
+
+ @override
+ String get appDescription => '您最喜愛的美食配送應用';
+
+ @override
+ String get getStarted => '開始使用';
+
+ @override
+ String get themeSettings => '主題設置';
+
+ @override
+ String get darkMode => '深色模式';
+
+ @override
+ String get statusBarImmersive => '狀態欄沉浸';
+
+ @override
+ String get fontSize => '字體大小';
+
+ @override
+ String get primaryColor => '主題色';
+
+ @override
+ String get secondaryColor => '次要色';
+
+ @override
+ String get resetToDefault => '重置為預設';
+
+ @override
+ String get preview => '預覽';
+
+ @override
+ String get sampleText => '這是一段示例文本,用於預覽主題設置。';
+
+ @override
+ String get sampleButton => '示例按鈕';
+}
diff --git a/lib/src/l10n/app_zh.arb b/lib/src/l10n/app_zh.arb
new file mode 100644
index 0000000..f24fc96
--- /dev/null
+++ b/lib/src/l10n/app_zh.arb
@@ -0,0 +1,17 @@
+{
+ "@@locale": "zh",
+ "appTitle": "妈妈的厨房",
+ "welcomeMessage": "欢迎来到妈妈的厨房!",
+ "appDescription": "您最喜爱的美食配送应用",
+ "getStarted": "开始使用",
+ "themeSettings": "主题设置",
+ "darkMode": "深色模式",
+ "statusBarImmersive": "状态栏沉浸",
+ "fontSize": "字体大小",
+ "primaryColor": "主题色",
+ "secondaryColor": "次要色",
+ "resetToDefault": "重置为默认",
+ "preview": "预览",
+ "sampleText": "这是一段示例文本,用于预览主题设置。",
+ "sampleButton": "示例按钮"
+}
\ No newline at end of file
diff --git a/lib/src/l10n/app_zh_Hant.arb b/lib/src/l10n/app_zh_Hant.arb
new file mode 100644
index 0000000..880f3bb
--- /dev/null
+++ b/lib/src/l10n/app_zh_Hant.arb
@@ -0,0 +1,17 @@
+{
+ "@@locale": "zh_Hant",
+ "appTitle": "媽媽的廚房",
+ "welcomeMessage": "歡迎來到媽媽的廚房!",
+ "appDescription": "您最喜愛的美食配送應用",
+ "getStarted": "開始使用",
+ "themeSettings": "主題設置",
+ "darkMode": "深色模式",
+ "statusBarImmersive": "狀態欄沉浸",
+ "fontSize": "字體大小",
+ "primaryColor": "主題色",
+ "secondaryColor": "次要色",
+ "resetToDefault": "重置為預設",
+ "preview": "預覽",
+ "sampleText": "這是一段示例文本,用於預覽主題設置。",
+ "sampleButton": "示例按鈕"
+}
diff --git a/lib/src/models/theme_model.dart b/lib/src/models/theme_model.dart
new file mode 100644
index 0000000..430fa55
--- /dev/null
+++ b/lib/src/models/theme_model.dart
@@ -0,0 +1,86 @@
+import 'package:flutter/material.dart';
+
+class ThemeModel {
+ final bool isDarkMode;
+ final Color primaryColor;
+ final Color secondaryColor;
+ final Color textColor;
+ final Color backgroundColor;
+ final bool isStatusBarImmersive;
+ final double fontSize;
+
+ ThemeModel({
+ required this.isDarkMode,
+ required this.primaryColor,
+ required this.secondaryColor,
+ required this.textColor,
+ required this.backgroundColor,
+ required this.isStatusBarImmersive,
+ required this.fontSize,
+ });
+
+ // 默认主题
+ factory ThemeModel.defaultTheme() {
+ return ThemeModel(
+ isDarkMode: false,
+ primaryColor: Colors.blue,
+ secondaryColor: Colors.orange,
+ textColor: Colors.black,
+ backgroundColor: Colors.white,
+ isStatusBarImmersive: false,
+ fontSize: 16.0,
+ );
+ }
+
+ // 夜间主题
+ factory ThemeModel.darkTheme() {
+ return ThemeModel(
+ isDarkMode: true,
+ primaryColor: Colors.blue,
+ secondaryColor: Colors.orange,
+ textColor: Colors.white,
+ backgroundColor: Colors.black,
+ isStatusBarImmersive: false,
+ fontSize: 16.0,
+ );
+ }
+
+ // 复制方法,用于修改主题
+ ThemeModel copyWith({
+ bool? isDarkMode,
+ Color? primaryColor,
+ Color? secondaryColor,
+ Color? textColor,
+ Color? backgroundColor,
+ bool? isStatusBarImmersive,
+ double? fontSize,
+ }) {
+ return ThemeModel(
+ isDarkMode: isDarkMode ?? this.isDarkMode,
+ primaryColor: primaryColor ?? this.primaryColor,
+ secondaryColor: secondaryColor ?? this.secondaryColor,
+ textColor: textColor ?? this.textColor,
+ backgroundColor: backgroundColor ?? this.backgroundColor,
+ isStatusBarImmersive: isStatusBarImmersive ?? this.isStatusBarImmersive,
+ fontSize: fontSize ?? this.fontSize,
+ );
+ }
+
+ // 转换为 ThemeData
+ ThemeData toThemeData() {
+ return ThemeData(
+ brightness: isDarkMode ? Brightness.dark : Brightness.light,
+ primaryColor: primaryColor,
+ secondaryHeaderColor: secondaryColor,
+ textTheme: TextTheme(
+ bodyLarge: TextStyle(color: textColor, fontSize: fontSize),
+ bodyMedium: TextStyle(color: textColor, fontSize: fontSize - 2),
+ bodySmall: TextStyle(color: textColor, fontSize: fontSize - 4),
+ titleLarge: TextStyle(color: textColor, fontSize: fontSize + 4),
+ titleMedium: TextStyle(color: textColor, fontSize: fontSize + 2),
+ titleSmall: TextStyle(color: textColor, fontSize: fontSize),
+ ),
+ scaffoldBackgroundColor: backgroundColor,
+ );
+ }
+}
\ No newline at end of file
diff --git a/lib/src/pages/cart_page.dart b/lib/src/pages/cart_page.dart
new file mode 100644
index 0000000..558ce07
--- /dev/null
+++ b/lib/src/pages/cart_page.dart
@@ -0,0 +1,126 @@
+import 'package:flutter/material.dart';
+
+class CartPage extends StatefulWidget {
+ const CartPage({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _CartPageState();
+}
+
+class _CartPageState extends State {
+ final List> cartItems = [
+ {
+ 'id': 1,
+ 'name': 'Classic Pizza',
+ 'price': 29.99,
+ 'quantity': 1,
+ 'image': 'https://example.com/pizza.jpg',
+ },
+ {
+ 'id': 2,
+ 'name': 'Burger',
+ 'price': 19.99,
+ 'quantity': 2,
+ 'image': 'https://example.com/burger.jpg',
+ },
+ ];
+
+ double get totalPrice {
+ return cartItems.fold(0, (sum, item) => sum + (item['price'] * item['quantity']));
+ }
+
+ void updateQuantity(int id, int newQuantity) {
+ setState(() {
+ final item = cartItems.firstWhere((item) => item['id'] == id);
+ if (newQuantity > 0) {
+ item['quantity'] = newQuantity;
+ } else {
+ cartItems.remove(item);
+ }
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: const Text('Your Cart'),
+ centerTitle: true,
+ ),
+ body: SafeArea(
+ child: Column(
+ children: [
+ Expanded(
+ child: cartItems.isEmpty
+ ? const Center(
+ child: Text('Your cart is empty'),
+ )
+ : ListView.builder(
+ itemCount: cartItems.length,
+ itemBuilder: (context, index) {
+ final item = cartItems[index];
+ return ListTile(
+ leading: Image.network(
+ item['image'],
+ width: 80,
+ height: 80,
+ fit: BoxFit.cover,
+ ),
+ title: Text(item['name']),
+ subtitle: Text('\$${item['price']}'),
+ trailing: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ IconButton(
+ icon: const Icon(Icons.remove),
+ onPressed: () {
+ updateQuantity(item['id'], item['quantity'] - 1);
+ },
+ ),
+ Text(item['quantity'].toString()),
+ IconButton(
+ icon: const Icon(Icons.add),
+ onPressed: () {
+ updateQuantity(item['id'], item['quantity'] + 1);
+ },
+ ),
+ ],
+ ),
+ );
+ },
+ ),
+ ),
+ if (cartItems.isNotEmpty)
+ Container(
+ padding: const EdgeInsets.all(16.0),
+ decoration: BoxDecoration(
+ border: Border(top: BorderSide(color: Colors.grey.shade200)),
+ ),
+ child: Column(
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ const Text('Total:'),
+ Text('\$${totalPrice.toStringAsFixed(2)}'),
+ ],
+ ),
+ const SizedBox(height: 16),
+ ElevatedButton(
+ onPressed: () {
+ // Handle checkout
+ },
+ style: ElevatedButton.styleFrom(
+ minimumSize: const Size(double.infinity, 48),
+ ),
+ child: const Text('Checkout'),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/lib/src/pages/example_page.dart b/lib/src/pages/example_page.dart
new file mode 100644
index 0000000..b212d0b
--- /dev/null
+++ b/lib/src/pages/example_page.dart
@@ -0,0 +1,189 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:mom_kitchen/src/services/app_service.dart';
+import 'package:mom_kitchen/src/l10n/app_localizations.dart';
+import 'package:mom_kitchen/src/widgets/skeleton_loader.dart';
+
+class ExamplePage extends StatefulWidget {
+ const ExamplePage({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _ExamplePageState();
+}
+
+class _ExamplePageState extends State {
+ final _themeService = AppService.instance.theme;
+ bool _isLoading = true;
+
+ @override
+ void initState() {
+ super.initState();
+ // 模拟加载数据
+ Future.delayed(const Duration(seconds: 2), () {
+ setState(() {
+ _isLoading = false;
+ });
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final l10n = AppLocalizations.of(context)!;
+
+ // 读取主题的所有值
+ final isDarkMode = _themeService.isDarkMode;
+ final primaryColor = _themeService.primaryColor;
+ final secondaryColor = _themeService.secondaryColor;
+ final fontSize = _themeService.fontSize;
+ final isStatusBarImmersive = _themeService.isStatusBarImmersive;
+ final textColor = _themeService.textColor;
+ final backgroundColor = _themeService.backgroundColor;
+ final animationIntensity = _themeService.animationIntensity;
+
+ return CupertinoPageScaffold(
+ navigationBar: CupertinoNavigationBar(
+ middle: Text(l10n.appTitle),
+ ),
+ child: Container(
+ color: backgroundColor,
+ child: ListView(
+ padding: const EdgeInsets.all(16.0),
+ children: [
+ // 页面标题
+ Text(
+ 'Example Page',
+ style: TextStyle(
+ color: textColor,
+ fontSize: fontSize + 8,
+ fontWeight: FontWeight.bold,
+ ),
+ textAlign: TextAlign.center,
+ ),
+ const SizedBox(height: 20),
+
+ // 主题值展示
+ Container(
+ padding: const EdgeInsets.all(16.0),
+ decoration: BoxDecoration(
+ color: secondaryColor.withOpacity(0.1),
+ borderRadius: BorderRadius.circular(8),
+ border: Border.all(color: secondaryColor, width: 1),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Theme Values',
+ style: TextStyle(
+ color: textColor,
+ fontSize: fontSize + 4,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ const SizedBox(height: 16),
+ _buildThemeValueRow('Dark Mode', isDarkMode.toString(), textColor),
+ _buildThemeValueRow('Primary Color', primaryColor.toString(), textColor),
+ _buildThemeValueRow('Secondary Color', secondaryColor.toString(), textColor),
+ _buildThemeValueRow('Font Size', fontSize.toString(), textColor),
+ _buildThemeValueRow('Status Bar Immersive', isStatusBarImmersive.toString(), textColor),
+ _buildThemeValueRow('Text Color', textColor.toString(), textColor),
+ _buildThemeValueRow('Background Color', backgroundColor.toString(), textColor),
+ _buildThemeValueRow('Animation Intensity', animationIntensity.toString(), textColor),
+ ],
+ ),
+ ),
+ const SizedBox(height: 20),
+
+ // 骨架屏示例
+ Text(
+ 'Skeleton Loader Example',
+ style: TextStyle(
+ color: textColor,
+ fontSize: fontSize + 4,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ const SizedBox(height: 16),
+ SkeletonContainer(
+ isLoading: _isLoading,
+ child: Container(
+ padding: const EdgeInsets.all(16.0),
+ decoration: BoxDecoration(
+ color: secondaryColor.withOpacity(0.1),
+ borderRadius: BorderRadius.circular(8),
+ border: Border.all(color: secondaryColor, width: 1),
+ ),
+ child: Text(
+ 'This content is loaded after the skeleton disappears',
+ style: TextStyle(
+ color: textColor,
+ fontSize: fontSize,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(height: 20),
+
+ // 动画示例
+ Text(
+ 'Animation Example',
+ style: TextStyle(
+ color: textColor,
+ fontSize: fontSize + 4,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ const SizedBox(height: 16),
+ GestureDetector(
+ onTap: () {
+ // 这里可以添加动画效果,使用 animationIntensity 来控制动画强度
+ },
+ child: Container(
+ padding: const EdgeInsets.all(16.0),
+ decoration: BoxDecoration(
+ color: primaryColor,
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: Text(
+ 'Tap for Animation',
+ style: TextStyle(
+ color: textColor,
+ fontSize: fontSize,
+ fontWeight: FontWeight.bold,
+ ),
+ textAlign: TextAlign.center,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _buildThemeValueRow(String label, String value, Color textColor) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 4.0),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ label,
+ style: TextStyle(
+ color: textColor,
+ fontSize: _themeService.fontSize,
+ ),
+ ),
+ Text(
+ value,
+ style: TextStyle(
+ color: textColor,
+ fontSize: _themeService.fontSize,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/lib/src/pages/theme_demo_page.dart b/lib/src/pages/theme_demo_page.dart
new file mode 100644
index 0000000..f0dbc97
--- /dev/null
+++ b/lib/src/pages/theme_demo_page.dart
@@ -0,0 +1,561 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:mom_kitchen/src/services/app_service.dart';
+import 'package:mom_kitchen/src/services/theme_service.dart';
+import 'package:mom_kitchen/src/services/animation_service.dart';
+import 'package:mom_kitchen/src/l10n/app_localizations.dart';
+
+class ThemeDemoPage extends StatefulWidget {
+ const ThemeDemoPage({super.key});
+
+ @override
+ State createState() => _ThemeDemoPageState();
+}
+
+class _ThemeDemoPageState extends State {
+ late ThemeService _themeService;
+ late AnimationService _animationService;
+
+ @override
+ void initState() {
+ super.initState();
+ _themeService = AppService.instance.theme;
+ _animationService = AppService.instance.animation;
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final l10n = AppLocalizations.of(context)!;
+
+ return CupertinoPageScaffold(
+ navigationBar: CupertinoNavigationBar(middle: Text(l10n.themeSettings)),
+ child: Container(
+ color: _themeService.backgroundColor,
+ child: ListView(
+ padding: const EdgeInsets.all(16.0),
+ children: [
+ _buildSectionHeader('🎨 Theme Settings', CupertinoIcons.paintbrush),
+
+ CupertinoListTile(
+ title: Text(
+ l10n.darkMode,
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ trailing: CupertinoSwitch(
+ value: _themeService.isDarkMode,
+ onChanged: (value) async {
+ await _themeService.toggleThemeMode();
+ setState(() {});
+ },
+ ),
+ ),
+
+ CupertinoListTile(
+ title: Text(
+ l10n.statusBarImmersive,
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ trailing: CupertinoSwitch(
+ value: _themeService.isStatusBarImmersive,
+ onChanged: (value) async {
+ await _themeService.setStatusBarImmersive(value);
+ setState(() {});
+ },
+ ),
+ ),
+
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ '${l10n.fontSize}: ${_themeService.fontSize.toStringAsFixed(1)}',
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ const SizedBox(height: 8),
+ CupertinoSlider(
+ value: _themeService.fontSize,
+ min: 12.0,
+ max: 24.0,
+ divisions: 12,
+ onChanged: (value) async {
+ await _themeService.setFontSize(value);
+ setState(() {});
+ },
+ ),
+ ],
+ ),
+ ),
+
+ CupertinoListTile(
+ title: Text(
+ l10n.primaryColor,
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ trailing: Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ color: _themeService.primaryColor,
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(color: _themeService.textColor, width: 2),
+ ),
+ ),
+ onTap: () => _showColorPicker('primary'),
+ ),
+
+ CupertinoListTile(
+ title: Text(
+ l10n.secondaryColor,
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ trailing: Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ color: _themeService.secondaryColor,
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(color: _themeService.textColor, width: 2),
+ ),
+ ),
+ onTap: () => _showColorPicker('secondary'),
+ ),
+
+ const SizedBox(height: 24),
+ _buildSectionHeader('✨ Animation Settings', CupertinoIcons.sparkles),
+
+ CupertinoListTile(
+ title: Text(
+ 'Enable Animations',
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ trailing: CupertinoSwitch(
+ value: _animationService.enabled,
+ onChanged: (value) async {
+ await _animationService.setEnabled(value);
+ setState(() {});
+ },
+ ),
+ ),
+
+ _buildPresetSelector(),
+
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Animation Speed: ${_animationService.speed.toStringAsFixed(1)}x',
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ const SizedBox(height: 8),
+ CupertinoSlider(
+ value: _animationService.speed,
+ min: 0.1,
+ max: 3.0,
+ divisions: 29,
+ onChanged: _animationService.enabled ? (value) async {
+ await _animationService.setSpeed(value);
+ setState(() {});
+ } : null,
+ ),
+ ],
+ ),
+ ),
+
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Animation Intensity: ${_animationService.intensity.toStringAsFixed(1)}',
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ const SizedBox(height: 8),
+ CupertinoSlider(
+ value: _animationService.intensity,
+ min: 0.0,
+ max: 2.0,
+ divisions: 20,
+ onChanged: _animationService.enabled ? (value) async {
+ await _animationService.setIntensity(value);
+ setState(() {});
+ } : null,
+ ),
+ ],
+ ),
+ ),
+
+ _buildCurveSelector(),
+
+ const SizedBox(height: 24),
+ _buildSectionHeader('👁️ Preview', CupertinoIcons.eye),
+
+ _buildPreviewArea(),
+
+ const SizedBox(height: 16),
+ Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Row(
+ children: [
+ Expanded(
+ child: CupertinoButton.filled(
+ onPressed: () async {
+ await _themeService.resetToDefault();
+ await _animationService.resetToDefault();
+ setState(() {});
+ },
+ child: const Text('Reset All'),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _buildSectionHeader(String title, IconData icon) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 12.0),
+ child: Row(
+ children: [
+ Icon(icon, color: _themeService.primaryColor, size: 20),
+ const SizedBox(width: 8),
+ Text(
+ title,
+ style: TextStyle(
+ fontSize: _themeService.fontSize + 2,
+ fontWeight: FontWeight.w600,
+ color: _themeService.textColor,
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _buildPresetSelector() {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Animation Preset',
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ const SizedBox(height: 12),
+ Wrap(
+ spacing: 8,
+ runSpacing: 8,
+ children: AnimationPreset.values.map((preset) {
+ final isSelected = _animationService.preset == preset;
+ return GestureDetector(
+ onTap: _animationService.enabled ? () async {
+ await _animationService.setPreset(preset);
+ setState(() {});
+ } : null,
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
+ decoration: BoxDecoration(
+ color: isSelected
+ ? _themeService.primaryColor
+ : _themeService.backgroundColor,
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(
+ color: isSelected
+ ? _themeService.primaryColor
+ : _themeService.textColor.withValues(alpha: 0.3),
+ ),
+ ),
+ child: Text(
+ _getPresetName(preset),
+ style: TextStyle(
+ color: isSelected
+ ? Colors.white
+ : _themeService.textColor,
+ fontSize: _themeService.fontSize - 2,
+ ),
+ ),
+ ),
+ );
+ }).toList(),
+ ),
+ ],
+ ),
+ );
+ }
+
+ String _getPresetName(AnimationPreset preset) {
+ switch (preset) {
+ case AnimationPreset.standard:
+ return 'Standard';
+ case AnimationPreset.fast:
+ return '⚡ Fast';
+ case AnimationPreset.slow:
+ return '🐢 Slow';
+ case AnimationPreset.smooth:
+ return '🌊 Smooth';
+ case AnimationPreset.bouncy:
+ return '🏀 Bouncy';
+ case AnimationPreset.minimal:
+ return '✨ Minimal';
+ case AnimationPreset.none:
+ return '❌ None';
+ }
+ }
+
+ Widget _buildCurveSelector() {
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Animation Curve',
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ const SizedBox(height: 12),
+ Container(
+ padding: const EdgeInsets.symmetric(horizontal: 12),
+ decoration: BoxDecoration(
+ color: _themeService.backgroundColor,
+ borderRadius: BorderRadius.circular(8),
+ border: Border.all(
+ color: _themeService.textColor.withValues(alpha: 0.3),
+ ),
+ ),
+ child: CupertinoButton(
+ padding: EdgeInsets.zero,
+ onPressed: _animationService.enabled ? () => _showCurvePicker() : null,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ AnimationCurves.getCurveName(_animationService.curveType),
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ Icon(
+ CupertinoIcons.chevron_down,
+ color: _themeService.textColor,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _buildPreviewArea() {
+ return Container(
+ margin: const EdgeInsets.all(16.0),
+ padding: const EdgeInsets.all(16.0),
+ decoration: BoxDecoration(
+ color: _themeService.secondaryColor.withValues(alpha: 0.1),
+ borderRadius: BorderRadius.circular(12),
+ border: Border.all(
+ color: _themeService.secondaryColor,
+ width: 1,
+ ),
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ 'Preview',
+ style: TextStyle(
+ color: _themeService.textColor,
+ fontSize: _themeService.fontSize + 4,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ const SizedBox(height: 16),
+ Text(
+ 'This is a sample text to preview the theme settings.',
+ style: TextStyle(
+ color: _themeService.textColor,
+ fontSize: _themeService.fontSize,
+ ),
+ ),
+ const SizedBox(height: 16),
+ Row(
+ children: [
+ AnimatedButton(
+ onPressed: () {},
+ child: Container(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
+ decoration: BoxDecoration(
+ color: _themeService.primaryColor,
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: const Text(
+ 'Animated Button',
+ style: TextStyle(color: Colors.white),
+ ),
+ ),
+ ),
+ ],
+ ),
+ const SizedBox(height: 16),
+ AnimatedListView(
+ children: List.generate(3, (index) => _buildPreviewItem(index)),
+ ),
+ ],
+ ),
+ );
+ }
+
+ Widget _buildPreviewItem(int index) {
+ return Container(
+ margin: const EdgeInsets.only(bottom: 8),
+ padding: const EdgeInsets.all(12),
+ decoration: BoxDecoration(
+ color: _themeService.backgroundColor,
+ borderRadius: BorderRadius.circular(8),
+ border: Border.all(
+ color: _themeService.textColor.withValues(alpha: 0.1),
+ ),
+ ),
+ child: Row(
+ children: [
+ Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ color: _themeService.primaryColor.withValues(alpha: 0.2),
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: Icon(
+ [CupertinoIcons.star, CupertinoIcons.heart, CupertinoIcons.bell][index],
+ color: _themeService.primaryColor,
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Text(
+ 'Preview Item ${index + 1}',
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+
+ void _showColorPicker(String type) {
+ showCupertinoModalPopup(
+ context: context,
+ builder: (context) => Container(
+ height: 300,
+ padding: const EdgeInsets.only(top: 6.0),
+ decoration: BoxDecoration(
+ color: _themeService.backgroundColor,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
+ ),
+ child: Column(
+ children: [
+ Container(
+ width: 40,
+ height: 4,
+ decoration: BoxDecoration(
+ color: _themeService.textColor.withValues(alpha: 0.3),
+ borderRadius: BorderRadius.circular(2),
+ ),
+ ),
+ Expanded(
+ child: GridView.count(
+ crossAxisCount: 6,
+ padding: const EdgeInsets.all(16),
+ children: [
+ Colors.red, Colors.pink, Colors.purple, Colors.deepPurple,
+ Colors.indigo, Colors.blue, Colors.lightBlue, Colors.cyan,
+ Colors.teal, Colors.green, Colors.lightGreen, Colors.lime,
+ Colors.yellow, Colors.amber, Colors.orange, Colors.deepOrange,
+ Colors.brown, Colors.grey,
+ ].map((color) {
+ return GestureDetector(
+ onTap: () async {
+ if (type == 'primary') {
+ await _themeService.setPrimaryColor(color);
+ } else {
+ await _themeService.setSecondaryColor(color);
+ }
+ Navigator.pop(context);
+ setState(() {});
+ },
+ child: Container(
+ margin: const EdgeInsets.all(4),
+ decoration: BoxDecoration(
+ color: color,
+ borderRadius: BorderRadius.circular(8),
+ ),
+ ),
+ );
+ }).toList(),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ void _showCurvePicker() {
+ showCupertinoModalPopup(
+ context: context,
+ builder: (context) => Container(
+ height: 300,
+ padding: const EdgeInsets.only(top: 6.0),
+ decoration: BoxDecoration(
+ color: _themeService.backgroundColor,
+ borderRadius: const BorderRadius.vertical(top: Radius.circular(16)),
+ ),
+ child: Column(
+ children: [
+ Container(
+ width: 40,
+ height: 4,
+ decoration: BoxDecoration(
+ color: _themeService.textColor.withValues(alpha: 0.3),
+ borderRadius: BorderRadius.circular(2),
+ ),
+ ),
+ Expanded(
+ child: ListView.builder(
+ itemCount: AnimationCurveType.values.length,
+ itemBuilder: (context, index) {
+ final curveType = AnimationCurveType.values[index];
+ final isSelected = _animationService.curveType == curveType;
+
+ return CupertinoListTile(
+ title: Text(
+ AnimationCurves.getCurveName(curveType),
+ style: TextStyle(color: _themeService.textColor),
+ ),
+ trailing: isSelected
+ ? Icon(CupertinoIcons.checkmark_circle_fill,
+ color: _themeService.primaryColor)
+ : null,
+ onTap: () async {
+ await _animationService.setCurveType(curveType);
+ Navigator.pop(context);
+ setState(() {});
+ },
+ );
+ },
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/src/services/animation_service.dart b/lib/src/services/animation_service.dart
new file mode 100644
index 0000000..c826ebd
--- /dev/null
+++ b/lib/src/services/animation_service.dart
@@ -0,0 +1,867 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+import 'package:animations/animations.dart';
+
+enum AnimationPreset { standard, fast, slow, smooth, bouncy, minimal, none }
+
+enum AnimationCurveType {
+ linear,
+ easeIn,
+ easeOut,
+ easeInOut,
+ curveEase,
+ bounceOut,
+ elasticOut,
+ fastOutSlowIn,
+ slowMiddle,
+}
+
+class AnimationConfig {
+ final bool enabled;
+ final double speed;
+ final double intensity;
+ final AnimationCurveType curveType;
+ final AnimationPreset preset;
+
+ const AnimationConfig({
+ this.enabled = true,
+ this.speed = 1.0,
+ this.intensity = 1.0,
+ this.curveType = AnimationCurveType.easeInOut,
+ this.preset = AnimationPreset.standard,
+ });
+
+ AnimationConfig copyWith({
+ bool? enabled,
+ double? speed,
+ double? intensity,
+ AnimationCurveType? curveType,
+ AnimationPreset? preset,
+ }) {
+ return AnimationConfig(
+ enabled: enabled ?? this.enabled,
+ speed: speed ?? this.speed,
+ intensity: intensity ?? this.intensity,
+ curveType: curveType ?? this.curveType,
+ preset: preset ?? this.preset,
+ );
+ }
+
+ Duration get baseDuration => Duration(milliseconds: (300 / speed).round());
+
+ Duration get shortDuration => Duration(milliseconds: (150 / speed).round());
+
+ Duration get longDuration => Duration(milliseconds: (500 / speed).round());
+
+ Curve get curve => AnimationCurves.getCurve(curveType, intensity);
+
+ static AnimationConfig fromPreset(AnimationPreset preset) {
+ switch (preset) {
+ case AnimationPreset.standard:
+ return const AnimationConfig(
+ enabled: true,
+ speed: 1.0,
+ intensity: 1.0,
+ curveType: AnimationCurveType.easeInOut,
+ preset: AnimationPreset.standard,
+ );
+ case AnimationPreset.fast:
+ return const AnimationConfig(
+ enabled: true,
+ speed: 2.0,
+ intensity: 0.8,
+ curveType: AnimationCurveType.fastOutSlowIn,
+ preset: AnimationPreset.fast,
+ );
+ case AnimationPreset.slow:
+ return const AnimationConfig(
+ enabled: true,
+ speed: 0.5,
+ intensity: 1.2,
+ curveType: AnimationCurveType.slowMiddle,
+ preset: AnimationPreset.slow,
+ );
+ case AnimationPreset.smooth:
+ return const AnimationConfig(
+ enabled: true,
+ speed: 0.8,
+ intensity: 1.0,
+ curveType: AnimationCurveType.curveEase,
+ preset: AnimationPreset.smooth,
+ );
+ case AnimationPreset.bouncy:
+ return const AnimationConfig(
+ enabled: true,
+ speed: 1.0,
+ intensity: 1.5,
+ curveType: AnimationCurveType.bounceOut,
+ preset: AnimationPreset.bouncy,
+ );
+ case AnimationPreset.minimal:
+ return const AnimationConfig(
+ enabled: true,
+ speed: 1.5,
+ intensity: 0.3,
+ curveType: AnimationCurveType.linear,
+ preset: AnimationPreset.minimal,
+ );
+ case AnimationPreset.none:
+ return const AnimationConfig(
+ enabled: false,
+ speed: 1.0,
+ intensity: 0.0,
+ curveType: AnimationCurveType.linear,
+ preset: AnimationPreset.none,
+ );
+ }
+ }
+
+ Map toJson() => {
+ 'enabled': enabled,
+ 'speed': speed,
+ 'intensity': intensity,
+ 'curveType': curveType.index,
+ 'preset': preset.index,
+ };
+
+ factory AnimationConfig.fromJson(Map json) {
+ return AnimationConfig(
+ enabled: json['enabled'] as bool? ?? true,
+ speed: (json['speed'] as num?)?.toDouble() ?? 1.0,
+ intensity: (json['intensity'] as num?)?.toDouble() ?? 1.0,
+ curveType: AnimationCurveType.values[json['curveType'] as int? ?? 0],
+ preset: AnimationPreset.values[json['preset'] as int? ?? 0],
+ );
+ }
+}
+
+class AnimationCurves {
+ static Curve getCurve(AnimationCurveType type, double intensity) {
+ switch (type) {
+ case AnimationCurveType.linear:
+ return Curves.linear;
+ case AnimationCurveType.easeIn:
+ return Curves.easeIn;
+ case AnimationCurveType.easeOut:
+ return Curves.easeOut;
+ case AnimationCurveType.easeInOut:
+ return Curves.easeInOut;
+ case AnimationCurveType.curveEase:
+ return Curves.ease;
+ case AnimationCurveType.bounceOut:
+ return Curves.bounceOut;
+ case AnimationCurveType.elasticOut:
+ return Curves.elasticOut;
+ case AnimationCurveType.fastOutSlowIn:
+ return Curves.fastOutSlowIn;
+ case AnimationCurveType.slowMiddle:
+ return Curves.slowMiddle;
+ }
+ }
+
+ static String getCurveName(AnimationCurveType type) {
+ switch (type) {
+ case AnimationCurveType.linear:
+ return 'Linear';
+ case AnimationCurveType.easeIn:
+ return 'Ease In';
+ case AnimationCurveType.easeOut:
+ return 'Ease Out';
+ case AnimationCurveType.easeInOut:
+ return 'Ease In Out';
+ case AnimationCurveType.curveEase:
+ return 'Ease';
+ case AnimationCurveType.bounceOut:
+ return 'Bounce';
+ case AnimationCurveType.elasticOut:
+ return 'Elastic';
+ case AnimationCurveType.fastOutSlowIn:
+ return 'Fast Out Slow In';
+ case AnimationCurveType.slowMiddle:
+ return 'Slow Middle';
+ }
+ }
+}
+
+class AnimationService extends GetxService {
+ static AnimationService get to => Get.find();
+
+ final _config = Rx(const AnimationConfig());
+ late SharedPreferences _prefs;
+
+ AnimationConfig get config => _config.value;
+ bool get enabled => _config.value.enabled;
+ double get speed => _config.value.speed;
+ double get intensity => _config.value.intensity;
+ AnimationCurveType get curveType => _config.value.curveType;
+ AnimationPreset get preset => _config.value.preset;
+ Duration get baseDuration => _config.value.baseDuration;
+ Duration get shortDuration => _config.value.shortDuration;
+ Duration get longDuration => _config.value.longDuration;
+ Curve get curve => _config.value.curve;
+
+ Future init() async {
+ _prefs = await SharedPreferences.getInstance();
+ await _loadConfig();
+ return this;
+ }
+
+ Future _loadConfig() async {
+ final enabled = _prefs.getBool('animation_enabled') ?? true;
+ final speed = _prefs.getDouble('animation_speed') ?? 1.0;
+ final intensity = _prefs.getDouble('animation_intensity') ?? 1.0;
+ final curveIndex = _prefs.getInt('animation_curve') ?? 3;
+ final presetIndex = _prefs.getInt('animation_preset') ?? 0;
+
+ _config.value = AnimationConfig(
+ enabled: enabled,
+ speed: speed,
+ intensity: intensity,
+ curveType: AnimationCurveType.values[curveIndex],
+ preset: AnimationPreset.values[presetIndex],
+ );
+ }
+
+ Future _saveConfig() async {
+ await _prefs.setBool('animation_enabled', _config.value.enabled);
+ await _prefs.setDouble('animation_speed', _config.value.speed);
+ await _prefs.setDouble('animation_intensity', _config.value.intensity);
+ await _prefs.setInt('animation_curve', _config.value.curveType.index);
+ await _prefs.setInt('animation_preset', _config.value.preset.index);
+ }
+
+ Future setEnabled(bool enabled) async {
+ _config.value = _config.value.copyWith(enabled: enabled);
+ await _saveConfig();
+ }
+
+ Future setSpeed(double speed) async {
+ _config.value = _config.value.copyWith(speed: speed.clamp(0.1, 3.0));
+ await _saveConfig();
+ }
+
+ Future setIntensity(double intensity) async {
+ _config.value = _config.value.copyWith(
+ intensity: intensity.clamp(0.0, 2.0),
+ );
+ await _saveConfig();
+ }
+
+ Future setCurveType(AnimationCurveType curveType) async {
+ _config.value = _config.value.copyWith(curveType: curveType);
+ await _saveConfig();
+ }
+
+ Future setPreset(AnimationPreset preset) async {
+ _config.value = AnimationConfig.fromPreset(preset);
+ await _saveConfig();
+ }
+
+ Future setCustomConfig({
+ bool? enabled,
+ double? speed,
+ double? intensity,
+ AnimationCurveType? curveType,
+ }) async {
+ _config.value = _config.value.copyWith(
+ enabled: enabled,
+ speed: speed,
+ intensity: intensity,
+ curveType: curveType,
+ preset: AnimationPreset.standard,
+ );
+ await _saveConfig();
+ }
+
+ Future resetToDefault() async {
+ _config.value = const AnimationConfig();
+ await _saveConfig();
+ }
+
+ Duration getDuration(AnimationDurationType type) {
+ if (!enabled) return Duration.zero;
+
+ switch (type) {
+ case AnimationDurationType.short:
+ return shortDuration;
+ case AnimationDurationType.base:
+ return baseDuration;
+ case AnimationDurationType.long:
+ return longDuration;
+ }
+ }
+}
+
+enum AnimationDurationType { short, base, long }
+
+class PageTransitions {
+ static Widget fadeThrough(Widget child, AnimationConfig config) {
+ if (!config.enabled) return child;
+
+ return FadeThroughTransition(
+ animation: CurvedAnimation(
+ parent: AlwaysStoppedAnimation(1.0),
+ curve: config.curve,
+ ),
+ secondaryAnimation: CurvedAnimation(
+ parent: AlwaysStoppedAnimation(1.0),
+ curve: config.curve,
+ ),
+ fillColor: Colors.transparent,
+ child: child,
+ );
+ }
+
+ static Widget fadeScale(Widget child, AnimationConfig config) {
+ if (!config.enabled) return child;
+
+ return FadeScaleTransition(
+ animation: CurvedAnimation(
+ parent: AlwaysStoppedAnimation(1.0),
+ curve: config.curve,
+ ),
+ child: child,
+ );
+ }
+
+ static Widget sharedAxis({
+ required Widget child,
+ required AnimationConfig config,
+ SharedAxisTransitionType type = SharedAxisTransitionType.horizontal,
+ }) {
+ if (!config.enabled) return child;
+
+ return SharedAxisTransition(
+ animation: CurvedAnimation(
+ parent: AlwaysStoppedAnimation(1.0),
+ curve: config.curve,
+ ),
+ secondaryAnimation: CurvedAnimation(
+ parent: AlwaysStoppedAnimation(1.0),
+ curve: config.curve,
+ ),
+ transitionType: type,
+ fillColor: Colors.transparent,
+ child: child,
+ );
+ }
+
+ static PageTransitionsBuilder getTransitionBuilder(AnimationConfig config) {
+ return _AdaptivePageTransitionsBuilder(config: config);
+ }
+}
+
+class _AdaptivePageTransitionsBuilder extends PageTransitionsBuilder {
+ final AnimationConfig config;
+
+ const _AdaptivePageTransitionsBuilder({required this.config});
+
+ @override
+ Widget buildTransitions(
+ PageRoute route,
+ BuildContext context,
+ Animation animation,
+ Animation secondaryAnimation,
+ Widget child,
+ ) {
+ if (!config.enabled) return child;
+
+ if (route.settings.name == '/') {
+ return child;
+ }
+
+ return SharedAxisTransition(
+ animation: animation,
+ secondaryAnimation: secondaryAnimation,
+ transitionType: SharedAxisTransitionType.horizontal,
+ fillColor: Colors.transparent,
+ child: child,
+ );
+ }
+}
+
+class AnimatedListItem extends StatelessWidget {
+ final Widget child;
+ final int index;
+ final Duration? duration;
+ final AnimationConfig? config;
+
+ const AnimatedListItem({
+ super.key,
+ required this.child,
+ required this.index,
+ this.duration,
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+ if (!animConfig.enabled) return child;
+
+ final animDuration = duration ?? animConfig.baseDuration;
+ final delay = Duration(
+ milliseconds: (index * 50 * (1 / animConfig.speed)).round(),
+ );
+
+ return TweenAnimationBuilder(
+ tween: Tween(begin: 0.0, end: 1.0),
+ duration: animDuration + delay,
+ curve: animConfig.curve,
+ builder: (context, value, child) {
+ return Opacity(
+ opacity: value,
+ child: Transform.translate(
+ offset: Offset(0, 30 * (1 - value) * animConfig.intensity),
+ child: child,
+ ),
+ );
+ },
+ child: child,
+ );
+ }
+}
+
+class AnimatedListView extends StatelessWidget {
+ final List children;
+ final Duration? itemDuration;
+ final Duration? staggerDelay;
+ final AnimationConfig? config;
+
+ const AnimatedListView({
+ super.key,
+ required this.children,
+ this.itemDuration,
+ this.staggerDelay,
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+ if (!animConfig.enabled) {
+ return Column(children: children);
+ }
+
+ return Column(
+ children: children.asMap().entries.map((entry) {
+ return AnimatedListItem(
+ index: entry.key,
+ duration: itemDuration,
+ config: animConfig,
+ child: entry.value,
+ );
+ }).toList(),
+ );
+ }
+}
+
+class AnimatedGridView extends StatelessWidget {
+ final List children;
+ final int crossAxisCount;
+ final double spacing;
+ final double runSpacing;
+ final Duration? itemDuration;
+ final AnimationConfig? config;
+
+ const AnimatedGridView({
+ super.key,
+ required this.children,
+ this.crossAxisCount = 2,
+ this.spacing = 16.0,
+ this.runSpacing = 16.0,
+ this.itemDuration,
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+
+ return GridView.count(
+ crossAxisCount: crossAxisCount,
+ mainAxisSpacing: runSpacing,
+ crossAxisSpacing: spacing,
+ shrinkWrap: true,
+ physics: const NeverScrollableScrollPhysics(),
+ children: children.asMap().entries.map((entry) {
+ if (!animConfig.enabled) return entry.value;
+
+ return AnimatedListItem(
+ index: entry.key,
+ duration: itemDuration,
+ config: animConfig,
+ child: entry.value,
+ );
+ }).toList(),
+ );
+ }
+}
+
+class AnimatedButton extends StatefulWidget {
+ final Widget child;
+ final VoidCallback? onPressed;
+ final Duration? duration;
+ final double scale;
+ final AnimationConfig? config;
+
+ const AnimatedButton({
+ super.key,
+ required this.child,
+ this.onPressed,
+ this.duration,
+ this.scale = 0.95,
+ this.config,
+ });
+
+ @override
+ State createState() => _AnimatedButtonState();
+}
+
+class _AnimatedButtonState extends State
+ with SingleTickerProviderStateMixin {
+ late AnimationController _controller;
+ late Animation _scaleAnimation;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = AnimationController(
+ duration: widget.duration ?? const Duration(milliseconds: 100),
+ vsync: this,
+ );
+ _scaleAnimation = Tween(
+ begin: 1.0,
+ end: widget.scale,
+ ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));
+ }
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ void _onTapDown(TapDownDetails details) {
+ _controller.forward();
+ }
+
+ void _onTapUp(TapUpDetails details) {
+ _controller.reverse();
+ widget.onPressed?.call();
+ }
+
+ void _onTapCancel() {
+ _controller.reverse();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final config = widget.config ?? AnimationService.to.config;
+ if (!config.enabled) {
+ return GestureDetector(onTap: widget.onPressed, child: widget.child);
+ }
+
+ return GestureDetector(
+ onTapDown: _onTapDown,
+ onTapUp: _onTapUp,
+ onTapCancel: _onTapCancel,
+ child: ScaleTransition(scale: _scaleAnimation, child: widget.child),
+ );
+ }
+}
+
+class AnimatedCard extends StatefulWidget {
+ final Widget child;
+ final VoidCallback? onTap;
+ final Duration? duration;
+ final double elevation;
+ final Color? backgroundColor;
+ final BorderRadius? borderRadius;
+ final AnimationConfig? config;
+
+ const AnimatedCard({
+ super.key,
+ required this.child,
+ this.onTap,
+ this.duration,
+ this.elevation = 4.0,
+ this.backgroundColor,
+ this.borderRadius,
+ this.config,
+ });
+
+ @override
+ State createState() => _AnimatedCardState();
+}
+
+class _AnimatedCardState extends State
+ with SingleTickerProviderStateMixin {
+ late AnimationController _controller;
+ late Animation _scaleAnimation;
+ late Animation _elevationAnimation;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = AnimationController(
+ duration: widget.duration ?? const Duration(milliseconds: 150),
+ vsync: this,
+ );
+ _scaleAnimation = Tween(
+ begin: 1.0,
+ end: 0.98,
+ ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));
+ _elevationAnimation = Tween(
+ begin: widget.elevation,
+ end: 2.0,
+ ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));
+ }
+
+ @override
+ void dispose() {
+ _controller.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final config = widget.config ?? AnimationService.to.config;
+
+ return GestureDetector(
+ onTapDown: config.enabled ? (_) => _controller.forward() : null,
+ onTapUp: config.enabled ? (_) => _controller.reverse() : null,
+ onTapCancel: config.enabled ? () => _controller.reverse() : null,
+ onTap: widget.onTap,
+ child: AnimatedBuilder(
+ animation: _controller,
+ builder: (context, child) {
+ return Transform.scale(
+ scale: config.enabled ? _scaleAnimation.value : 1.0,
+ child: Material(
+ elevation: config.enabled
+ ? _elevationAnimation.value
+ : widget.elevation,
+ borderRadius: widget.borderRadius ?? BorderRadius.circular(12),
+ color: widget.backgroundColor,
+ child: child,
+ ),
+ );
+ },
+ child: widget.child,
+ ),
+ );
+ }
+}
+
+class FadeInWidget extends StatelessWidget {
+ final Widget child;
+ final Duration? duration;
+ final Offset? offset;
+ final AnimationConfig? config;
+
+ const FadeInWidget({
+ super.key,
+ required this.child,
+ this.duration,
+ this.offset,
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+ if (!animConfig.enabled) return child;
+
+ return TweenAnimationBuilder(
+ tween: Tween(begin: 0.0, end: 1.0),
+ duration: duration ?? animConfig.baseDuration,
+ curve: animConfig.curve,
+ builder: (context, value, child) {
+ final slideOffset = offset ?? const Offset(0, 20);
+ return Opacity(
+ opacity: value,
+ child: Transform.translate(
+ offset: Offset(
+ slideOffset.dx * (1 - value),
+ slideOffset.dy * (1 - value) * animConfig.intensity,
+ ),
+ child: child,
+ ),
+ );
+ },
+ child: child,
+ );
+ }
+}
+
+class SlideInWidget extends StatelessWidget {
+ final Widget child;
+ final Duration? duration;
+ final Offset beginOffset;
+ final AnimationConfig? config;
+
+ const SlideInWidget({
+ super.key,
+ required this.child,
+ this.duration,
+ this.beginOffset = const Offset(1.0, 0.0),
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+ if (!animConfig.enabled) return child;
+
+ return TweenAnimationBuilder(
+ tween: Tween(begin: beginOffset, end: Offset.zero),
+ duration: duration ?? animConfig.baseDuration,
+ curve: animConfig.curve,
+ builder: (context, value, child) {
+ return FractionalTranslation(translation: value, child: child);
+ },
+ child: child,
+ );
+ }
+}
+
+class ScaleInWidget extends StatelessWidget {
+ final Widget child;
+ final Duration? duration;
+ final double beginScale;
+ final AnimationConfig? config;
+
+ const ScaleInWidget({
+ super.key,
+ required this.child,
+ this.duration,
+ this.beginScale = 0.0,
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+ if (!animConfig.enabled) return child;
+
+ return TweenAnimationBuilder(
+ tween: Tween(begin: beginScale, end: 1.0),
+ duration: duration ?? animConfig.baseDuration,
+ curve: animConfig.curve,
+ builder: (context, value, child) {
+ return Transform.scale(
+ scale: value,
+ child: Opacity(opacity: value, child: child),
+ );
+ },
+ child: child,
+ );
+ }
+}
+
+class StaggeredAnimation extends StatelessWidget {
+ final List children;
+ final Duration? itemDelay;
+ final Duration? itemDuration;
+ final Axis direction;
+ final AnimationConfig? config;
+
+ const StaggeredAnimation({
+ super.key,
+ required this.children,
+ this.itemDelay,
+ this.itemDuration,
+ this.direction = Axis.vertical,
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+ if (!animConfig.enabled) {
+ return direction == Axis.vertical
+ ? Column(children: children)
+ : Row(children: children);
+ }
+
+ final delay =
+ itemDelay ?? Duration(milliseconds: (100 / animConfig.speed).round());
+ final duration = itemDuration ?? animConfig.baseDuration;
+
+ final animatedChildren = children.asMap().entries.map((entry) {
+ final index = entry.key;
+ final totalDelay = Duration(milliseconds: delay.inMilliseconds * index);
+
+ return TweenAnimationBuilder(
+ tween: Tween(begin: 0.0, end: 1.0),
+ duration: duration + totalDelay,
+ curve: animConfig.curve,
+ builder: (context, value, child) {
+ return Opacity(
+ opacity: value,
+ child: Transform.translate(
+ offset: direction == Axis.vertical
+ ? Offset(0, 30 * (1 - value) * animConfig.intensity)
+ : Offset(30 * (1 - value) * animConfig.intensity, 0),
+ child: child,
+ ),
+ );
+ },
+ child: entry.value,
+ );
+ }).toList();
+
+ return direction == Axis.vertical
+ ? Column(children: animatedChildren)
+ : Row(children: animatedChildren);
+ }
+}
+
+class OpenContainerWrapper extends StatelessWidget {
+ final Widget closedChild;
+ final Widget Function(BuildContext context, VoidCallback action) openBuilder;
+ final Color? closedColor;
+ final Color? openColor;
+ final double closedElevation;
+ final double openElevation;
+ final BorderRadius? closedBorderRadius;
+ final ShapeBorder? closedShape;
+ final AnimationConfig? config;
+
+ const OpenContainerWrapper({
+ super.key,
+ required this.closedChild,
+ required this.openBuilder,
+ this.closedColor,
+ this.openColor,
+ this.closedElevation = 0.0,
+ this.openElevation = 0.0,
+ this.closedBorderRadius,
+ this.closedShape,
+ this.config,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final animConfig = config ?? AnimationService.to.config;
+
+ return OpenContainer(
+ transitionDuration: animConfig.enabled
+ ? animConfig.baseDuration
+ : Duration.zero,
+ openBuilder: openBuilder,
+ closedElevation: closedElevation,
+ closedColor: closedColor ?? Colors.transparent,
+ openColor: openColor ?? Colors.transparent,
+ openElevation: openElevation,
+ closedShape:
+ closedShape ??
+ RoundedRectangleBorder(
+ borderRadius: closedBorderRadius ?? BorderRadius.circular(12),
+ ),
+ closedBuilder: (context, action) => closedChild,
+ );
+ }
+}
diff --git a/lib/src/services/api_service.dart b/lib/src/services/api_service.dart
new file mode 100644
index 0000000..31673e7
--- /dev/null
+++ b/lib/src/services/api_service.dart
@@ -0,0 +1,104 @@
+import 'package:dio/dio.dart';
+import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
+import 'package:connectivity_plus/connectivity_plus.dart';
+
+class ApiService {
+ static final ApiService _instance = ApiService._internal();
+ factory ApiService() => _instance;
+
+ late Dio _dio;
+
+ ApiService._internal() {
+ final options = BaseOptions(
+ baseUrl: 'https://api.example.com',
+ connectTimeout: const Duration(seconds: 10),
+ receiveTimeout: const Duration(seconds: 10),
+ );
+
+ _dio = Dio(options);
+
+ // 添加缓存拦截器
+ final cacheOptions = CacheOptions(
+ store: MemCacheStore(),
+ policy: CachePolicy.request,
+ hitCacheOnErrorExcept: [401, 403],
+ maxStale: const Duration(days: 7),
+ priority: CachePriority.normal,
+ cipher: null,
+ keyBuilder: CacheOptions.defaultCacheKeyBuilder,
+ allowPostMethod: false,
+ );
+
+ _dio.interceptors.add(DioCacheInterceptor(options: cacheOptions));
+
+ // 添加请求拦截器
+ _dio.interceptors.add(InterceptorsWrapper(
+ onRequest: (options, handler) {
+ // 可以在这里添加认证token等
+ return handler.next(options);
+ },
+ onResponse: (response, handler) {
+ return handler.next(response);
+ },
+ onError: (DioException e, handler) {
+ return handler.next(e);
+ },
+ ));
+ }
+
+ Future get(String path, {Map? queryParameters}) async {
+ try {
+ final connectivityResult = await Connectivity().checkConnectivity();
+ if (connectivityResult == ConnectivityResult.none) {
+ throw Exception('No internet connection');
+ }
+
+ final response = await _dio.get(path, queryParameters: queryParameters);
+ return response;
+ } catch (e) {
+ rethrow;
+ }
+ }
+
+ Future post(String path, {dynamic data, Map? queryParameters}) async {
+ try {
+ final connectivityResult = await Connectivity().checkConnectivity();
+ if (connectivityResult == ConnectivityResult.none) {
+ throw Exception('No internet connection');
+ }
+
+ final response = await _dio.post(path, data: data, queryParameters: queryParameters);
+ return response;
+ } catch (e) {
+ rethrow;
+ }
+ }
+
+ Future put(String path, {dynamic data, Map? queryParameters}) async {
+ try {
+ final connectivityResult = await Connectivity().checkConnectivity();
+ if (connectivityResult == ConnectivityResult.none) {
+ throw Exception('No internet connection');
+ }
+
+ final response = await _dio.put(path, data: data, queryParameters: queryParameters);
+ return response;
+ } catch (e) {
+ rethrow;
+ }
+ }
+
+ Future delete(String path, {Map? queryParameters}) async {
+ try {
+ final connectivityResult = await Connectivity().checkConnectivity();
+ if (connectivityResult == ConnectivityResult.none) {
+ throw Exception('No internet connection');
+ }
+
+ final response = await _dio.delete(path, queryParameters: queryParameters);
+ return response;
+ } catch (e) {
+ rethrow;
+ }
+ }
+}
\ No newline at end of file
diff --git a/lib/src/services/app_info_service.dart b/lib/src/services/app_info_service.dart
new file mode 100644
index 0000000..3a5affb
--- /dev/null
+++ b/lib/src/services/app_info_service.dart
@@ -0,0 +1,80 @@
+import 'package:package_info_plus/package_info_plus.dart';
+
+class AppInfoService {
+ static final AppInfoService _instance = AppInfoService._internal();
+ factory AppInfoService() => _instance;
+
+ AppInfoService._internal();
+
+ PackageInfo? _packageInfo;
+
+ // 初始化服务
+ Future init() async {
+ _packageInfo = await PackageInfo.fromPlatform();
+ }
+
+ // 获取应用名称
+ String get appName => _packageInfo?.appName ?? 'Mom\'s Kitchen';
+
+ // 获取包名
+ String get packageName =>
+ _packageInfo?.packageName ?? 'com.example.mom_kitchen';
+
+ // 获取版本号 (如 1.0.0)
+ String get version => _packageInfo?.version ?? '1.0.0';
+
+ // 获取构建号 (如 1)
+ String get buildNumber => _packageInfo?.buildNumber ?? '1';
+
+ // 获取完整版本信息 (如 1.0.0+1)
+ String get fullVersion => '$version+$buildNumber';
+
+ // 获取构建签名
+ String get buildSignature => _packageInfo?.buildSignature ?? '';
+
+ // 获取安装来源
+ String get installerStore => _packageInfo?.installerStore ?? '';
+
+ // 获取应用信息摘要
+ Map get appInfo => {
+ 'appName': appName,
+ 'packageName': packageName,
+ 'version': version,
+ 'buildNumber': buildNumber,
+ 'fullVersion': fullVersion,
+ 'buildSignature': buildSignature,
+ 'installerStore': installerStore,
+ };
+
+ // 获取应用信息字符串
+ String get appInfoString {
+ return '''
+App Name: $appName
+Package: $packageName
+Version: $fullVersion
+Build Signature: $buildSignature
+Installer: $installerStore
+'''
+ .trim();
+ }
+
+ // 比较版本号
+ int compareVersion(String version1, String version2) {
+ final v1 = version1.split('.').map(int.parse).toList();
+ final v2 = version2.split('.').map(int.parse).toList();
+
+ for (var i = 0; i < v1.length || i < v2.length; i++) {
+ final num1 = i < v1.length ? v1[i] : 0;
+ final num2 = i < v2.length ? v2[i] : 0;
+
+ if (num1 > num2) return 1;
+ if (num1 < num2) return -1;
+ }
+ return 0;
+ }
+
+ // 检查是否需要更新
+ bool needsUpdate(String latestVersion) {
+ return compareVersion(latestVersion, version) > 0;
+ }
+}
diff --git a/lib/src/services/app_service.dart b/lib/src/services/app_service.dart
new file mode 100644
index 0000000..c4d40b9
--- /dev/null
+++ b/lib/src/services/app_service.dart
@@ -0,0 +1,55 @@
+import 'package:mom_kitchen/src/services/api_service.dart';
+import 'package:mom_kitchen/src/services/storage_service.dart';
+import 'package:mom_kitchen/src/services/orientation_service.dart';
+import 'package:mom_kitchen/src/services/theme_service.dart';
+import 'package:mom_kitchen/src/services/notification_service.dart';
+import 'package:mom_kitchen/src/services/app_info_service.dart';
+import 'package:mom_kitchen/src/services/toast_service.dart';
+import 'package:mom_kitchen/src/services/permission_service.dart';
+import 'package:mom_kitchen/src/services/animation_service.dart';
+import 'package:mom_kitchen/src/services/logger_service.dart';
+import 'package:mom_kitchen/src/services/screen_util_config.dart';
+
+class AppService {
+ static final AppService _instance = AppService._internal();
+ factory AppService() => _instance;
+
+ late ApiService api;
+ late StorageService storage;
+ late OrientationService orientation;
+ late ThemeService theme;
+ late NotificationService notification;
+ late AppInfoService appInfo;
+ late ToastService toast;
+ late PermissionService permission;
+ late AnimationService animation;
+ late LoggerService logger;
+ late ScreenUtilConfig screenUtil;
+
+ AppService._internal() {
+ api = ApiService();
+ storage = StorageService();
+ orientation = OrientationService();
+ theme = ThemeService();
+ notification = NotificationService();
+ appInfo = AppInfoService();
+ toast = ToastService();
+ permission = PermissionService();
+ animation = AnimationService();
+ logger = LoggerService();
+ screenUtil = ScreenUtilConfig();
+ }
+
+ Future init() async {
+ await storage.init();
+ await theme.init();
+ await notification.init();
+ await appInfo.init();
+ await permission.init();
+ await animation.init();
+ await logger.init();
+ await screenUtil.init();
+ }
+
+ static AppService get instance => _instance;
+}
diff --git a/lib/src/services/logger_service.dart b/lib/src/services/logger_service.dart
new file mode 100644
index 0000000..44a4ad3
--- /dev/null
+++ b/lib/src/services/logger_service.dart
@@ -0,0 +1,297 @@
+import 'dart:convert';
+import 'dart:io';
+import 'package:flutter/foundation.dart';
+import 'package:logger/logger.dart';
+import 'package:path_provider/path_provider.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+
+enum LogLevel { debug, info, warning, error, off }
+
+class LoggerService {
+ static final LoggerService _instance = LoggerService._internal();
+ factory LoggerService() => _instance;
+ LoggerService._internal();
+
+ late Logger _logger;
+ late SharedPreferences _prefs;
+ late File? _logFile;
+
+ static const String _keyEnabled = 'logger_enabled';
+ static const String _keyLevel = 'logger_level';
+ static const String _keyWriteToFile = 'logger_write_to_file';
+ static const String _keyMaxFileSize = 'logger_max_file_size';
+ static const String _keyMaxFileCount = 'logger_max_file_count';
+
+ bool _enabled = true;
+ LogLevel _level = LogLevel.debug;
+ bool _writeToFile = false;
+ int _maxFileSize = 5 * 1024 * 1024;
+ int _maxFileCount = 5;
+
+ bool get enabled => _enabled;
+ LogLevel get level => _level;
+ bool get writeToFile => _writeToFile;
+ int get maxFileSize => _maxFileSize;
+ int get maxFileCount => _maxFileCount;
+
+ Future init() async {
+ _prefs = await SharedPreferences.getInstance();
+ await _loadConfig();
+ _initLogger();
+
+ if (_writeToFile && !kIsWeb) {
+ await _initLogFile();
+ }
+
+ return this;
+ }
+
+ Future _loadConfig() async {
+ _enabled = _prefs.getBool(_keyEnabled) ?? true;
+ _writeToFile = _prefs.getBool(_keyWriteToFile) ?? false;
+ _maxFileSize = _prefs.getInt(_keyMaxFileSize) ?? 5 * 1024 * 1024;
+ _maxFileCount = _prefs.getInt(_keyMaxFileCount) ?? 5;
+
+ final levelIndex = _prefs.getInt(_keyLevel) ?? 0;
+ _level = LogLevel.values[levelIndex.clamp(0, LogLevel.values.length - 1)];
+ }
+
+ Future _saveConfig() async {
+ await _prefs.setBool(_keyEnabled, _enabled);
+ await _prefs.setInt(_keyLevel, _level.index);
+ await _prefs.setBool(_keyWriteToFile, _writeToFile);
+ await _prefs.setInt(_keyMaxFileSize, _maxFileSize);
+ await _prefs.setInt(_keyMaxFileCount, _maxFileCount);
+ }
+
+ void _initLogger() {
+ Level loggerLevel;
+ switch (_level) {
+ case LogLevel.debug:
+ loggerLevel = Level.debug;
+ break;
+ case LogLevel.info:
+ loggerLevel = Level.info;
+ break;
+ case LogLevel.warning:
+ loggerLevel = Level.warning;
+ break;
+ case LogLevel.error:
+ loggerLevel = Level.error;
+ break;
+ case LogLevel.off:
+ loggerLevel = Level.off;
+ break;
+ }
+
+ _logger = Logger(
+ level: loggerLevel,
+ printer: PrettyPrinter(
+ methodCount: 2,
+ errorMethodCount: 8,
+ lineLength: 120,
+ colors: true,
+ printEmojis: true,
+ ),
+ output: _writeToFile && !kIsWeb && _logFile != null
+ ? MultiOutput([ConsoleOutput(), FileOutput(file: _logFile!)])
+ : null,
+ );
+ }
+
+ Future _initLogFile() async {
+ try {
+ final directory = await getApplicationDocumentsDirectory();
+ final logDir = Directory('${directory.path}/logs');
+
+ if (!await logDir.exists()) {
+ await logDir.create(recursive: true);
+ }
+
+ final now = DateTime.now();
+ final fileName =
+ 'log_${now.year}-${now.month.toString().padLeft(2, '0')}-${now.day.toString().padLeft(2, '0')}.txt';
+ _logFile = File('${logDir.path}/$fileName');
+
+ await _cleanOldLogs(logDir);
+
+ _initLogger();
+ } catch (e) {
+ debugPrint('Failed to init log file: $e');
+ _logFile = null;
+ }
+ }
+
+ Future _cleanOldLogs(Directory logDir) async {
+ try {
+ final files = await logDir.list().toList();
+ final logFiles = files
+ .whereType()
+ .where((f) => f.path.endsWith('.txt'))
+ .toList();
+
+ logFiles.sort((a, b) => b.path.compareTo(a.path));
+
+ for (var i = _maxFileCount; i < logFiles.length; i++) {
+ await logFiles[i].delete();
+ }
+
+ for (var file in logFiles) {
+ final size = await file.length();
+ if (size > _maxFileSize) {
+ await file.delete();
+ }
+ }
+ } catch (e) {
+ debugPrint('Failed to clean old logs: $e');
+ }
+ }
+
+ Future setEnabled(bool enabled) async {
+ _enabled = enabled;
+ await _saveConfig();
+ }
+
+ Future setLevel(LogLevel level) async {
+ _level = level;
+ await _saveConfig();
+ _initLogger();
+ }
+
+ Future setWriteToFile(bool writeToFile) async {
+ _writeToFile = writeToFile;
+ await _saveConfig();
+
+ if (writeToFile && !kIsWeb) {
+ await _initLogFile();
+ } else {
+ _logFile = null;
+ _initLogger();
+ }
+ }
+
+ Future setMaxFileSize(int maxSize) async {
+ _maxFileSize = maxSize;
+ await _saveConfig();
+ }
+
+ Future setMaxFileCount(int count) async {
+ _maxFileCount = count;
+ await _saveConfig();
+ }
+
+ void debug(dynamic message, [dynamic error, StackTrace? stackTrace]) {
+ if (!_enabled) return;
+ _logger.d(message, error: error, stackTrace: stackTrace);
+ }
+
+ void info(dynamic message, [dynamic error, StackTrace? stackTrace]) {
+ if (!_enabled) return;
+ _logger.i(message, error: error, stackTrace: stackTrace);
+ }
+
+ void warning(dynamic message, [dynamic error, StackTrace? stackTrace]) {
+ if (!_enabled) return;
+ _logger.w(message, error: error, stackTrace: stackTrace);
+ }
+
+ void error(dynamic message, [dynamic error, StackTrace? stackTrace]) {
+ if (!_enabled) return;
+ _logger.e(message, error: error, stackTrace: stackTrace);
+ }
+
+ void log(
+ Level level,
+ dynamic message, [
+ dynamic error,
+ StackTrace? stackTrace,
+ ]) {
+ if (!_enabled) return;
+ _logger.log(level, message, error: error, stackTrace: stackTrace);
+ }
+
+ Future getLogContent() async {
+ if (_logFile == null || !await _logFile!.exists()) {
+ return null;
+ }
+ return await _logFile!.readAsString();
+ }
+
+ Future> getLogFiles() async {
+ if (kIsWeb) return [];
+
+ try {
+ final directory = await getApplicationDocumentsDirectory();
+ final logDir = Directory('${directory.path}/logs');
+
+ if (!await logDir.exists()) {
+ return [];
+ }
+
+ final files = await logDir.list().toList();
+ return files
+ .whereType()
+ .where((f) => f.path.endsWith('.txt'))
+ .map((f) => f.path)
+ .toList();
+ } catch (e) {
+ return [];
+ }
+ }
+
+ Future clearLogs() async {
+ if (kIsWeb) return;
+
+ try {
+ final directory = await getApplicationDocumentsDirectory();
+ final logDir = Directory('${directory.path}/logs');
+
+ if (await logDir.exists()) {
+ await logDir.delete(recursive: true);
+ }
+
+ if (_writeToFile) {
+ await _initLogFile();
+ }
+ } catch (e) {
+ debugPrint('Failed to clear logs: $e');
+ }
+ }
+
+ void dispose() {
+ _logger.close();
+ }
+}
+
+class FileOutput extends LogOutput {
+ final File file;
+ final bool overrideExisting;
+ final Encoding encoding;
+ IOSink? _sink;
+
+ FileOutput({
+ required this.file,
+ this.overrideExisting = false,
+ this.encoding = utf8,
+ });
+
+ @override
+ Future init() async {
+ _sink = file.openWrite(
+ mode: overrideExisting ? FileMode.writeOnly : FileMode.writeOnlyAppend,
+ encoding: encoding,
+ );
+ }
+
+ @override
+ void output(OutputEvent event) {
+ _sink?.writeAll(event.lines.map((line) => '$line\n'));
+ _sink?.flush();
+ }
+
+ @override
+ Future destroy() async {
+ await _sink?.flush();
+ await _sink?.close();
+ }
+}
diff --git a/lib/src/services/notification_service.dart b/lib/src/services/notification_service.dart
new file mode 100644
index 0000000..06504ed
--- /dev/null
+++ b/lib/src/services/notification_service.dart
@@ -0,0 +1,238 @@
+import 'package:flutter/foundation.dart';
+import 'package:flutter_local_notifications/flutter_local_notifications.dart';
+
+class NotificationService {
+ static final NotificationService _instance = NotificationService._internal();
+ factory NotificationService() => _instance;
+
+ NotificationService._internal();
+
+ final FlutterLocalNotificationsPlugin _notifications =
+ FlutterLocalNotificationsPlugin();
+
+ // 初始化通知服务
+ Future init() async {
+ const androidSettings = AndroidInitializationSettings(
+ '@mipmap/ic_launcher',
+ );
+ const iosSettings = DarwinInitializationSettings(
+ requestAlertPermission: true,
+ requestBadgePermission: true,
+ requestSoundPermission: true,
+ );
+
+ const initSettings = InitializationSettings(
+ android: androidSettings,
+ iOS: iosSettings,
+ );
+
+ await _notifications.initialize(
+ initSettings,
+ onDidReceiveNotificationResponse: _onNotificationTapped,
+ );
+ }
+
+ // 通知点击回调
+ void _onNotificationTapped(NotificationResponse response) {
+ debugPrint('Notification tapped: ${response.payload}');
+ }
+
+ // 请求通知权限
+ Future requestPermission() async {
+ if (defaultTargetPlatform == TargetPlatform.android) {
+ final androidPlugin = _notifications
+ .resolvePlatformSpecificImplementation<
+ AndroidFlutterLocalNotificationsPlugin
+ >();
+ return await androidPlugin?.requestNotificationsPermission() ?? false;
+ } else if (defaultTargetPlatform == TargetPlatform.iOS) {
+ final iosPlugin = _notifications
+ .resolvePlatformSpecificImplementation<
+ IOSFlutterLocalNotificationsPlugin
+ >();
+ return await iosPlugin?.requestPermissions(
+ alert: true,
+ badge: true,
+ sound: true,
+ ) ??
+ false;
+ }
+ return false;
+ }
+
+ // 显示普通通知
+ Future showNotification({
+ required int id,
+ required String title,
+ required String body,
+ String? payload,
+ }) async {
+ const androidDetails = AndroidNotificationDetails(
+ 'default_channel',
+ 'Default Channel',
+ channelDescription: 'Default notification channel',
+ importance: Importance.high,
+ priority: Priority.high,
+ );
+
+ const iosDetails = DarwinNotificationDetails(
+ presentAlert: true,
+ presentBadge: true,
+ presentSound: true,
+ );
+
+ const details = NotificationDetails(
+ android: androidDetails,
+ iOS: iosDetails,
+ );
+
+ await _notifications.show(id, title, body, details, payload: payload);
+ }
+
+ // 显示定时通知(简化版本)
+ Future scheduleNotification({
+ required int id,
+ required String title,
+ required String body,
+ required Duration delay,
+ String? payload,
+ }) async {
+ const androidDetails = AndroidNotificationDetails(
+ 'scheduled_channel',
+ 'Scheduled Channel',
+ channelDescription: 'Scheduled notification channel',
+ importance: Importance.high,
+ priority: Priority.high,
+ );
+
+ const iosDetails = DarwinNotificationDetails(
+ presentAlert: true,
+ presentBadge: true,
+ presentSound: true,
+ );
+
+ const details = NotificationDetails(
+ android: androidDetails,
+ iOS: iosDetails,
+ );
+
+ await _notifications.show(id, title, body, details, payload: payload);
+ }
+
+ // 取消指定通知
+ Future cancelNotification(int id) async {
+ await _notifications.cancel(id);
+ }
+
+ // 取消所有通知
+ Future cancelAllNotifications() async {
+ await _notifications.cancelAll();
+ }
+
+ // 获取待处理通知列表
+ Future> getPendingNotifications() async {
+ return await _notifications.pendingNotificationRequests();
+ }
+
+ // 显示进度通知
+ Future showProgressNotification({
+ required int id,
+ required String title,
+ required String body,
+ required int progress,
+ int maxProgress = 100,
+ }) async {
+ final androidDetails = AndroidNotificationDetails(
+ 'progress_channel',
+ 'Progress Channel',
+ channelDescription: 'Progress notification channel',
+ importance: Importance.high,
+ priority: Priority.high,
+ showProgress: true,
+ maxProgress: maxProgress,
+ progress: progress,
+ indeterminate: false,
+ );
+
+ const iosDetails = DarwinNotificationDetails(
+ presentAlert: true,
+ presentBadge: true,
+ presentSound: true,
+ );
+
+ final details = NotificationDetails(
+ android: androidDetails,
+ iOS: iosDetails,
+ );
+
+ await _notifications.show(id, title, body, details);
+ }
+
+ // 显示大文本通知
+ Future showBigTextNotification({
+ required int id,
+ required String title,
+ required String body,
+ required String bigText,
+ String? payload,
+ }) async {
+ final androidDetails = AndroidNotificationDetails(
+ 'big_text_channel',
+ 'Big Text Channel',
+ channelDescription: 'Big text notification channel',
+ importance: Importance.high,
+ priority: Priority.high,
+ styleInformation: BigTextStyleInformation(bigText),
+ );
+
+ const iosDetails = DarwinNotificationDetails(
+ presentAlert: true,
+ presentBadge: true,
+ presentSound: true,
+ );
+
+ final details = NotificationDetails(
+ android: androidDetails,
+ iOS: iosDetails,
+ );
+
+ await _notifications.show(id, title, body, details, payload: payload);
+ }
+
+ // 显示图片通知
+ Future showImageNotification({
+ required int id,
+ required String title,
+ required String body,
+ required String imageUrl,
+ String? payload,
+ }) async {
+ final androidDetails = AndroidNotificationDetails(
+ 'image_channel',
+ 'Image Channel',
+ channelDescription: 'Image notification channel',
+ importance: Importance.high,
+ priority: Priority.high,
+ styleInformation: BigPictureStyleInformation(
+ FilePathAndroidBitmap(imageUrl),
+ largeIcon: FilePathAndroidBitmap(imageUrl),
+ contentTitle: title,
+ summaryText: body,
+ ),
+ );
+
+ const iosDetails = DarwinNotificationDetails(
+ presentAlert: true,
+ presentBadge: true,
+ presentSound: true,
+ attachments: [],
+ );
+
+ final details = NotificationDetails(
+ android: androidDetails,
+ iOS: iosDetails,
+ );
+
+ await _notifications.show(id, title, body, details, payload: payload);
+ }
+}
diff --git a/lib/src/services/orientation_service.dart b/lib/src/services/orientation_service.dart
new file mode 100644
index 0000000..ba42730
--- /dev/null
+++ b/lib/src/services/orientation_service.dart
@@ -0,0 +1,39 @@
+import 'package:flutter/services.dart';
+
+class OrientationService {
+ static final OrientationService _instance = OrientationService._internal();
+ factory OrientationService() => _instance;
+
+ OrientationService._internal();
+
+ // 锁定为竖屏
+ Future lockPortrait() async {
+ await SystemChrome.setPreferredOrientations([
+ DeviceOrientation.portraitUp,
+ DeviceOrientation.portraitDown,
+ ]);
+ }
+
+ // 锁定为横屏
+ Future lockLandscape() async {
+ await SystemChrome.setPreferredOrientations([
+ DeviceOrientation.landscapeLeft,
+ DeviceOrientation.landscapeRight,
+ ]);
+ }
+
+ // 解锁屏幕方向
+ Future unlockOrientation() async {
+ await SystemChrome.setPreferredOrientations([
+ DeviceOrientation.portraitUp,
+ DeviceOrientation.portraitDown,
+ DeviceOrientation.landscapeLeft,
+ DeviceOrientation.landscapeRight,
+ ]);
+ }
+
+ // 设置特定方向
+ Future setOrientation(DeviceOrientation orientation) async {
+ await SystemChrome.setPreferredOrientations([orientation]);
+ }
+}
diff --git a/lib/src/services/permission_service.dart b/lib/src/services/permission_service.dart
new file mode 100644
index 0000000..71a9477
--- /dev/null
+++ b/lib/src/services/permission_service.dart
@@ -0,0 +1,507 @@
+import 'dart:convert';
+import 'package:flutter/foundation.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+import 'package:permission_handler/permission_handler.dart';
+
+enum PermissionType {
+ camera, // 相机
+ microphone, // 麦克风
+ photos, // 相册
+ location, // 位置
+ storage, // 存储
+ contacts, // 通讯录
+ calendar, // 日历
+ phone, // 电话
+ sms, // 短信
+ notification, // 通知
+ bluetooth, // 蓝牙
+ clipboard, // 剪切板
+ network, // 网络
+ vibrate, // 震动
+ screen, // 屏幕
+}
+
+enum PermissionStatusType {
+ granted, // 已授权
+ denied, // 已拒绝
+ restricted, // 受限制
+ limited, // 有限制
+ permanentlyDenied, // 永久拒绝
+ provisional, // 临时授权
+ unknown, // 未知
+ notApplicable, // 不适用(该平台无需此权限)
+}
+
+class PermissionStatusInfo {
+ final PermissionType type;
+ final PermissionStatusType status;
+ final DateTime lastChecked;
+ final bool isPermanentlyDenied;
+ final String? platformNote;
+
+ PermissionStatusInfo({
+ required this.type,
+ required this.status,
+ required this.lastChecked,
+ this.isPermanentlyDenied = false,
+ this.platformNote,
+ });
+
+ Map toJson() {
+ return {
+ 'type': type.name,
+ 'status': status.name,
+ 'lastChecked': lastChecked.toIso8601String(),
+ 'isPermanentlyDenied': isPermanentlyDenied,
+ 'platformNote': platformNote,
+ };
+ }
+
+ factory PermissionStatusInfo.fromJson(Map json) {
+ return PermissionStatusInfo(
+ type: PermissionType.values.firstWhere((e) => e.name == json['type']),
+ status: PermissionStatusType.values.firstWhere(
+ (e) => e.name == json['status'],
+ ),
+ lastChecked: DateTime.parse(json['lastChecked']),
+ isPermanentlyDenied: json['isPermanentlyDenied'] ?? false,
+ platformNote: json['platformNote'],
+ );
+ }
+}
+
+class PermissionService {
+ static final PermissionService _instance = PermissionService._internal();
+ factory PermissionService() => _instance;
+
+ PermissionService._internal();
+
+ SharedPreferences? _prefs;
+ final Map _permissionCache = {};
+
+ static const String _cacheKey = 'permission_status_cache';
+
+ // 初始化服务
+ Future init() async {
+ _prefs = await SharedPreferences.getInstance();
+ await _loadCachedPermissions();
+ }
+
+ // 加载缓存的权限状态
+ Future _loadCachedPermissions() async {
+ final cacheString = _prefs?.getString(_cacheKey);
+ if (cacheString != null) {
+ try {
+ final cacheMap = json.decode(cacheString) as Map;
+ cacheMap.forEach((key, value) {
+ final type = PermissionType.values.firstWhere((e) => e.name == key);
+ _permissionCache[type] = PermissionStatusInfo.fromJson(
+ value as Map,
+ );
+ });
+ } catch (e) {
+ debugPrint('Failed to load permission cache: $e');
+ }
+ }
+ }
+
+ // 保存权限状态到缓存
+ Future _saveCachedPermissions() async {
+ final cacheMap = {};
+ _permissionCache.forEach((key, value) {
+ cacheMap[key.name] = value.toJson();
+ });
+ await _prefs?.setString(_cacheKey, json.encode(cacheMap));
+ }
+
+ // 获取权限对应的 Permission 对象
+ Permission? _getPermission(PermissionType type) {
+ switch (type) {
+ case PermissionType.camera:
+ return Permission.camera;
+ case PermissionType.microphone:
+ return Permission.microphone;
+ case PermissionType.photos:
+ return Permission.photos;
+ case PermissionType.location:
+ return Permission.location;
+ case PermissionType.storage:
+ return Permission.storage;
+ case PermissionType.contacts:
+ return Permission.contacts;
+ case PermissionType.calendar:
+ return Permission.calendarFullAccess;
+ case PermissionType.phone:
+ return Permission.phone;
+ case PermissionType.sms:
+ return Permission.sms;
+ case PermissionType.notification:
+ return Permission.notification;
+ case PermissionType.bluetooth:
+ return Permission.bluetooth;
+ case PermissionType.clipboard:
+ case PermissionType.network:
+ case PermissionType.vibrate:
+ case PermissionType.screen:
+ return null;
+ }
+ }
+
+ // 检查平台是否需要此权限
+ bool _isPermissionRequiredOnPlatform(PermissionType type) {
+ if (defaultTargetPlatform == TargetPlatform.iOS) {
+ switch (type) {
+ case PermissionType.clipboard:
+ return false;
+ case PermissionType.network:
+ return false;
+ case PermissionType.vibrate:
+ return false;
+ case PermissionType.screen:
+ return false;
+ default:
+ return true;
+ }
+ } else if (defaultTargetPlatform == TargetPlatform.android) {
+ switch (type) {
+ case PermissionType.clipboard:
+ return true;
+ case PermissionType.network:
+ return false;
+ case PermissionType.vibrate:
+ return false;
+ case PermissionType.screen:
+ return true;
+ default:
+ return true;
+ }
+ }
+ return false;
+ }
+
+ // 获取平台说明
+ String _getPlatformNote(PermissionType type) {
+ if (defaultTargetPlatform == TargetPlatform.iOS) {
+ switch (type) {
+ case PermissionType.clipboard:
+ return 'iOS 无需申请剪切板权限';
+ case PermissionType.network:
+ return 'iOS 无需申请网络权限';
+ case PermissionType.vibrate:
+ return 'iOS 无需申请震动权限';
+ case PermissionType.screen:
+ return 'iOS 无需申请屏幕权限';
+ default:
+ return '';
+ }
+ } else if (defaultTargetPlatform == TargetPlatform.android) {
+ switch (type) {
+ case PermissionType.clipboard:
+ return 'Android 10+ 需要申请剪切板权限';
+ case PermissionType.network:
+ return 'Android 无需申请网络权限';
+ case PermissionType.vibrate:
+ return 'Android 无需申请震动权限';
+ case PermissionType.screen:
+ return 'Android 需要申请屏幕相关权限';
+ default:
+ return '';
+ }
+ }
+ return '';
+ }
+
+ // 转换权限状态
+ PermissionStatusType _convertStatus(PermissionStatus status) {
+ return switch (status) {
+ PermissionStatus.granted => PermissionStatusType.granted,
+ PermissionStatus.denied => PermissionStatusType.denied,
+ PermissionStatus.restricted => PermissionStatusType.restricted,
+ PermissionStatus.limited => PermissionStatusType.limited,
+ PermissionStatus.permanentlyDenied =>
+ PermissionStatusType.permanentlyDenied,
+ PermissionStatus.provisional => PermissionStatusType.provisional,
+ };
+ }
+
+ // 检查单个权限状态
+ Future checkPermission(PermissionType type) async {
+ final isRequired = _isPermissionRequiredOnPlatform(type);
+
+ if (!isRequired) {
+ final info = PermissionStatusInfo(
+ type: type,
+ status: PermissionStatusType.notApplicable,
+ lastChecked: DateTime.now(),
+ platformNote: _getPlatformNote(type),
+ );
+ _permissionCache[type] = info;
+ await _saveCachedPermissions();
+ return info;
+ }
+
+ final permission = _getPermission(type);
+ if (permission == null) {
+ final info = PermissionStatusInfo(
+ type: type,
+ status: PermissionStatusType.notApplicable,
+ lastChecked: DateTime.now(),
+ platformNote: _getPlatformNote(type),
+ );
+ _permissionCache[type] = info;
+ await _saveCachedPermissions();
+ return info;
+ }
+
+ final status = await permission.status;
+ final isPermanentlyDenied = await permission.isPermanentlyDenied;
+
+ final info = PermissionStatusInfo(
+ type: type,
+ status: _convertStatus(status),
+ lastChecked: DateTime.now(),
+ isPermanentlyDenied: isPermanentlyDenied,
+ platformNote: _getPlatformNote(type),
+ );
+
+ _permissionCache[type] = info;
+ await _saveCachedPermissions();
+
+ return info;
+ }
+
+ // 检查多个权限状态
+ Future> checkPermissions(
+ List types,
+ ) async {
+ final results = {};
+
+ for (final type in types) {
+ results[type] = await checkPermission(type);
+ }
+
+ return results;
+ }
+
+ // 请求单个权限
+ Future requestPermission(PermissionType type) async {
+ final isRequired = _isPermissionRequiredOnPlatform(type);
+
+ if (!isRequired) {
+ final info = PermissionStatusInfo(
+ type: type,
+ status: PermissionStatusType.notApplicable,
+ lastChecked: DateTime.now(),
+ platformNote: _getPlatformNote(type),
+ );
+ _permissionCache[type] = info;
+ await _saveCachedPermissions();
+ return info;
+ }
+
+ final permission = _getPermission(type);
+ if (permission == null) {
+ final info = PermissionStatusInfo(
+ type: type,
+ status: PermissionStatusType.notApplicable,
+ lastChecked: DateTime.now(),
+ platformNote: _getPlatformNote(type),
+ );
+ _permissionCache[type] = info;
+ await _saveCachedPermissions();
+ return info;
+ }
+
+ final status = await permission.request();
+ final isPermanentlyDenied = await permission.isPermanentlyDenied;
+
+ final info = PermissionStatusInfo(
+ type: type,
+ status: _convertStatus(status),
+ lastChecked: DateTime.now(),
+ isPermanentlyDenied: isPermanentlyDenied,
+ platformNote: _getPlatformNote(type),
+ );
+
+ _permissionCache[type] = info;
+ await _saveCachedPermissions();
+
+ return info;
+ }
+
+ // 请求多个权限
+ Future> requestPermissions(
+ List types,
+ ) async {
+ final results = {};
+
+ for (final type in types) {
+ results[type] = await requestPermission(type);
+ }
+
+ return results;
+ }
+
+ // 获取缓存的权限状态
+ PermissionStatusInfo? getCachedPermission(PermissionType type) {
+ return _permissionCache[type];
+ }
+
+ // 获取所有缓存的权限状态
+ Map getAllCachedPermissions() {
+ return Map.from(_permissionCache);
+ }
+
+ // 检查权限是否已授予
+ Future isGranted(PermissionType type) async {
+ final info = await checkPermission(type);
+ return info.status == PermissionStatusType.granted ||
+ info.status == PermissionStatusType.notApplicable;
+ }
+
+ // 检查权限是否被拒绝
+ Future isDenied(PermissionType type) async {
+ final info = await checkPermission(type);
+ return info.status == PermissionStatusType.denied;
+ }
+
+ // 检查权限是否被永久拒绝
+ Future isPermanentlyDenied(PermissionType type) async {
+ final info = await checkPermission(type);
+ return info.isPermanentlyDenied;
+ }
+
+ // 打开应用设置
+ Future openSettings() async {
+ return await openAppSettings();
+ }
+
+ // 获取权限状态描述
+ String getStatusDescription(PermissionStatusType status) {
+ switch (status) {
+ case PermissionStatusType.granted:
+ return '已授权';
+ case PermissionStatusType.denied:
+ return '已拒绝';
+ case PermissionStatusType.restricted:
+ return '受限制';
+ case PermissionStatusType.limited:
+ return '有限制';
+ case PermissionStatusType.permanentlyDenied:
+ return '永久拒绝';
+ case PermissionStatusType.provisional:
+ return '临时授权';
+ case PermissionStatusType.notApplicable:
+ return '无需申请';
+ default:
+ return '未知';
+ }
+ }
+
+ // 获取权限名称
+ String getPermissionName(PermissionType type) {
+ switch (type) {
+ case PermissionType.camera:
+ return '相机';
+ case PermissionType.microphone:
+ return '麦克风';
+ case PermissionType.photos:
+ return '相册';
+ case PermissionType.location:
+ return '位置';
+ case PermissionType.storage:
+ return '存储';
+ case PermissionType.contacts:
+ return '通讯录';
+ case PermissionType.calendar:
+ return '日历';
+ case PermissionType.phone:
+ return '电话';
+ case PermissionType.sms:
+ return '短信';
+ case PermissionType.notification:
+ return '通知';
+ case PermissionType.bluetooth:
+ return '蓝牙';
+ case PermissionType.clipboard:
+ return '剪切板';
+ case PermissionType.network:
+ return '网络';
+ case PermissionType.vibrate:
+ return '震动';
+ case PermissionType.screen:
+ return '屏幕';
+ }
+ }
+
+ // 获取权限图标
+ String getPermissionIcon(PermissionType type) {
+ switch (type) {
+ case PermissionType.camera:
+ return '📷';
+ case PermissionType.microphone:
+ return '🎤';
+ case PermissionType.photos:
+ return '🖼️';
+ case PermissionType.location:
+ return '📍';
+ case PermissionType.storage:
+ return '💾';
+ case PermissionType.contacts:
+ return '👥';
+ case PermissionType.calendar:
+ return '📅';
+ case PermissionType.phone:
+ return '📞';
+ case PermissionType.sms:
+ return '💬';
+ case PermissionType.notification:
+ return '🔔';
+ case PermissionType.bluetooth:
+ return '📶';
+ case PermissionType.clipboard:
+ return '📋';
+ case PermissionType.network:
+ return '🌐';
+ case PermissionType.vibrate:
+ return '📳';
+ case PermissionType.screen:
+ return '🖥️';
+ }
+ }
+
+ // 清除权限缓存
+ Future clearCache() async {
+ _permissionCache.clear();
+ await _prefs?.remove(_cacheKey);
+ }
+
+ // 获取权限摘要
+ Map getPermissionSummary() {
+ final granted = [];
+ final denied = [];
+ final permanentlyDenied = [];
+ final notApplicable = [];
+
+ _permissionCache.forEach((type, info) {
+ final name = getPermissionName(type);
+ if (info.status == PermissionStatusType.granted) {
+ granted.add(name);
+ } else if (info.status == PermissionStatusType.notApplicable) {
+ notApplicable.add(name);
+ } else if (info.isPermanentlyDenied) {
+ permanentlyDenied.add(name);
+ } else {
+ denied.add(name);
+ }
+ });
+
+ return {
+ 'granted': granted,
+ 'denied': denied,
+ 'permanentlyDenied': permanentlyDenied,
+ 'notApplicable': notApplicable,
+ 'total': _permissionCache.length,
+ };
+ }
+}
diff --git a/lib/src/services/screen_util_config.dart b/lib/src/services/screen_util_config.dart
new file mode 100644
index 0000000..bbe9d47
--- /dev/null
+++ b/lib/src/services/screen_util_config.dart
@@ -0,0 +1,178 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+
+class ScreenUtilConfig {
+ static final ScreenUtilConfig _instance = ScreenUtilConfig._internal();
+ factory ScreenUtilConfig() => _instance;
+ ScreenUtilConfig._internal();
+
+ static const Size _defaultDesignSize = Size(375, 812);
+ static const bool _defaultMinTextAdapt = true;
+ static const bool _defaultSplitScreenMode = true;
+ static const bool _defaultScaleEnabled = true;
+
+ late SharedPreferences _prefs;
+
+ static const String _keyDesignWidth = 'screenutil_design_width';
+ static const String _keyDesignHeight = 'screenutil_design_height';
+ static const String _keyMinTextAdapt = 'screenutil_min_text_adapt';
+ static const String _keySplitScreenMode = 'screenutil_split_screen_mode';
+ static const String _keyScaleEnabled = 'screenutil_scale_enabled';
+
+ Size _designSize = _defaultDesignSize;
+ bool _minTextAdapt = _defaultMinTextAdapt;
+ bool _splitScreenMode = _defaultSplitScreenMode;
+ bool _scaleEnabled = _defaultScaleEnabled;
+
+ Size get designSize => _designSize;
+ bool get minTextAdapt => _minTextAdapt;
+ bool get splitScreenMode => _splitScreenMode;
+ bool get scaleEnabled => _scaleEnabled;
+
+ double get designWidth => _designSize.width;
+ double get designHeight => _designSize.height;
+
+ Future init() async {
+ _prefs = await SharedPreferences.getInstance();
+ await _loadConfig();
+ _applyConfig();
+ return this;
+ }
+
+ Future _loadConfig() async {
+ final width = _prefs.getDouble(_keyDesignWidth) ?? _defaultDesignSize.width;
+ final height = _prefs.getDouble(_keyDesignHeight) ?? _defaultDesignSize.height;
+ _designSize = Size(width, height);
+
+ _minTextAdapt = _prefs.getBool(_keyMinTextAdapt) ?? _defaultMinTextAdapt;
+ _splitScreenMode = _prefs.getBool(_keySplitScreenMode) ?? _defaultSplitScreenMode;
+ _scaleEnabled = _prefs.getBool(_keyScaleEnabled) ?? _defaultScaleEnabled;
+ }
+
+ Future _saveConfig() async {
+ await _prefs.setDouble(_keyDesignWidth, _designSize.width);
+ await _prefs.setDouble(_keyDesignHeight, _designSize.height);
+ await _prefs.setBool(_keyMinTextAdapt, _minTextAdapt);
+ await _prefs.setBool(_keySplitScreenMode, _splitScreenMode);
+ await _prefs.setBool(_keyScaleEnabled, _scaleEnabled);
+ }
+
+ void _applyConfig() {
+ if (_scaleEnabled) {
+ ScreenUtil.enableScale(
+ enableWH: () => true,
+ enableText: () => true,
+ );
+ } else {
+ ScreenUtil.enableScale(
+ enableWH: () => false,
+ enableText: () => false,
+ );
+ }
+ }
+
+ Future setDesignSize(Size size) async {
+ _designSize = size;
+ await _saveConfig();
+ }
+
+ Future setDesignWidth(double width) async {
+ _designSize = Size(width, _designSize.height);
+ await _saveConfig();
+ }
+
+ Future setDesignHeight(double height) async {
+ _designSize = Size(_designSize.width, height);
+ await _saveConfig();
+ }
+
+ Future setMinTextAdapt(bool adapt) async {
+ _minTextAdapt = adapt;
+ await _saveConfig();
+ }
+
+ Future setSplitScreenMode(bool mode) async {
+ _splitScreenMode = mode;
+ await _saveConfig();
+ }
+
+ Future setScaleEnabled(bool enabled) async {
+ _scaleEnabled = enabled;
+ await _saveConfig();
+ _applyConfig();
+ }
+
+ Future resetToDefault() async {
+ _designSize = _defaultDesignSize;
+ _minTextAdapt = _defaultMinTextAdapt;
+ _splitScreenMode = _defaultSplitScreenMode;
+ _scaleEnabled = _defaultScaleEnabled;
+ await _saveConfig();
+ _applyConfig();
+ }
+
+ void initScreenUtil(BuildContext context) {
+ ScreenUtil.init(
+ context,
+ designSize: _designSize,
+ minTextAdapt: _minTextAdapt,
+ splitScreenMode: _splitScreenMode,
+ );
+ }
+
+ Future ensureScreenSizeAndInit(BuildContext context) async {
+ await ScreenUtil.ensureScreenSizeAndInit(
+ context,
+ designSize: _designSize,
+ minTextAdapt: _minTextAdapt,
+ splitScreenMode: _splitScreenMode,
+ );
+ }
+
+ Map toMap() {
+ return {
+ 'designWidth': designWidth,
+ 'designHeight': designHeight,
+ 'minTextAdapt': _minTextAdapt,
+ 'splitScreenMode': _splitScreenMode,
+ 'scaleEnabled': _scaleEnabled,
+ };
+ }
+
+ @override
+ String toString() {
+ return 'ScreenUtilConfig(designSize: $_designSize, minTextAdapt: $_minTextAdapt, splitScreenMode: $_splitScreenMode, scaleEnabled: $_scaleEnabled)';
+ }
+}
+
+extension ScreenUtilExtension on num {
+ double get w {
+ final config = ScreenUtilConfig();
+ if (!config.scaleEnabled) return toDouble();
+ return ScreenUtil().setWidth(this);
+ }
+
+ double get h {
+ final config = ScreenUtilConfig();
+ if (!config.scaleEnabled) return toDouble();
+ return ScreenUtil().setHeight(this);
+ }
+
+ double get sp {
+ final config = ScreenUtilConfig();
+ if (!config.scaleEnabled) return toDouble();
+ return ScreenUtil().setSp(this);
+ }
+
+ double get r {
+ final config = ScreenUtilConfig();
+ if (!config.scaleEnabled) return toDouble();
+ return ScreenUtil().radius(this);
+ }
+
+ double get sw => ScreenUtil().screenWidth;
+ double get sh => ScreenUtil().screenHeight;
+ double get statusBarHeight => ScreenUtil().statusBarHeight;
+ double get bottomBarHeight => ScreenUtil().bottomBarHeight;
+}
diff --git a/lib/src/services/storage_service.dart b/lib/src/services/storage_service.dart
new file mode 100644
index 0000000..2b6fbe3
--- /dev/null
+++ b/lib/src/services/storage_service.dart
@@ -0,0 +1,66 @@
+import 'package:shared_preferences/shared_preferences.dart';
+
+class StorageService {
+ static final StorageService _instance = StorageService._internal();
+ factory StorageService() => _instance;
+
+ late SharedPreferences _prefs;
+
+ StorageService._internal();
+
+ Future init() async {
+ _prefs = await SharedPreferences.getInstance();
+ }
+
+ Future setString(String key, String value) async {
+ await _prefs.setString(key, value);
+ }
+
+ String? getString(String key) {
+ return _prefs.getString(key);
+ }
+
+ Future setInt(String key, int value) async {
+ await _prefs.setInt(key, value);
+ }
+
+ int? getInt(String key) {
+ return _prefs.getInt(key);
+ }
+
+ Future setBool(String key, bool value) async {
+ await _prefs.setBool(key, value);
+ }
+
+ bool? getBool(String key) {
+ return _prefs.getBool(key);
+ }
+
+ Future setDouble(String key, double value) async {
+ await _prefs.setDouble(key, value);
+ }
+
+ double? getDouble(String key) {
+ return _prefs.getDouble(key);
+ }
+
+ Future setStringList(String key, List value) async {
+ await _prefs.setStringList(key, value);
+ }
+
+ List? getStringList(String key) {
+ return _prefs.getStringList(key);
+ }
+
+ Future remove(String key) async {
+ await _prefs.remove(key);
+ }
+
+ Future clear() async {
+ await _prefs.clear();
+ }
+
+ bool containsKey(String key) {
+ return _prefs.containsKey(key);
+ }
+}
\ No newline at end of file
diff --git a/lib/src/services/theme_service.dart b/lib/src/services/theme_service.dart
new file mode 100644
index 0000000..9134410
--- /dev/null
+++ b/lib/src/services/theme_service.dart
@@ -0,0 +1,156 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+
+class ThemeService extends GetxService {
+ static ThemeService get to => Get.find();
+
+ final _isDarkMode = false.obs;
+ final _primaryColor = Rx(Colors.blue);
+ final _secondaryColor = Rx(Colors.orange);
+ final _fontSize = 16.0.obs;
+ final _isStatusBarImmersive = false.obs;
+ final _textColor = Rx(Colors.black);
+ final _backgroundColor = Rx(Colors.white);
+ final _animationIntensity = 1.0.obs;
+
+ late SharedPreferences _prefs;
+
+ // 初始化
+ Future init() async {
+ _prefs = await SharedPreferences.getInstance();
+ await _loadTheme();
+ return this;
+ }
+
+ // 加载主题
+ Future _loadTheme() async {
+ _isDarkMode.value = _prefs.getBool('is_dark_mode') ?? false;
+ _primaryColor.value = Color(
+ _prefs.getInt('primary_color') ?? Colors.blue.value,
+ );
+ _secondaryColor.value = Color(
+ _prefs.getInt('secondary_color') ?? Colors.orange.value,
+ );
+ _fontSize.value = _prefs.getDouble('font_size') ?? 16.0;
+ _isStatusBarImmersive.value =
+ _prefs.getBool('is_status_bar_immersive') ?? false;
+ _textColor.value = Color(
+ _prefs.getInt('text_color') ??
+ (_isDarkMode.value ? Colors.white.value : Colors.black.value),
+ );
+ _backgroundColor.value = Color(
+ _prefs.getInt('background_color') ??
+ (_isDarkMode.value ? Colors.black.value : Colors.white.value),
+ );
+ _animationIntensity.value = _prefs.getDouble('animation_intensity') ?? 1.0;
+ }
+
+ // 保存主题
+ Future _saveTheme() async {
+ await _prefs.setBool('is_dark_mode', _isDarkMode.value);
+ await _prefs.setInt('primary_color', _primaryColor.value.value);
+ await _prefs.setInt('secondary_color', _secondaryColor.value.value);
+ await _prefs.setDouble('font_size', _fontSize.value);
+ await _prefs.setBool(
+ 'is_status_bar_immersive',
+ _isStatusBarImmersive.value,
+ );
+ await _prefs.setInt('text_color', _textColor.value.value);
+ await _prefs.setInt('background_color', _backgroundColor.value.value);
+ await _prefs.setDouble('animation_intensity', _animationIntensity.value);
+ }
+
+ // 获取当前主题
+ bool get isDarkMode => _isDarkMode.value;
+ Color get primaryColor => _primaryColor.value;
+ Color get secondaryColor => _secondaryColor.value;
+ double get fontSize => _fontSize.value;
+ bool get isStatusBarImmersive => _isStatusBarImmersive.value;
+ Color get textColor => _textColor.value;
+ Color get backgroundColor => _backgroundColor.value;
+ double get animationIntensity => _animationIntensity.value;
+
+ // 获取当前主题对象
+ Map get currentTheme {
+ return {
+ 'isDarkMode': isDarkMode,
+ 'primaryColor': primaryColor,
+ 'secondaryColor': secondaryColor,
+ 'fontSize': fontSize,
+ 'isStatusBarImmersive': isStatusBarImmersive,
+ 'textColor': textColor,
+ 'backgroundColor': backgroundColor,
+ 'animationIntensity': animationIntensity,
+ };
+ }
+
+ // 切换主题模式
+ Future toggleThemeMode() async {
+ _isDarkMode.value = !_isDarkMode.value;
+ await _saveTheme();
+ Get.changeThemeMode(_isDarkMode.value ? ThemeMode.dark : ThemeMode.light);
+ }
+
+ // 设置主题色
+ Future setPrimaryColor(Color color) async {
+ _primaryColor.value = color;
+ await _saveTheme();
+ Get.changeTheme(getThemeData());
+ }
+
+ // 设置次要色
+ Future setSecondaryColor(Color color) async {
+ _secondaryColor.value = color;
+ await _saveTheme();
+ Get.changeTheme(getThemeData());
+ }
+
+ // 设置字体大小
+ Future setFontSize(double size) async {
+ _fontSize.value = size;
+ await _saveTheme();
+ Get.changeTheme(getThemeData());
+ }
+
+ // 设置状态栏沉浸
+ Future setStatusBarImmersive(bool isImmersive) async {
+ _isStatusBarImmersive.value = isImmersive;
+ await _saveTheme();
+ }
+
+ // 设置动画强度
+ Future setAnimationIntensity(double intensity) async {
+ _animationIntensity.value = intensity;
+ await _saveTheme();
+ }
+
+ // 重置为默认主题
+ Future resetToDefault() async {
+ _isDarkMode.value = false;
+ _primaryColor.value = Colors.blue;
+ _secondaryColor.value = Colors.orange;
+ _fontSize.value = 16.0;
+ _isStatusBarImmersive.value = false;
+ _animationIntensity.value = 1.0;
+ await _saveTheme();
+ Get.changeTheme(getThemeData());
+ }
+
+ // 获取主题数据
+ ThemeData getThemeData() {
+ return ThemeData(
+ brightness: _isDarkMode.value ? Brightness.dark : Brightness.light,
+ primaryColor: _primaryColor.value,
+ secondaryHeaderColor: _secondaryColor.value,
+ textTheme: TextTheme(
+ bodyLarge: TextStyle(fontSize: _fontSize.value),
+ bodyMedium: TextStyle(fontSize: _fontSize.value - 2),
+ bodySmall: TextStyle(fontSize: _fontSize.value - 4),
+ titleLarge: TextStyle(fontSize: _fontSize.value + 4),
+ titleMedium: TextStyle(fontSize: _fontSize.value + 2),
+ titleSmall: TextStyle(fontSize: _fontSize.value),
+ ),
+ );
+ }
+}
diff --git a/lib/src/services/toast_service.dart b/lib/src/services/toast_service.dart
index 16dd8d7..7291901 100644
--- a/lib/src/services/toast_service.dart
+++ b/lib/src/services/toast_service.dart
@@ -6,17 +6,25 @@ import 'package:mom_kitchen/src/standards/page_standards.dart';
enum ToastType { success, error, warning, info }
+enum ToastStyle { minimal, standard, detailed }
+
class ToastService {
static final ToastService _instance = ToastService._internal();
factory ToastService() => _instance;
ToastService._internal();
static final FToast _fToast = FToast();
+ ToastStyle _currentStyle = ToastStyle.standard;
+ ToastStyle get currentStyle => _currentStyle;
static void init(BuildContext context) {
_fToast.init(context);
}
+ void setStyle(ToastStyle style) {
+ _currentStyle = style;
+ }
+
static Future show({
required String message,
ToastType type = ToastType.info,
@@ -79,28 +87,23 @@ class ToastService {
}) {
Color backgroundColor;
IconData icon;
- String emoji;
switch (type) {
case ToastType.success:
backgroundColor = const Color(0xFF4CAF50);
icon = CupertinoIcons.checkmark_circle_fill;
- emoji = '✅';
break;
case ToastType.error:
backgroundColor = const Color(0xFFF44336);
icon = CupertinoIcons.xmark_circle_fill;
- emoji = '❌';
break;
case ToastType.warning:
backgroundColor = const Color(0xFFFF9800);
icon = CupertinoIcons.exclamationmark_triangle_fill;
- emoji = '⚠️';
break;
case ToastType.info:
backgroundColor = standards.primaryColor;
icon = CupertinoIcons.info_circle_fill;
- emoji = 'ℹ️';
break;
}
diff --git a/lib/src/standards/app_pages.dart b/lib/src/standards/app_pages.dart
new file mode 100644
index 0000000..27e6b0f
--- /dev/null
+++ b/lib/src/standards/app_pages.dart
@@ -0,0 +1,88 @@
+import 'package:flutter/foundation.dart';
+import 'package:mom_kitchen/src/standards/page_validator.dart';
+import 'package:mom_kitchen/src/pages/home_page.dart';
+import 'package:mom_kitchen/src/pages/theme_demo_page.dart';
+import 'package:mom_kitchen/src/pages/example_page.dart';
+
+class AppPages {
+ static final List pages = [
+ PageInfo(
+ route: '/',
+ name: '首页',
+ description: '应用主页面',
+ requiredStandards: [
+ StandardCheck.themeColors,
+ StandardCheck.textColors,
+ StandardCheck.fontSize,
+ StandardCheck.localization,
+ StandardCheck.darkMode,
+ ],
+ builder: () => const HomePage(),
+ ),
+ PageInfo(
+ route: '/theme',
+ name: '主题设置',
+ description: '主题设置页面',
+ requiredStandards: [
+ StandardCheck.themeColors,
+ StandardCheck.textColors,
+ StandardCheck.darkMode,
+ StandardCheck.animation,
+ ],
+ builder: () => const ThemeDemoPage(),
+ ),
+ PageInfo(
+ route: '/example',
+ name: '示例页面',
+ description: '示例页面展示规范使用',
+ requiredStandards: [
+ StandardCheck.themeColors,
+ StandardCheck.textColors,
+ StandardCheck.fontSize,
+ StandardCheck.spacing,
+ StandardCheck.animation,
+ StandardCheck.responsive,
+ StandardCheck.localization,
+ StandardCheck.orientation,
+ StandardCheck.darkMode,
+ StandardCheck.deviceType,
+ ],
+ builder: () => const ExamplePage(),
+ ),
+ ];
+
+ static void registerAll() {
+ PageRegistry.registerAll(pages);
+
+ if (kDebugMode) {
+ print('✅ 已注册 ${pages.length} 个页面');
+ for (final page in pages) {
+ print(' - ${page.name} (${page.route})');
+ }
+ }
+ }
+
+ static bool isRegistered(String route) {
+ return PageRegistry.hasPage(route);
+ }
+
+ static void validateRoute(String route) {
+ if (!isRegistered(route)) {
+ throw FlutterError('''
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+❌ 页面未注册错误
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+路由: $route
+
+该页面未在 AppPages 中注册,请检查:
+1. 是否已在 AppPages.pages 中添加页面信息
+2. 路由名称是否正确
+3. 是否调用了 AppPages.registerAll()
+
+已注册的页面:
+${PageRegistry.allPages.map((p) => ' - ${p.route}: ${p.name}').join('\n')}
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+''');
+ }
+ }
+}
diff --git a/lib/src/standards/page_standards.dart b/lib/src/standards/page_standards.dart
new file mode 100644
index 0000000..ae98494
--- /dev/null
+++ b/lib/src/standards/page_standards.dart
@@ -0,0 +1,357 @@
+import 'package:flutter/material.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:mom_kitchen/src/services/app_service.dart';
+import 'package:mom_kitchen/src/services/theme_service.dart';
+import 'package:mom_kitchen/src/services/animation_service.dart';
+import 'package:mom_kitchen/src/services/screen_util_config.dart';
+import 'package:mom_kitchen/src/services/toast_service.dart';
+import 'package:mom_kitchen/src/l10n/app_localizations.dart';
+
+class PageStandards {
+ final BuildContext context;
+
+ PageStandards._(this.context);
+
+ factory PageStandards.of(BuildContext context) {
+ return PageStandards._(context);
+ }
+
+ AppLocalizations get l10n => AppLocalizations.of(context)!;
+
+ ThemeService get _theme => AppService.instance.theme;
+ AnimationService get _animation => AppService.instance.animation;
+ ScreenUtilConfig get _screenUtil => AppService.instance.screenUtil;
+
+ bool get isDarkMode => _theme.isDarkMode;
+
+ Color get primaryColor => _theme.primaryColor;
+
+ Color get secondaryColor => _theme.secondaryColor;
+
+ Color get textColor => _theme.textColor;
+
+ Color get backgroundColor => _theme.backgroundColor;
+
+ double get fontSize => _theme.fontSize;
+
+ bool get isStatusBarImmersive => _theme.isStatusBarImmersive;
+
+ double get animationIntensity => _theme.animationIntensity;
+
+ bool get animationEnabled => _animation.enabled;
+
+ double get animationSpeed => _animation.speed;
+
+ AnimationPreset get animationPreset => _animation.preset;
+
+ AnimationCurveType get animationCurve => _animation.curveType;
+
+ Size get designSize => _screenUtil.designSize;
+
+ bool get scaleEnabled => _screenUtil.scaleEnabled;
+
+ bool get minTextAdapt => _screenUtil.minTextAdapt;
+
+ bool get splitScreenMode => _screenUtil.splitScreenMode;
+
+ double get screenWidth => ScreenUtil().screenWidth;
+
+ double get screenHeight => ScreenUtil().screenHeight;
+
+ double get statusBarHeight => ScreenUtil().statusBarHeight;
+
+ double get bottomBarHeight => ScreenUtil().bottomBarHeight;
+
+ Orientation get orientation => MediaQuery.of(context).orientation;
+
+ bool get isPortrait => orientation == Orientation.portrait;
+
+ bool get isLandscape => orientation == Orientation.landscape;
+
+ double get devicePixelRatio => MediaQuery.of(context).devicePixelRatio;
+
+ EdgeInsets get padding => MediaQuery.of(context).padding;
+
+ EdgeInsets get viewInsets => MediaQuery.of(context).viewInsets;
+
+ Locale get currentLocale => Localizations.localeOf(context);
+
+ String get languageCode => currentLocale.languageCode;
+
+ ToastStyle get toastStyle => AppService.instance.toast.currentStyle;
+
+ DeviceType get deviceType => ScreenUtil().deviceType(context);
+
+ bool get isMobile =>
+ deviceType == DeviceType.mobile || deviceType == DeviceType.harmonyOS;
+
+ bool get isTablet => deviceType == DeviceType.tablet;
+
+ bool get isWeb => deviceType == DeviceType.web;
+
+ bool get isDesktop =>
+ deviceType == DeviceType.windows ||
+ deviceType == DeviceType.mac ||
+ deviceType == DeviceType.linux;
+
+ bool get isHarmonyOS => deviceType == DeviceType.harmonyOS;
+
+ double scaledWidth(double width) {
+ if (!scaleEnabled) return width;
+ return ScreenUtil().setWidth(width);
+ }
+
+ double scaledHeight(double height) {
+ if (!scaleEnabled) return height;
+ return ScreenUtil().setHeight(height);
+ }
+
+ double scaledFontSize(double fontSize) {
+ if (!scaleEnabled) return fontSize;
+ return ScreenUtil().setSp(fontSize);
+ }
+
+ double scaledRadius(double radius) {
+ if (!scaleEnabled) return radius;
+ return ScreenUtil().radius(radius);
+ }
+
+ EdgeInsets scaledPadding(EdgeInsets padding) {
+ if (!scaleEnabled) return padding;
+ return EdgeInsets.only(
+ left: ScreenUtil().setWidth(padding.left),
+ top: ScreenUtil().setHeight(padding.top),
+ right: ScreenUtil().setWidth(padding.right),
+ bottom: ScreenUtil().setHeight(padding.bottom),
+ );
+ }
+
+ EdgeInsets scaledMargin(EdgeInsets margin) {
+ return scaledPadding(margin);
+ }
+
+ TextStyle get textStyle =>
+ TextStyle(color: textColor, fontSize: ScreenUtil().setSp(fontSize));
+
+ TextStyle get primaryTextStyle =>
+ TextStyle(color: primaryColor, fontSize: ScreenUtil().setSp(fontSize));
+
+ TextStyle get secondaryTextStyle =>
+ TextStyle(color: secondaryColor, fontSize: ScreenUtil().setSp(fontSize));
+
+ ThemeData get themeData => Theme.of(context);
+
+ CupertinoThemeData get cupertinoThemeData => CupertinoTheme.of(context);
+
+ Brightness get brightness => isDarkMode ? Brightness.dark : Brightness.light;
+
+ SystemUiOverlayStyle get systemUiOverlayStyle =>
+ isDarkMode ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark;
+
+ void setStatusBarStyle() {
+ SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
+ }
+
+ void hideStatusBar() {
+ SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
+ }
+
+ void showStatusBar() {
+ SystemChrome.setEnabledSystemUIMode(
+ SystemUiMode.manual,
+ overlays: SystemUiOverlay.values,
+ );
+ }
+
+ Map toMap() {
+ return {
+ 'isDarkMode': isDarkMode,
+ 'primaryColor': primaryColor.toARGB32(),
+ 'secondaryColor': secondaryColor.toARGB32(),
+ 'textColor': textColor.toARGB32(),
+ 'backgroundColor': backgroundColor.toARGB32(),
+ 'fontSize': fontSize,
+ 'isStatusBarImmersive': isStatusBarImmersive,
+ 'animationIntensity': animationIntensity,
+ 'animationEnabled': animationEnabled,
+ 'animationSpeed': animationSpeed,
+ 'animationPreset': animationPreset.name,
+ 'animationCurve': animationCurve.name,
+ 'designSize': designSize.toString(),
+ 'scaleEnabled': scaleEnabled,
+ 'screenWidth': screenWidth,
+ 'screenHeight': screenHeight,
+ 'orientation': orientation.toString(),
+ 'currentLocale': currentLocale.toString(),
+ 'toastStyle': toastStyle.name,
+ 'deviceType': deviceType.name,
+ };
+ }
+
+ @override
+ String toString() {
+ return 'PageStandards(${toMap()})';
+ }
+}
+
+mixin PageStandardsMixin on State {
+ late PageStandards standards;
+
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ standards = PageStandards.of(context);
+ }
+
+ AppLocalizations get l10n => standards.l10n;
+
+ bool get isDarkMode => standards.isDarkMode;
+
+ Color get primaryColor => standards.primaryColor;
+
+ Color get secondaryColor => standards.secondaryColor;
+
+ Color get textColor => standards.textColor;
+
+ Color get backgroundColor => standards.backgroundColor;
+
+ double get fontSize => standards.fontSize;
+
+ bool get isStatusBarImmersive => standards.isStatusBarImmersive;
+
+ double get animationIntensity => standards.animationIntensity;
+
+ bool get animationEnabled => standards.animationEnabled;
+
+ double get animationSpeed => standards.animationSpeed;
+
+ AnimationPreset get animationPreset => standards.animationPreset;
+
+ AnimationCurveType get animationCurve => standards.animationCurve;
+
+ Size get designSize => standards.designSize;
+
+ bool get scaleEnabled => standards.scaleEnabled;
+
+ double get screenWidth => standards.screenWidth;
+
+ double get screenHeight => standards.screenHeight;
+
+ double get statusBarHeight => standards.statusBarHeight;
+
+ double get bottomBarHeight => standards.bottomBarHeight;
+
+ Orientation get orientation => standards.orientation;
+
+ bool get isPortrait => standards.isPortrait;
+
+ bool get isLandscape => standards.isLandscape;
+
+ Locale get currentLocale => standards.currentLocale;
+
+ String get languageCode => standards.languageCode;
+
+ ToastStyle get toastStyle => standards.toastStyle;
+
+ DeviceType get deviceType => standards.deviceType;
+
+ bool get isMobile => standards.isMobile;
+
+ bool get isTablet => standards.isTablet;
+
+ bool get isWeb => standards.isWeb;
+
+ bool get isDesktop => standards.isDesktop;
+
+ bool get isHarmonyOS => standards.isHarmonyOS;
+
+ double scaledWidth(double width) => standards.scaledWidth(width);
+
+ double scaledHeight(double height) => standards.scaledHeight(height);
+
+ double scaledFontSize(double fontSize) => standards.scaledFontSize(fontSize);
+
+ double scaledRadius(double radius) => standards.scaledRadius(radius);
+
+ EdgeInsets scaledPadding(EdgeInsets padding) =>
+ standards.scaledPadding(padding);
+
+ EdgeInsets scaledMargin(EdgeInsets margin) => standards.scaledMargin(margin);
+
+ TextStyle get textStyle => standards.textStyle;
+
+ TextStyle get primaryTextStyle => standards.primaryTextStyle;
+
+ TextStyle get secondaryTextStyle => standards.secondaryTextStyle;
+
+ Brightness get brightness => standards.brightness;
+
+ SystemUiOverlayStyle get systemUiOverlayStyle =>
+ standards.systemUiOverlayStyle;
+
+ void setStatusBarStyle() => standards.setStatusBarStyle();
+
+ void hideStatusBar() => standards.hideStatusBar();
+
+ void showStatusBar() => standards.showStatusBar();
+}
+
+abstract class StandardPage extends StatefulWidget {
+ const StandardPage({super.key});
+}
+
+abstract class StandardPageState extends State
+ with PageStandardsMixin {
+ @override
+ Widget build(BuildContext context) {
+ return buildPage(context);
+ }
+
+ Widget buildPage(BuildContext context);
+}
+
+class StandardPageWrapper extends StatelessWidget {
+ final Widget child;
+ final bool applyStatusBarStyle;
+ final bool applyBackgroundColor;
+
+ const StandardPageWrapper({
+ super.key,
+ required this.child,
+ this.applyStatusBarStyle = true,
+ this.applyBackgroundColor = true,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final standards = PageStandards.of(context);
+
+ if (applyStatusBarStyle) {
+ standards.setStatusBarStyle();
+ }
+
+ Widget result = child;
+
+ if (applyBackgroundColor) {
+ result = Container(color: standards.backgroundColor, child: result);
+ }
+
+ return result;
+ }
+}
+
+extension PageStandardsExtension on BuildContext {
+ PageStandards get standards => PageStandards.of(this);
+
+ AppLocalizations get l10n => AppLocalizations.of(this)!;
+
+ Color get primaryColor => standards.primaryColor;
+
+ Color get textColor => standards.textColor;
+
+ Color get backgroundColor => standards.backgroundColor;
+
+ double get fontSize => standards.fontSize;
+}
diff --git a/lib/src/standards/page_validator.dart b/lib/src/standards/page_validator.dart
new file mode 100644
index 0000000..6827c65
--- /dev/null
+++ b/lib/src/standards/page_validator.dart
@@ -0,0 +1,479 @@
+import 'package:flutter/foundation.dart';
+import 'package:flutter/material.dart';
+import 'package:mom_kitchen/src/standards/page_standards.dart';
+import 'package:mom_kitchen/src/utils/app_logger.dart';
+
+enum StandardCheck {
+ themeColors('主题颜色', '检查是否使用主题色、次要色'),
+ textColors('字体颜色', '检查是否使用主题字体色'),
+ fontSize('字体大小', '检查是否使用主题字体大小'),
+ spacing('间距规范', '检查是否使用标准间距'),
+ animation('动画配置', '检查是否遵循动画配置'),
+ responsive('响应式布局', '检查是否适配不同屏幕'),
+ localization('多语言', '检查是否使用多语言'),
+ orientation('屏幕方向', '检查是否处理屏幕方向'),
+ toastStyle('消息样式', '检查是否使用标准消息样式'),
+ statusBarImmersive('状态栏沉浸', '检查是否处理状态栏沉浸'),
+ darkMode('深色模式', '检查是否支持深色模式'),
+ deviceType('设备类型', '检查是否适配不同设备类型');
+
+ final String label;
+ final String description;
+
+ const StandardCheck(this.label, this.description);
+}
+
+class PageInfo {
+ final String route;
+ final String name;
+ final String description;
+ final List requiredStandards;
+ final Widget Function() builder;
+ final Map? metadata;
+
+ const PageInfo({
+ required this.route,
+ required this.name,
+ required this.description,
+ required this.requiredStandards,
+ required this.builder,
+ this.metadata,
+ });
+
+ Map toMap() {
+ return {
+ 'route': route,
+ 'name': name,
+ 'description': description,
+ 'requiredStandards': requiredStandards.map((e) => e.name).toList(),
+ 'metadata': metadata,
+ };
+ }
+}
+
+class PageRegistry {
+ static final PageRegistry _instance = PageRegistry._internal();
+ factory PageRegistry() => _instance;
+ PageRegistry._internal();
+
+ static final Map