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..a574790 --- /dev/null +++ b/.metadata @@ -0,0 +1,33 @@ +# 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: "05db9689081f091050f01aed79f04dce0c750154" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: android + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + - platform: ios + create_revision: 05db9689081f091050f01aed79f04dce0c750154 + base_revision: 05db9689081f091050f01aed79f04dce0c750154 + + # 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.en.md b/README.en.md new file mode 100644 index 0000000..836bdfd --- /dev/null +++ b/README.en.md @@ -0,0 +1,94 @@ +[![中文](https://img.shields.io/badge/Lang-中文-red)](README.md) + +# Flutter Template + +A production-ready Flutter quick-start template extracted from real-world projects. Ships with a proven architecture, curated dependency stack, and ready-to-use infrastructure — start writing business features on day one. + +## Goals + +- Android & iOS support +- Zero business residue — no business pages, API models, assets, copy, or private configuration +- Production infrastructure included: routing, theming, networking, caching, logging, permissions, utilities, state management, and common UI components +- Demo page as default home — delete or replace with your own + +## Tech Stack + +| Category | Package | Purpose | +|---|---|---| +| State Management | flutter_riverpod | Compile-safe, testable state management | +| Networking | dio | HTTP client with interceptor chain | +| Local Cache | shared_preferences | Key-value persistence | +| Network Monitor | connectivity_plus | Real-time connectivity tracking | +| Permissions | permission_handler | Runtime permission requests | +| Screen Adaptation | flutter_screenutil | Design-dimension-based layout | +| Image Loading | cached_network_image | Network image caching | +| SVG | flutter_svg | SVG rendering | +| Pull to Refresh | pull_to_refresh | Refresh and load-more | +| Loading HUD | flutter_easyloading | Toast and loading indicator | +| Device Info | device_info_plus | Device metadata | +| Package Info | package_info_plus | App version info | +| URL Launcher | url_launcher | Open external URLs | +| Linting | flutter_lints | Recommended Dart lint rules | + +## Directory Structure + +``` +lib/ +├── app/ # Application shell +│ ├── app.dart # MaterialApp, theme, localization, global config +│ ├── bootstrap.dart # Startup initialization +│ ├── config/ # Multi-environment config (dev/staging/prod) +│ ├── router/ # Navigator utilities and route stack tracking +│ └── theme/ # Light/dark themes, colors, spacing +├── core/ # Framework-level infrastructure +│ ├── cache/ # SharedPreferences wrapper and common keys +│ ├── extensions/ # BuildContext extensions +│ ├── logging/ # Logger +│ ├── mixins/ # Reusable mixins +│ ├── network/ # Dio client, response wrapper, exceptions, +│ │ └── offline_queue/ # interceptors, network monitor, offline queue +│ ├── permission/ # Permission request abstraction +│ └── utils/ # Date, form validation, debounce/throttle, +│ # device info, URL utilities +├── shared/ +│ └── widgets/ # Reusable UI components +├── features/ +│ └── demo/ # Capability demo page — removable +└── main.dart # Entry point +``` + +## Built-in Capabilities + +- **Networking** — ApiClient (Dio) + ApiResponse + ApiException + header interceptor +- **Network Monitoring** — Real-time connectivity via connectivity_plus +- **Offline Queue** — Request queuing, persistence, and auto-replay on reconnect +- **Local Cache** — AppStorage wrapping SharedPreferences +- **State Management** — Riverpod provider system +- **Theming** — Material 3 light/dark themes + screen adaptation +- **UI Components** — AppButton, AppTextField, AppCard, AppDialog, AppToast, AppEmptyView, AppErrorView, AppLoadingView, AppStatusView, AppAvatar, AppTag, AppSearchBar, AppRefreshList, AppNetworkImage, SafeAreaWrapper +- **Utilities** — Date formatting, form validation, debounce/throttle, device info, URL utils +- **Project Config** — flutter_lints, Android/iOS platform projects + +## Getting Started + +```bash +cd flutter-template +flutter pub get +flutter analyze +flutter test +flutter run +``` + +```bash +flutter run -d +flutter build apk --debug +flutter build ios --debug --no-codesign +``` + +## Onboarding a New Project + +1. Update API base URLs in `lib/app/config/app_config.dart` +2. Add feature modules under `lib/features/` +3. Use ApiClient via `core/network/providers/dio_providers.dart` +4. Keep business-specific cache keys in your feature module; `core/cache/storage_keys.dart` for truly shared keys only +5. Delete `features/demo/` or replace it with your own home page diff --git a/README.md b/README.md index 7738930..79a0644 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,93 @@ -# record-tool +[![English](https://img.shields.io/badge/Lang-English-blue)](README.en.md) -录制助手 flutter 端 \ No newline at end of file +# Flutter Template + +一个从实际项目中提炼的 Flutter 通用快速开发模板,开箱即用,避免重复搭建工程基础设施。 + +## 目标 + +- 支持 Android 和 iOS +- 不包含原业务页面、接口、Model、资源、文案和私有配置 +- 保留通用工程化能力:路由、主题、网络、缓存、日志、权限、工具类、状态管理和常用 UI 组件 +- 默认首页为 demo 页面,可直接替换为新业务首页 + +## 技术栈 + +| 类别 | 依赖 | 用途 | +|---|---|---| +| 状态管理 | flutter_riverpod | 编译安全、可测试的状态管理 | +| 网络请求 | dio | HTTP 客户端,支持拦截器链 | +| 本地缓存 | shared_preferences | KV 持久化存储 | +| 网络监听 | connectivity_plus | 实时网络状态监测 | +| 权限申请 | permission_handler | 运行时权限请求 | +| 屏幕适配 | flutter_screenutil | 设计稿尺寸适配 | +| 图片加载 | cached_network_image | 网络图片缓存 | +| SVG | flutter_svg | SVG 渲染 | +| 下拉刷新 | pull_to_refresh | 下拉刷新 / 上拉加载 | +| 加载提示 | flutter_easyloading | Toast 和 loading | +| 设备信息 | device_info_plus | 设备元数据 | +| 应用信息 | package_info_plus | 版本号等应用信息 | +| 链接跳转 | url_launcher | 外部 URL 打开 | +| 代码规范 | flutter_lints | Dart 推荐 lint 规则 | + +## 目录结构 + +``` +lib/ +├── app/ # 应用壳 +│ ├── app.dart # MaterialApp、主题、国际化、全局配置 +│ ├── bootstrap.dart # 启动初始化 +│ ├── config/ # 多环境配置 (dev/staging/prod) +│ ├── router/ # Navigator 工具和路由栈跟踪 +│ └── theme/ # 亮色/暗色主题、颜色、间距 +├── core/ # 框架层基础设施 +│ ├── cache/ # SharedPreferences 封装和通用 key +│ ├── extensions/ # BuildContext 扩展 +│ ├── logging/ # 日志工具 +│ ├── mixins/ # 通用 mixin +│ ├── network/ # Dio 封装、响应包装、异常处理 +│ │ └── offline_queue/ # 拦截器、网络监听、离线请求队列 +│ ├── permission/ # 权限请求封装 +│ └── utils/ # 日期、表单校验、防抖节流、设备、URL 工具 +├── shared/ +│ └── widgets/ # 通用 UI 组件库 +├── features/ +│ └── demo/ # 模板能力演示页,可删除 +└── main.dart # 入口 +``` + +## 内置能力 + +- **网络层** — ApiClient (Dio) + ApiResponse + ApiException + 请求头拦截器 +- **网络监听** — 基于 connectivity_plus 的实时状态追踪 +- **离线队列** — 请求入队、持久化、网络恢复自动重放 +- **本地缓存** — AppStorage 封装 SharedPreferences +- **状态管理** — Riverpod Provider 体系 +- **主题系统** — Material 3 亮/暗双主题 + 屏幕适配 +- **UI 组件** — AppButton、AppTextField、AppCard、AppDialog、AppToast、AppEmptyView、AppErrorView、AppLoadingView、AppStatusView、AppAvatar、AppTag、AppSearchBar、AppRefreshList、AppNetworkImage、SafeAreaWrapper +- **工具类** — 日期格式化、表单校验、防抖节流、设备信息、URL 工具 +- **工程配置** — flutter_lints、Android/iOS 平台工程 + +## 快速开始 + +```bash +cd flutter-template +flutter pub get +flutter analyze +flutter test +flutter run +``` + +```bash +flutter run -d +flutter build apk --debug +flutter build ios --debug --no-codesign +``` + +## 新业务接入指引 + +1. 修改 `lib/app/config/app_config.dart` 中的环境地址 +2. 在 `lib/features/` 下新增业务模块 +3. 通过 `core/network/providers/dio_providers.dart` 获取 ApiClient +4. 业务缓存 key 放在业务模块内,`core/cache/storage_keys.dart` 只放真正通用的 key +5. 删除 `features/demo/` 或替换为业务首页 diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..c6d25a6 --- /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 + +# 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..a9439be --- /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.flutter_template" + 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.flutter_template" + // 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..e048f86 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/flutter_template/MainActivity.kt b/android/app/src/main/kotlin/com/example/flutter_template/MainActivity.kt new file mode 100644 index 0000000..660cdb0 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/flutter_template/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.flutter_template + +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/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/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..ec97fc6 --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..620e46e --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,43 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '13.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..d06d55a --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,67 @@ +PODS: + - connectivity_plus (0.0.1): + - Flutter + - device_info_plus (0.0.1): + - Flutter + - Flutter (1.0.0) + - package_info_plus (0.4.5): + - Flutter + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - permission_handler_apple (9.3.0): + - Flutter + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - sqflite_darwin (0.0.4): + - Flutter + - FlutterMacOS + - url_launcher_ios (0.0.1): + - Flutter + +DEPENDENCIES: + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) + - Flutter (from `Flutter`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + +EXTERNAL SOURCES: + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" + device_info_plus: + :path: ".symlinks/plugins/device_info_plus/ios" + Flutter: + :path: Flutter + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + permission_handler_apple: + :path: ".symlinks/plugins/permission_handler_apple/ios" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + sqflite_darwin: + :path: ".symlinks/plugins/sqflite_darwin/darwin" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + +SPEC CHECKSUMS: + connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd + device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 + package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 + path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880 + permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d + shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb + sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 + url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b + +PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e + +COCOAPODS: 1.16.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..9d676a7 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,749 @@ +// !$*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 */; }; + 64BC3B3C75FABAA128C4FE7A /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D84231833EC084C45F76D9A0 /* Pods_RunnerTests.framework */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 87DA76CA5231F693C9392B80 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6AA1C86CE710449CC3E8FCD /* Pods_Runner.framework */; }; + 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 = ""; }; + 2B235D76031429175C8F5973 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; 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 = ""; }; + 69561E7442E8CC939DB2B482 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; 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 = ""; }; + 95C6AC1536EA3DBA2D369C55 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.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 = ""; }; + 99DBE6263F70650B13C33EAC /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + B6AA1C86CE710449CC3E8FCD /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C2D68FA11B326EC41ECE81C8 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + D84231833EC084C45F76D9A0 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DFA822DC4965C5AFAFF6BB41 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 969A7C920B7FA8B096ABE9CA /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 64BC3B3C75FABAA128C4FE7A /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 87DA76CA5231F693C9392B80 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0B59A02A3C32BFCA7B12CCCB /* Pods */ = { + isa = PBXGroup; + children = ( + 69561E7442E8CC939DB2B482 /* Pods-Runner.debug.xcconfig */, + C2D68FA11B326EC41ECE81C8 /* Pods-Runner.release.xcconfig */, + 2B235D76031429175C8F5973 /* Pods-Runner.profile.xcconfig */, + 95C6AC1536EA3DBA2D369C55 /* Pods-RunnerTests.debug.xcconfig */, + DFA822DC4965C5AFAFF6BB41 /* Pods-RunnerTests.release.xcconfig */, + 99DBE6263F70650B13C33EAC /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 292109AD45B1136C0FCAE383 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B6AA1C86CE710449CC3E8FCD /* Pods_Runner.framework */, + D84231833EC084C45F76D9A0 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 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 */, + 0B59A02A3C32BFCA7B12CCCB /* Pods */, + 292109AD45B1136C0FCAE383 /* Frameworks */, + ); + 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 = ( + 310E52B4148392E9B8E18DEE /* [CP] Check Pods Manifest.lock */, + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + 969A7C920B7FA8B096ABE9CA /* Frameworks */, + ); + 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 = ( + 473E31C28AE1D9633F1F84FD /* [CP] Check Pods Manifest.lock */, + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + CD126DA202245CE8BB749787 /* [CP] Embed Pods Frameworks */, + 62D3774184B6C76B8E34C8C2 /* [CP] Copy Pods Resources */, + ); + 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 */ + 310E52B4148392E9B8E18DEE /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 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"; + }; + 473E31C28AE1D9633F1F84FD /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 62D3774184B6C76B8E34C8C2 /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + 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"; + }; + CD126DA202245CE8BB749787 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* 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)"; + DEVELOPMENT_TEAM = 35634V629S; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterTemplate; + 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; + baseConfigurationReference = 95C6AC1536EA3DBA2D369C55 /* Pods-RunnerTests.debug.xcconfig */; + 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.flutterTemplate.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; + baseConfigurationReference = DFA822DC4965C5AFAFF6BB41 /* Pods-RunnerTests.release.xcconfig */; + 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.flutterTemplate.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; + baseConfigurationReference = 99DBE6263F70650B13C33EAC /* Pods-RunnerTests.profile.xcconfig */; + 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.flutterTemplate.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)"; + DEVELOPMENT_TEAM = 35634V629S; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterTemplate; + 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)"; + DEVELOPMENT_TEAM = 35634V629S; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterTemplate; + 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..21a3cc1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + 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..62f1f27 --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Flutter Template + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + flutter_template + 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/lib/app/app.dart b/lib/app/app.dart new file mode 100644 index 0000000..b5c2b7c --- /dev/null +++ b/lib/app/app.dart @@ -0,0 +1,53 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_template/app/config/app_config.dart'; +import 'package:flutter_template/app/router/app_navigator.dart'; +import 'package:flutter_template/app/theme/app_theme.dart'; +import 'package:flutter_template/features/demo/demo_page.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; + +class FlutterTemplateApp extends StatelessWidget { + const FlutterTemplateApp({super.key}); + + @override + Widget build(BuildContext context) { + return ScreenUtilInit( + designSize: const Size(375, 812), + minTextAdapt: true, + splitScreenMode: true, + builder: (context, child) { + return MaterialApp( + title: AppConfig.appName, + navigatorKey: AppNavigator.navigatorKey, + navigatorObservers: [RouteTracker()], + debugShowCheckedModeBanner: false, + theme: AppTheme.light, + darkTheme: AppTheme.dark, + supportedLocales: const [Locale('zh', 'CN'), Locale('en', 'US')], + localizationsDelegates: const [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + builder: EasyLoading.init( + builder: (context, child) { + return MediaQuery( + data: MediaQuery.of( + context, + ).copyWith(textScaler: const TextScaler.linear(1)), + child: child ?? const SizedBox.shrink(), + ); + }, + ), + home: RefreshConfiguration( + enableLoadingWhenNoData: false, + headerTriggerDistance: 80, + child: const DemoPage(), + ), + ); + }, + ); + } +} diff --git a/lib/app/bootstrap.dart b/lib/app/bootstrap.dart new file mode 100644 index 0000000..9cce0ef --- /dev/null +++ b/lib/app/bootstrap.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_template/app/app.dart'; +import 'package:flutter_template/app/config/app_config.dart'; +import 'package:flutter_template/core/cache/app_storage.dart'; +import 'package:flutter_template/core/logging/app_logger.dart'; +import 'package:package_info_plus/package_info_plus.dart'; + +class AppBootstrapper { + AppBootstrapper._(); + + static Future bootstrap({ + AppEnvironment environment = AppEnvironment.dev, + }) async { + WidgetsFlutterBinding.ensureInitialized(); + + await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); + + await AppStorage.init(); + final packageInfo = await PackageInfo.fromPlatform(); + + AppConfig.configure(environment: environment, packageInfo: packageInfo); + + AppLogger.debug('App started in ${AppConfig.current.environment.name}'); + + runApp(const ProviderScope(child: FlutterTemplateApp())); + } +} diff --git a/lib/app/config/app_config.dart b/lib/app/config/app_config.dart new file mode 100644 index 0000000..05ffa93 --- /dev/null +++ b/lib/app/config/app_config.dart @@ -0,0 +1,48 @@ +import 'package:package_info_plus/package_info_plus.dart'; + +enum AppEnvironment { dev, staging, prod } + +class EnvironmentValues { + const EnvironmentValues({ + required this.environment, + required this.baseUrl, + required this.enableNetworkLog, + }); + + final AppEnvironment environment; + final String baseUrl; + final bool enableNetworkLog; +} + +class AppConfig { + AppConfig._(); + + static late EnvironmentValues current; + static PackageInfo? packageInfo; + + static const appName = 'Flutter Template'; + + static void configure({ + required AppEnvironment environment, + PackageInfo? packageInfo, + }) { + AppConfig.packageInfo = packageInfo; + current = switch (environment) { + AppEnvironment.dev => const EnvironmentValues( + environment: AppEnvironment.dev, + baseUrl: 'https://example.com/api', + enableNetworkLog: true, + ), + AppEnvironment.staging => const EnvironmentValues( + environment: AppEnvironment.staging, + baseUrl: 'https://staging.example.com/api', + enableNetworkLog: true, + ), + AppEnvironment.prod => const EnvironmentValues( + environment: AppEnvironment.prod, + baseUrl: 'https://api.example.com', + enableNetworkLog: false, + ), + }; + } +} diff --git a/lib/app/router/app_navigator.dart b/lib/app/router/app_navigator.dart new file mode 100644 index 0000000..59bfdcc --- /dev/null +++ b/lib/app/router/app_navigator.dart @@ -0,0 +1,189 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; + +class AppNavigator { + AppNavigator._(); + + static final navigatorKey = GlobalKey(); + static final Set _pushingRoutes = {}; + + static BuildContext? get context => navigatorKey.currentContext; + + static Future push( + Widget page, { + BuildContext? context, + Object? arguments, + String? name, + bool preventDuplicate = true, + }) async { + final routeName = name ?? page.runtimeType.toString(); + if (preventDuplicate && RouteTracker.contains(routeName)) { + return null; + } + if (_pushingRoutes.contains(routeName)) { + return null; + } + + _pushingRoutes.add(routeName); + final nav = Navigator.of( + context ?? AppNavigator.context!, + rootNavigator: true, + ); + try { + return await nav.push( + SlidePageRoute( + builder: (_) => page, + settings: RouteSettings(name: routeName, arguments: arguments), + ), + ); + } finally { + WidgetsBinding.instance.addPostFrameCallback((_) { + _pushingRoutes.remove(routeName); + }); + } + } + + static Future pushReplacement( + Widget page, { + BuildContext? context, + Object? arguments, + String? name, + }) { + return Navigator.of( + context ?? AppNavigator.context!, + rootNavigator: true, + ).pushReplacement( + SlidePageRoute( + builder: (_) => page, + settings: RouteSettings(name: name, arguments: arguments), + ), + ); + } + + static Future pushAndRemoveUntil( + Widget page, { + BuildContext? context, + RoutePredicate? predicate, + Object? arguments, + String? name, + }) { + return Navigator.of( + context ?? AppNavigator.context!, + rootNavigator: true, + ).pushAndRemoveUntil( + SlidePageRoute( + builder: (_) => page, + settings: RouteSettings(name: name, arguments: arguments), + ), + predicate ?? (_) => false, + ); + } + + static Future pushTransparent( + Widget page, { + BuildContext? context, + Color barrierColor = Colors.black54, + Duration duration = const Duration(milliseconds: 200), + bool dismissible = true, + }) { + return Navigator.of(context ?? AppNavigator.context!).push( + PageRouteBuilder( + opaque: false, + barrierColor: barrierColor, + barrierDismissible: dismissible, + transitionDuration: duration, + reverseTransitionDuration: duration, + pageBuilder: (_, __, ___) => page, + transitionsBuilder: (_, animation, __, child) { + return FadeTransition(opacity: animation, child: child); + }, + ), + ); + } + + static void pop({BuildContext? context, T? result}) { + Navigator.of( + context ?? AppNavigator.context!, + rootNavigator: true, + ).pop(result); + } + + static void popTimes({BuildContext? context, int count = 1}) { + var popped = 0; + Navigator.of(context ?? AppNavigator.context!).popUntil((route) { + if (popped < count) { + popped++; + return false; + } + return true; + }); + } +} + +class SlidePageRoute extends MaterialPageRoute { + SlidePageRoute({required super.builder, super.settings}); + + @override + Widget buildTransitions( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + Widget child, + ) { + if (Platform.isAndroid) { + final tween = Tween( + begin: const Offset(1, 0), + end: Offset.zero, + ).chain(CurveTween(curve: Curves.easeOutCubic)); + return SlideTransition(position: animation.drive(tween), child: child); + } + + return Theme.of(context).pageTransitionsTheme.buildTransitions( + this, + context, + animation, + secondaryAnimation, + child, + ); + } +} + +class RouteTracker extends NavigatorObserver { + static final List pageStack = []; + + bool _isPage(Route route) => route is PageRoute; + + @override + void didPush(Route route, Route? previousRoute) { + if (_isPage(route)) { + pageStack.add(route.settings.name); + } + } + + @override + void didPop(Route route, Route? previousRoute) { + if (_isPage(route) && pageStack.isNotEmpty) { + pageStack.removeLast(); + } + } + + @override + void didRemove(Route route, Route? previousRoute) { + if (_isPage(route)) { + pageStack.remove(route.settings.name); + } + } + + @override + void didReplace({Route? newRoute, Route? oldRoute}) { + if (oldRoute != null && _isPage(oldRoute) && pageStack.isNotEmpty) { + pageStack.removeLast(); + } + if (newRoute != null && _isPage(newRoute)) { + pageStack.add(newRoute.settings.name); + } + } + + static bool contains(String name) => pageStack.contains(name); +} diff --git a/lib/app/theme/app_theme.dart b/lib/app/theme/app_theme.dart new file mode 100644 index 0000000..df12df6 --- /dev/null +++ b/lib/app/theme/app_theme.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; + +class AppTheme { + AppTheme._(); + + static const seedColor = Color(0xFF2563EB); + static const background = Color(0xFFF6F7FB); + static const surface = Colors.white; + static const textPrimary = Color(0xFF111827); + static const textSecondary = Color(0xFF6B7280); + static const border = Color(0xFFE5E7EB); + static const success = Color(0xFF16A34A); + static const warning = Color(0xFFF59E0B); + static const danger = Color(0xFFDC2626); + + static ThemeData get light { + final scheme = ColorScheme.fromSeed( + seedColor: seedColor, + brightness: Brightness.light, + surface: surface, + ); + return ThemeData( + useMaterial3: true, + colorScheme: scheme, + scaffoldBackgroundColor: background, + appBarTheme: const AppBarTheme( + centerTitle: true, + elevation: 0, + scrolledUnderElevation: 0, + backgroundColor: surface, + foregroundColor: textPrimary, + ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + minimumSize: const Size(88, 44), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + outlinedButtonTheme: OutlinedButtonThemeData( + style: OutlinedButton.styleFrom( + minimumSize: const Size(88, 44), + side: const BorderSide(color: border), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + ); + } + + static ThemeData get dark { + final scheme = ColorScheme.fromSeed( + seedColor: seedColor, + brightness: Brightness.dark, + ); + return ThemeData( + useMaterial3: true, + colorScheme: scheme, + appBarTheme: const AppBarTheme( + centerTitle: true, + elevation: 0, + scrolledUnderElevation: 0, + ), + ); + } +} + +class AppSpacing { + AppSpacing._(); + + static const double xs = 4; + static const double sm = 8; + static const double md = 12; + static const double lg = 16; + static const double xl = 24; + static const double xxl = 32; +} diff --git a/lib/core/cache/app_storage.dart b/lib/core/cache/app_storage.dart new file mode 100644 index 0000000..a30e7ad --- /dev/null +++ b/lib/core/cache/app_storage.dart @@ -0,0 +1,68 @@ +import 'dart:convert'; + +import 'package:shared_preferences/shared_preferences.dart'; + +class AppStorage { + AppStorage._(); + + static SharedPreferences? _prefs; + + static Future init() async { + _prefs ??= await SharedPreferences.getInstance(); + } + + static SharedPreferences get instance { + final prefs = _prefs; + if (prefs == null) { + throw StateError('AppStorage.init() must be called before use.'); + } + return prefs; + } + + static String? getString(String key) => instance.getString(key); + + static Future setString(String key, String value) { + return instance.setString(key, value); + } + + static int getInt(String key, {int defaultValue = 0}) { + return instance.getInt(key) ?? defaultValue; + } + + static Future setInt(String key, int value) { + return instance.setInt(key, value); + } + + static bool getBool(String key, {bool defaultValue = false}) { + return instance.getBool(key) ?? defaultValue; + } + + static Future setBool(String key, bool value) { + return instance.setBool(key, value); + } + + static List getStringList(String key) { + return instance.getStringList(key) ?? const []; + } + + static Future setStringList(String key, List value) { + return instance.setStringList(key, value); + } + + static Map? getJson(String key) { + final raw = instance.getString(key); + if (raw == null || raw.isEmpty) return null; + final decoded = jsonDecode(raw); + return decoded is Map ? decoded : null; + } + + static Future setJson(String key, Map value) { + return instance.setString(key, jsonEncode(value)); + } + + static bool containsKey(String key) => instance.containsKey(key); + + static Future remove(String key) => instance.remove(key); + + static Future clear() => instance.clear(); +} diff --git a/lib/core/cache/storage_keys.dart b/lib/core/cache/storage_keys.dart new file mode 100644 index 0000000..973b8aa --- /dev/null +++ b/lib/core/cache/storage_keys.dart @@ -0,0 +1,9 @@ +class StorageKeys { + StorageKeys._(); + + static const authToken = 'auth_token'; + static const locale = 'locale'; + static const themeMode = 'theme_mode'; + static const offlineQueue = 'offline_queue'; + static const offlineDeadQueue = 'offline_dead_queue'; +} diff --git a/lib/core/extensions/context_extensions.dart b/lib/core/extensions/context_extensions.dart new file mode 100644 index 0000000..f7c951c --- /dev/null +++ b/lib/core/extensions/context_extensions.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +extension BuildContextX on BuildContext { + ThemeData get theme => Theme.of(this); + ColorScheme get colors => theme.colorScheme; + TextTheme get textTheme => theme.textTheme; + Size get screenSize => MediaQuery.sizeOf(this); + EdgeInsets get safePadding => MediaQuery.paddingOf(this); + + bool get isDarkMode => theme.brightness == Brightness.dark; + bool get isKeyboardVisible => MediaQuery.viewInsetsOf(this).bottom > 0; + + void hideKeyboard() { + FocusManager.instance.primaryFocus?.unfocus(); + } +} diff --git a/lib/core/logging/app_logger.dart b/lib/core/logging/app_logger.dart new file mode 100644 index 0000000..9663070 --- /dev/null +++ b/lib/core/logging/app_logger.dart @@ -0,0 +1,20 @@ +import 'package:flutter/foundation.dart'; + +class AppLogger { + AppLogger._(); + + static void debug(Object? message, {Object? error, StackTrace? stackTrace}) { + if (!kDebugMode) return; + debugPrint('[DEBUG] $message'); + if (error != null) debugPrint('[ERROR] $error'); + if (stackTrace != null) debugPrint(stackTrace.toString()); + } + + static void info(Object? message) { + if (kDebugMode) debugPrint('[INFO] $message'); + } + + static void warning(Object? message) { + if (kDebugMode) debugPrint('[WARN] $message'); + } +} diff --git a/lib/core/mixins/stream_subscription_mixin.dart b/lib/core/mixins/stream_subscription_mixin.dart new file mode 100644 index 0000000..9a60112 --- /dev/null +++ b/lib/core/mixins/stream_subscription_mixin.dart @@ -0,0 +1,20 @@ +import 'dart:async'; + +import 'package:flutter/widgets.dart'; + +mixin StreamSubscriptionMixin on State { + final List> _subscriptions = []; + + void addSubscription(StreamSubscription subscription) { + _subscriptions.add(subscription); + } + + @override + void dispose() { + for (final subscription in _subscriptions) { + subscription.cancel(); + } + _subscriptions.clear(); + super.dispose(); + } +} diff --git a/lib/core/network/api_client.dart b/lib/core/network/api_client.dart new file mode 100644 index 0000000..0cd1456 --- /dev/null +++ b/lib/core/network/api_client.dart @@ -0,0 +1,126 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter_template/core/network/api_exception.dart'; +import 'package:flutter_template/core/network/api_response.dart'; +import 'package:flutter_template/core/network/http_method.dart'; + +typedef JsonParser = T Function(dynamic json); + +class ApiClient { + const ApiClient(this._dio); + + final Dio _dio; + + Future request( + String path, { + HttpMethod method = HttpMethod.get, + Map? queryParameters, + Object? data, + Map? headers, + JsonParser? parser, + bool wrapResponse = true, + CancelToken? cancelToken, + ProgressCallback? onSendProgress, + }) async { + try { + final response = await _dio.request( + path, + queryParameters: queryParameters, + data: data, + cancelToken: cancelToken, + onSendProgress: onSendProgress, + options: Options(method: method.value, headers: headers), + ); + + final raw = _decodeIfNeeded(response.data); + if (!wrapResponse) { + return _parseData(raw, parser); + } + + if (raw is! Map) { + return _parseData(raw, parser); + } + + final wrapped = ApiResponse.fromJson(raw, fromJsonT: parser); + if (!wrapped.isSuccess) { + throw ApiException( + code: wrapped.code, + statusCode: response.statusCode, + message: wrapped.message.isEmpty ? '请求失败' : wrapped.message, + details: raw, + ); + } + + return wrapped.data as T; + } on DioException catch (error) { + throw _mapDioException(error); + } + } + + Future get( + String path, { + Map? queryParameters, + JsonParser? parser, + bool wrapResponse = true, + }) { + return request( + path, + method: HttpMethod.get, + queryParameters: queryParameters, + parser: parser, + wrapResponse: wrapResponse, + ); + } + + Future post( + String path, { + Object? data, + JsonParser? parser, + bool wrapResponse = true, + }) { + return request( + path, + method: HttpMethod.post, + data: data, + parser: parser, + wrapResponse: wrapResponse, + ); + } + + dynamic _decodeIfNeeded(dynamic data) { + if (data is String) { + try { + return jsonDecode(data); + } catch (_) { + return data; + } + } + return data; + } + + T _parseData(dynamic data, JsonParser? parser) { + if (parser != null) return parser(data); + return data as T; + } + + ApiException _mapDioException(DioException error) { + final statusCode = error.response?.statusCode; + final message = switch (error.type) { + DioExceptionType.connectionTimeout => '网络连接超时', + DioExceptionType.sendTimeout => '请求发送超时', + DioExceptionType.receiveTimeout => '响应接收超时', + DioExceptionType.badCertificate => '证书校验失败', + DioExceptionType.badResponse => '服务器响应异常', + DioExceptionType.cancel => '请求已取消', + DioExceptionType.connectionError => '网络连接不可用', + DioExceptionType.unknown => '网络请求失败', + }; + + return ApiException( + message: message, + statusCode: statusCode, + details: error, + ); + } +} diff --git a/lib/core/network/api_exception.dart b/lib/core/network/api_exception.dart new file mode 100644 index 0000000..c73779f --- /dev/null +++ b/lib/core/network/api_exception.dart @@ -0,0 +1,23 @@ +class ApiException implements Exception { + const ApiException({ + required this.message, + this.code, + this.statusCode, + this.details, + }); + + final String message; + final int? code; + final int? statusCode; + final Object? details; + + @override + String toString() { + final parts = [ + if (statusCode != null) 'status=$statusCode', + if (code != null) 'code=$code', + message, + ]; + return 'ApiException(${parts.join(', ')})'; + } +} diff --git a/lib/core/network/api_response.dart b/lib/core/network/api_response.dart new file mode 100644 index 0000000..bcd55d9 --- /dev/null +++ b/lib/core/network/api_response.dart @@ -0,0 +1,49 @@ +class ApiResponse { + const ApiResponse({required this.code, required this.message, this.data}); + + final int code; + final String message; + final T? data; + + bool get isSuccess => code >= 200 && code < 300; + + factory ApiResponse.fromJson( + Map json, { + T Function(dynamic json)? fromJsonT, + }) { + return ApiResponse( + code: (json['code'] as num?)?.toInt() ?? 200, + message: (json['message'] ?? json['msg'] ?? '').toString(), + data: fromJsonT == null ? json['data'] as T? : fromJsonT(json['data']), + ); + } +} + +class PageResponse { + const PageResponse({ + required this.items, + required this.total, + this.page, + this.pageSize, + }); + + final List items; + final int total; + final int? page; + final int? pageSize; + + bool get isEmpty => items.isEmpty; + + factory PageResponse.fromJson( + Map json, { + required T Function(dynamic json) fromJsonT, + }) { + final rawItems = json['items'] ?? json['rows'] ?? json['list'] ?? const []; + return PageResponse( + items: rawItems is List ? rawItems.map(fromJsonT).toList() : [], + total: (json['total'] as num?)?.toInt() ?? 0, + page: (json['page'] as num?)?.toInt(), + pageSize: (json['pageSize'] as num?)?.toInt(), + ); + } +} diff --git a/lib/core/network/header_interceptor.dart b/lib/core/network/header_interceptor.dart new file mode 100644 index 0000000..9dc287a --- /dev/null +++ b/lib/core/network/header_interceptor.dart @@ -0,0 +1,31 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter_template/app/config/app_config.dart'; +import 'package:flutter_template/core/cache/app_storage.dart'; +import 'package:flutter_template/core/cache/storage_keys.dart'; +import 'package:flutter_template/core/utils/device_utils.dart'; + +class HeaderInterceptor extends Interceptor { + @override + Future onRequest( + RequestOptions options, + RequestInterceptorHandler handler, + ) async { + final token = AppStorage.getString(StorageKeys.authToken); + if (token != null && token.isNotEmpty) { + options.headers['Authorization'] = 'Bearer $token'; + } + + final packageInfo = AppConfig.packageInfo; + final device = await DeviceUtils.deviceInfo(); + options.headers.addAll({ + 'platform': Platform.operatingSystem, + if (packageInfo != null) 'appVersion': packageInfo.version, + 'environment': AppConfig.current.environment.name, + ...device, + }); + + handler.next(options); + } +} diff --git a/lib/core/network/http_method.dart b/lib/core/network/http_method.dart new file mode 100644 index 0000000..bc889c4 --- /dev/null +++ b/lib/core/network/http_method.dart @@ -0,0 +1,11 @@ +enum HttpMethod { + get('GET'), + post('POST'), + put('PUT'), + patch('PATCH'), + delete('DELETE'); + + const HttpMethod(this.value); + + final String value; +} diff --git a/lib/core/network/network_monitor.dart b/lib/core/network/network_monitor.dart new file mode 100644 index 0000000..a91e858 --- /dev/null +++ b/lib/core/network/network_monitor.dart @@ -0,0 +1,58 @@ +import 'dart:async'; + +import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_template/core/network/network_state.dart'; + +class NetworkMonitor { + final _controller = StreamController.broadcast(); + final _connectivity = Connectivity(); + + StreamSubscription>? _subscription; + NetworkState _state = const NetworkState(Reachability.unknown); + + Stream get stream => _controller.stream; + NetworkState get current => _state; + + void start() { + try { + _subscription = _connectivity.onConnectivityChanged.listen( + (results) => _setOnline(_isOnline(results)), + onError: (Object error, StackTrace stackTrace) { + debugPrint('[NetworkMonitor] connectivity error: $error'); + }, + ); + + _connectivity.checkConnectivity().then( + (results) => _setOnline(_isOnline(results)), + onError: (Object error, StackTrace stackTrace) { + debugPrint('[NetworkMonitor] check error: $error'); + }, + ); + } on MissingPluginException catch (error) { + debugPrint('[NetworkMonitor] plugin unavailable: $error'); + } + } + + bool _isOnline(List results) { + if (results.isEmpty) return false; + if (results.contains(ConnectivityResult.none)) return false; + return true; + } + + void _setOnline(bool online) { + final next = NetworkState( + online ? Reachability.online : Reachability.offline, + ); + if (next.reachability == _state.reachability) return; + + _state = next; + _controller.add(_state); + } + + void dispose() { + _subscription?.cancel(); + _controller.close(); + } +} diff --git a/lib/core/network/network_state.dart b/lib/core/network/network_state.dart new file mode 100644 index 0000000..e066e8a --- /dev/null +++ b/lib/core/network/network_state.dart @@ -0,0 +1,11 @@ +enum Reachability { unknown, online, offline } + +class NetworkState { + const NetworkState(this.reachability); + + final Reachability reachability; + + bool get isOnline => reachability == Reachability.online; + bool get isOffline => reachability == Reachability.offline; + bool get isUnknown => reachability == Reachability.unknown; +} diff --git a/lib/core/network/offline_queue/offline_queue_interceptor.dart b/lib/core/network/offline_queue/offline_queue_interceptor.dart new file mode 100644 index 0000000..099e75d --- /dev/null +++ b/lib/core/network/offline_queue/offline_queue_interceptor.dart @@ -0,0 +1,61 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_template/core/network/network_monitor.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_queue_manager.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_request.dart'; +import 'package:uuid/uuid.dart'; + +class OfflineQueueInterceptor extends Interceptor { + OfflineQueueInterceptor({ + required this.monitor, + required this.manager, + this.enabled = false, + }); + + final NetworkMonitor monitor; + final OfflineQueueManager manager; + final bool enabled; + + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) { + if (!enabled || options.extra['offline'] != true) { + handler.next(options); + return; + } + + if (options.extra['replay'] == true || monitor.current.isUnknown) { + handler.next(options); + return; + } + + if (monitor.current.isOffline) { + final extra = options.extra; + final request = OfflineRequest( + id: const Uuid().v4(), + idempotencyKey: (extra['idempotencyKey'] ?? const Uuid().v4()) + .toString(), + method: options.method, + path: options.path, + query: options.queryParameters, + body: options.data, + headers: Map.from(options.headers), + priority: QueuePriority + .values[(extra['priority'] as int?) ?? QueuePriority.normal.index], + category: + QueueCategory.values[(extra['category'] as int?) ?? + QueueCategory.userAction.index], + ); + + manager.enqueue(request); + handler.reject( + DioException( + requestOptions: options, + type: DioExceptionType.cancel, + message: 'OFFLINE_QUEUED', + ), + ); + return; + } + + handler.next(options); + } +} diff --git a/lib/core/network/offline_queue/offline_queue_manager.dart b/lib/core/network/offline_queue/offline_queue_manager.dart new file mode 100644 index 0000000..8f518a4 --- /dev/null +++ b/lib/core/network/offline_queue/offline_queue_manager.dart @@ -0,0 +1,141 @@ +import 'dart:async'; + +import 'package:dio/dio.dart'; +import 'package:flutter_template/core/logging/app_logger.dart'; +import 'package:flutter_template/core/network/network_monitor.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_queue_state.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_queue_storage.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_request.dart'; + +class OfflineQueueManager { + OfflineQueueManager({ + required this.dio, + required this.monitor, + required this.storage, + }); + + final Dio dio; + final NetworkMonitor monitor; + final OfflineQueueStorage storage; + + final _queue = []; + final _dead = []; + final _stateController = StreamController.broadcast(); + + StreamSubscription? _networkSubscription; + Timer? _replayDebounceTimer; + bool _replaying = false; + + Stream get stateStream => _stateController.stream; + + Future init() async { + _queue.addAll(await storage.loadQueue()); + _dead.addAll(await storage.loadDead()); + _sort(); + _emit(); + + _networkSubscription = monitor.stream.listen((state) { + if (state.isOffline) { + _replayDebounceTimer?.cancel(); + return; + } + + if (state.isOnline) { + _replayDebounceTimer?.cancel(); + _replayDebounceTimer = Timer(const Duration(seconds: 2), replay); + } + }); + } + + Future enqueue(OfflineRequest request) async { + if (_isDuplicate(request)) return; + + _queue.add(request); + _sort(); + await storage.saveQueue(_queue); + _emit(); + } + + Future replay() async { + if (!monitor.current.isOnline || _replaying || _queue.isEmpty) return; + + _replaying = true; + _emit(); + + try { + while (_queue.isNotEmpty && monitor.current.isOnline) { + final request = _queue.first; + try { + await dio.request( + request.path, + data: request.body, + queryParameters: request.query, + options: Options( + method: request.method, + headers: request.headers, + extra: const {'replay': true, 'offline': false}, + ), + ); + _queue.removeAt(0); + await storage.saveQueue(_queue); + _emit(); + } catch (error, stackTrace) { + AppLogger.debug( + 'Offline replay failed: ${request.method} ${request.path}', + error: error, + stackTrace: stackTrace, + ); + final updated = request.copyWith(retryCount: request.retryCount + 1); + _queue.removeAt(0); + if (updated.isDead) { + _dead.add(updated); + await storage.saveDead(_dead); + } else { + _queue.add(updated); + _sort(); + } + await storage.saveQueue(_queue); + _emit(); + break; + } + } + } finally { + _replaying = false; + _emit(); + } + } + + bool _isDuplicate(OfflineRequest request) { + return _queue.any( + (item) => + (request.idempotencyKey.isNotEmpty && + item.idempotencyKey == request.idempotencyKey) || + (item.method == request.method && item.path == request.path), + ); + } + + void _sort() { + _queue.sort((a, b) { + final priority = a.priority.index.compareTo(b.priority.index); + return priority != 0 + ? priority + : a.category.index.compareTo(b.category.index); + }); + } + + void _emit() { + _stateController.add( + OfflineQueueState( + pending: _queue.length, + dead: _dead.length, + replaying: _replaying, + ), + ); + } + + void dispose() { + _replayDebounceTimer?.cancel(); + _networkSubscription?.cancel(); + _stateController.close(); + } +} diff --git a/lib/core/network/offline_queue/offline_queue_state.dart b/lib/core/network/offline_queue/offline_queue_state.dart new file mode 100644 index 0000000..86b0245 --- /dev/null +++ b/lib/core/network/offline_queue/offline_queue_state.dart @@ -0,0 +1,13 @@ +class OfflineQueueState { + const OfflineQueueState({ + required this.pending, + required this.dead, + required this.replaying, + }); + + final int pending; + final int dead; + final bool replaying; + + static const empty = OfflineQueueState(pending: 0, dead: 0, replaying: false); +} diff --git a/lib/core/network/offline_queue/offline_queue_storage.dart b/lib/core/network/offline_queue/offline_queue_storage.dart new file mode 100644 index 0000000..c8748d4 --- /dev/null +++ b/lib/core/network/offline_queue/offline_queue_storage.dart @@ -0,0 +1,29 @@ +import 'package:flutter_template/core/cache/app_storage.dart'; +import 'package:flutter_template/core/cache/storage_keys.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_request.dart'; + +class OfflineQueueStorage { + Future> loadQueue() async { + final list = AppStorage.getStringList(StorageKeys.offlineQueue); + return list.map(OfflineRequest.decode).toList(); + } + + Future> loadDead() async { + final list = AppStorage.getStringList(StorageKeys.offlineDeadQueue); + return list.map(OfflineRequest.decode).toList(); + } + + Future saveQueue(List list) async { + await AppStorage.setStringList( + StorageKeys.offlineQueue, + list.map((item) => item.encode()).toList(), + ); + } + + Future saveDead(List list) async { + await AppStorage.setStringList( + StorageKeys.offlineDeadQueue, + list.map((item) => item.encode()).toList(), + ); + } +} diff --git a/lib/core/network/offline_queue/offline_request.dart b/lib/core/network/offline_queue/offline_request.dart new file mode 100644 index 0000000..8c97cd7 --- /dev/null +++ b/lib/core/network/offline_queue/offline_request.dart @@ -0,0 +1,89 @@ +import 'dart:convert'; + +enum QueuePriority { high, normal, low } + +enum QueueCategory { userAction, sync, analytics, log } + +class OfflineRequest { + const OfflineRequest({ + required this.id, + required this.idempotencyKey, + required this.method, + required this.path, + this.query, + this.body, + this.headers, + this.priority = QueuePriority.normal, + this.category = QueueCategory.sync, + this.retryCount = 0, + this.maxRetry = 3, + }); + + final String id; + final String idempotencyKey; + final String method; + final String path; + final Map? query; + final dynamic body; + final Map? headers; + final QueuePriority priority; + final QueueCategory category; + final int retryCount; + final int maxRetry; + + bool get isDead => retryCount >= maxRetry; + + OfflineRequest copyWith({int? retryCount}) { + return OfflineRequest( + id: id, + idempotencyKey: idempotencyKey, + method: method, + path: path, + query: query, + body: body, + headers: headers, + priority: priority, + category: category, + retryCount: retryCount ?? this.retryCount, + maxRetry: maxRetry, + ); + } + + factory OfflineRequest.fromJson(Map json) { + return OfflineRequest( + id: json['id'] as String, + idempotencyKey: json['idempotencyKey'] as String, + method: json['method'] as String, + path: json['path'] as String, + query: (json['query'] as Map?)?.cast(), + body: json['body'], + headers: (json['headers'] as Map?)?.cast(), + priority: QueuePriority.values[(json['priority'] as num).toInt()], + category: QueueCategory.values[(json['category'] as num).toInt()], + retryCount: (json['retryCount'] as num).toInt(), + maxRetry: (json['maxRetry'] as num).toInt(), + ); + } + + Map toJson() { + return { + 'id': id, + 'idempotencyKey': idempotencyKey, + 'method': method, + 'path': path, + 'query': query, + 'body': body, + 'headers': headers, + 'priority': priority.index, + 'category': category.index, + 'retryCount': retryCount, + 'maxRetry': maxRetry, + }; + } + + String encode() => jsonEncode(toJson()); + + static OfflineRequest decode(String raw) { + return OfflineRequest.fromJson(jsonDecode(raw) as Map); + } +} diff --git a/lib/core/network/providers/dio_providers.dart b/lib/core/network/providers/dio_providers.dart new file mode 100644 index 0000000..23bb29c --- /dev/null +++ b/lib/core/network/providers/dio_providers.dart @@ -0,0 +1,42 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_template/app/config/app_config.dart'; +import 'package:flutter_template/core/network/api_client.dart'; +import 'package:flutter_template/core/network/header_interceptor.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_queue_interceptor.dart'; +import 'package:flutter_template/core/network/providers/network_providers.dart'; +import 'package:flutter_template/core/network/providers/offline_queue_providers.dart'; + +final dioProvider = Provider((ref) { + final dio = Dio( + BaseOptions( + baseUrl: AppConfig.current.baseUrl, + connectTimeout: const Duration(seconds: 30), + receiveTimeout: const Duration(seconds: 30), + sendTimeout: const Duration(seconds: 30), + responseType: ResponseType.json, + ), + ); + + dio.interceptors.add(HeaderInterceptor()); + + final monitor = ref.watch(networkMonitorProvider); + final queueManager = ref.watch(offlineQueueManagerProvider); + dio.interceptors.add( + OfflineQueueInterceptor( + monitor: monitor, + manager: queueManager, + enabled: false, + ), + ); + + if (AppConfig.current.enableNetworkLog) { + dio.interceptors.add(LogInterceptor(requestBody: true, responseBody: true)); + } + + return dio; +}); + +final apiClientProvider = Provider((ref) { + return ApiClient(ref.watch(dioProvider)); +}); diff --git a/lib/core/network/providers/network_providers.dart b/lib/core/network/providers/network_providers.dart new file mode 100644 index 0000000..0ca8449 --- /dev/null +++ b/lib/core/network/providers/network_providers.dart @@ -0,0 +1,14 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_template/core/network/network_monitor.dart'; +import 'package:flutter_template/core/network/network_state.dart'; + +final networkMonitorProvider = Provider((ref) { + final monitor = NetworkMonitor()..start(); + ref.onDispose(monitor.dispose); + return monitor; +}); + +final networkStateProvider = StreamProvider((ref) { + final monitor = ref.watch(networkMonitorProvider); + return monitor.stream; +}); diff --git a/lib/core/network/providers/offline_queue_providers.dart b/lib/core/network/providers/offline_queue_providers.dart new file mode 100644 index 0000000..c2019e9 --- /dev/null +++ b/lib/core/network/providers/offline_queue_providers.dart @@ -0,0 +1,29 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_queue_manager.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_queue_state.dart'; +import 'package:flutter_template/core/network/offline_queue/offline_queue_storage.dart'; +import 'package:flutter_template/core/network/providers/network_providers.dart'; +import 'package:dio/dio.dart'; + +final offlineQueueStorageProvider = Provider((ref) { + return OfflineQueueStorage(); +}); + +final offlineQueueDioProvider = Provider((ref) { + return Dio(); +}); + +final offlineQueueManagerProvider = Provider((ref) { + final manager = OfflineQueueManager( + dio: ref.watch(offlineQueueDioProvider), + monitor: ref.watch(networkMonitorProvider), + storage: ref.watch(offlineQueueStorageProvider), + ); + manager.init(); + ref.onDispose(manager.dispose); + return manager; +}); + +final offlineQueueStateProvider = StreamProvider((ref) { + return ref.watch(offlineQueueManagerProvider).stateStream; +}); diff --git a/lib/core/permission/permission_service.dart b/lib/core/permission/permission_service.dart new file mode 100644 index 0000000..c5b5f37 --- /dev/null +++ b/lib/core/permission/permission_service.dart @@ -0,0 +1,33 @@ +import 'package:permission_handler/permission_handler.dart'; + +class PermissionService { + PermissionService._(); + + static Future request(Permission permission) async { + final status = await permission.status; + if (status.isGranted || status.isLimited) return true; + + final next = await permission.request(); + return next.isGranted || next.isLimited; + } + + static Future> requestAll( + Iterable permissions, + ) { + return permissions.toList().request(); + } + + static Future ensure( + Permission permission, { + bool openSettingsWhenPermanentlyDenied = true, + }) async { + final granted = await request(permission); + if (granted) return true; + + final status = await permission.status; + if (openSettingsWhenPermanentlyDenied && status.isPermanentlyDenied) { + await openAppSettings(); + } + return false; + } +} diff --git a/lib/core/utils/date_time_formatter.dart b/lib/core/utils/date_time_formatter.dart new file mode 100644 index 0000000..6ff1836 --- /dev/null +++ b/lib/core/utils/date_time_formatter.dart @@ -0,0 +1,34 @@ +import 'package:intl/intl.dart'; + +class DateTimeFormatter { + DateTimeFormatter._(); + + static String format( + DateTime? value, { + String pattern = 'yyyy-MM-dd HH:mm', + String locale = 'zh_CN', + }) { + if (value == null) return ''; + return DateFormat(pattern, locale).format(value); + } + + static String dayOrDate(String? isoString, {DateTime? now}) { + if (isoString == null || isoString.trim().isEmpty) return ''; + + final parsed = DateTime.tryParse(isoString)?.toLocal(); + if (parsed == null) return ''; + + final current = (now ?? DateTime.now()).toLocal(); + final currentDate = DateTime(current.year, current.month, current.day); + final parsedDate = DateTime(parsed.year, parsed.month, parsed.day); + final diffDays = currentDate.difference(parsedDate).inDays; + + final time = DateFormat('HH:mm').format(parsed); + return switch (diffDays) { + 0 => '今天 $time', + 1 => '昨天 $time', + 2 => '前天 $time', + _ => DateFormat('yyyy-MM-dd').format(parsed), + }; + } +} diff --git a/lib/core/utils/device_utils.dart b/lib/core/utils/device_utils.dart new file mode 100644 index 0000000..cb3fa0b --- /dev/null +++ b/lib/core/utils/device_utils.dart @@ -0,0 +1,54 @@ +import 'dart:io'; + +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:flutter/material.dart'; + +class DeviceUtils { + DeviceUtils._(); + + static double screenWidth(BuildContext context) => + MediaQuery.sizeOf(context).width; + + static double screenHeight(BuildContext context) => + MediaQuery.sizeOf(context).height; + + static double topSafePadding(BuildContext context) => + MediaQuery.paddingOf(context).top; + + static double bottomSafePadding(BuildContext context) => + MediaQuery.paddingOf(context).bottom; + + static Future isPhysicalDevice() async { + final plugin = DeviceInfoPlugin(); + if (Platform.isAndroid) { + return (await plugin.androidInfo).isPhysicalDevice; + } + if (Platform.isIOS) { + return (await plugin.iosInfo).isPhysicalDevice; + } + return true; + } + + static Future> deviceInfo() async { + final plugin = DeviceInfoPlugin(); + if (Platform.isAndroid) { + final info = await plugin.androidInfo; + return { + 'platform': 'android', + 'brand': info.brand, + 'model': info.model, + 'systemVersion': info.version.release, + }; + } + if (Platform.isIOS) { + final info = await plugin.iosInfo; + return { + 'platform': 'ios', + 'brand': info.systemName, + 'model': info.utsname.machine, + 'systemVersion': info.systemVersion, + }; + } + return {'platform': Platform.operatingSystem}; + } +} diff --git a/lib/core/utils/form_validators.dart b/lib/core/utils/form_validators.dart new file mode 100644 index 0000000..0cfd71d --- /dev/null +++ b/lib/core/utils/form_validators.dart @@ -0,0 +1,25 @@ +class FormValidators { + FormValidators._(); + + static String? required(String? value, {String message = '请输入内容'}) { + if (value == null || value.trim().isEmpty) return message; + return null; + } + + static String? email(String? value, {String message = '请输入有效邮箱'}) { + if (value == null || value.trim().isEmpty) return null; + final regex = RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'); + return regex.hasMatch(value.trim()) ? null : message; + } + + static String? phoneCN(String? value, {String message = '请输入有效手机号'}) { + if (value == null || value.trim().isEmpty) return null; + final regex = RegExp(r'^1[3-9]\d{9}$'); + return regex.hasMatch(value.trim()) ? null : message; + } + + static String? minLength(String? value, int min, {String? message}) { + if (value == null || value.isEmpty) return null; + return value.length >= min ? null : message ?? '至少输入 $min 个字符'; + } +} diff --git a/lib/core/utils/rate_limiter.dart b/lib/core/utils/rate_limiter.dart new file mode 100644 index 0000000..e741764 --- /dev/null +++ b/lib/core/utils/rate_limiter.dart @@ -0,0 +1,166 @@ +import 'dart:async'; + +enum RateLimitMode { debounce, throttle } + +class ThrottleOptions { + const ThrottleOptions({this.leading = true, this.trailing = true}); + + final bool leading; + final bool trailing; +} + +class DebounceThrottle { + DebounceThrottle({ + required this.duration, + required this.mode, + this.onCallback, + this.throttleOptions = const ThrottleOptions(), + }); + + final Duration duration; + final RateLimitMode mode; + final void Function(T value)? onCallback; + final ThrottleOptions throttleOptions; + + Timer? _timer; + T? _lastValue; + DateTime? _lastExecuteTime; + bool _waitingTrailing = false; + + void call(T value) { + _lastValue = value; + switch (mode) { + case RateLimitMode.debounce: + _debounce(value); + case RateLimitMode.throttle: + _throttle(value); + } + } + + void _debounce(T value) { + _timer?.cancel(); + _timer = Timer(duration, () { + onCallback?.call(value); + _lastExecuteTime = DateTime.now(); + }); + } + + void _throttle(T value) { + final now = DateTime.now(); + final last = _lastExecuteTime; + final inWindow = last != null && now.difference(last) < duration; + + if (!inWindow && throttleOptions.leading) { + onCallback?.call(value); + _lastExecuteTime = now; + _waitingTrailing = false; + _timer?.cancel(); + return; + } + + if (!throttleOptions.trailing || _waitingTrailing) return; + + _waitingTrailing = true; + final remaining = last == null ? duration : duration - now.difference(last); + _timer?.cancel(); + _timer = Timer(remaining, () { + final value = _lastValue; + if (value != null) onCallback?.call(value); + _lastExecuteTime = DateTime.now(); + _waitingTrailing = false; + }); + } + + void flush() { + _timer?.cancel(); + final value = _lastValue; + if (value != null) { + onCallback?.call(value); + _lastExecuteTime = DateTime.now(); + } + _lastValue = null; + _waitingTrailing = false; + } + + void cancel() { + _timer?.cancel(); + _lastValue = null; + _waitingTrailing = false; + } + + void dispose() => cancel(); +} + +class RateLimitHub { + RateLimitHub({this.removeDebouncerOnDone = true}); + + final bool removeDebouncerOnDone; + final Map> _debouncers = {}; + final Map> _throttlers = {}; + + void debounce({ + required Object key, + required T value, + Duration duration = const Duration(milliseconds: 300), + required void Function(T value) onCallback, + }) { + _debouncers[key]?.cancel(); + + late DebounceThrottle limiter; + limiter = DebounceThrottle( + duration: duration, + mode: RateLimitMode.debounce, + onCallback: (value) { + onCallback(value); + if (removeDebouncerOnDone) _debouncers.remove(key); + }, + ); + + _debouncers[key] = limiter; + limiter(value); + } + + void throttle({ + required Object key, + required T value, + Duration duration = const Duration(milliseconds: 300), + ThrottleOptions options = const ThrottleOptions(), + required void Function(T value) onCallback, + }) { + _throttlers.putIfAbsent( + key, + () => + DebounceThrottle( + duration: duration, + mode: RateLimitMode.throttle, + throttleOptions: options, + onCallback: onCallback, + ) + as DebounceThrottle, + ); + + (_throttlers[key] as DebounceThrottle)(value); + } + + void cancel(Object key) { + _debouncers.remove(key)?.cancel(); + _throttlers.remove(key)?.cancel(); + } + + void clear() { + for (final limiter in _debouncers.values) { + limiter.dispose(); + } + for (final limiter in _throttlers.values) { + limiter.dispose(); + } + _debouncers.clear(); + _throttlers.clear(); + } +} + +class RateLimit { + RateLimit._(); + + static final instance = RateLimitHub(); +} diff --git a/lib/core/utils/url_utils.dart b/lib/core/utils/url_utils.dart new file mode 100644 index 0000000..9d6fa48 --- /dev/null +++ b/lib/core/utils/url_utils.dart @@ -0,0 +1,19 @@ +class UrlUtils { + UrlUtils._(); + + static String buildQueryString(Map? params) { + if (params == null || params.isEmpty) return ''; + + final queryParams = {}; + for (final entry in params.entries) { + final value = entry.value; + if (value == null) continue; + if (value is String || value is num || value is bool) { + queryParams[entry.key] = value.toString(); + } + } + + if (queryParams.isEmpty) return ''; + return '?${Uri(queryParameters: queryParams).query}'; + } +} diff --git a/lib/features/demo/demo_controller.dart b/lib/features/demo/demo_controller.dart new file mode 100644 index 0000000..4c67782 --- /dev/null +++ b/lib/features/demo/demo_controller.dart @@ -0,0 +1,29 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +class DemoState { + const DemoState({this.count = 0, this.query = ''}); + + final int count; + final String query; + + DemoState copyWith({int? count, String? query}) { + return DemoState(count: count ?? this.count, query: query ?? this.query); + } +} + +class DemoController extends Notifier { + @override + DemoState build() => const DemoState(); + + void increment() { + state = state.copyWith(count: state.count + 1); + } + + void updateQuery(String query) { + state = state.copyWith(query: query); + } +} + +final demoControllerProvider = NotifierProvider( + DemoController.new, +); diff --git a/lib/features/demo/demo_page.dart b/lib/features/demo/demo_page.dart new file mode 100644 index 0000000..7f1f825 --- /dev/null +++ b/lib/features/demo/demo_page.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_template/app/theme/app_theme.dart'; +import 'package:flutter_template/features/demo/demo_controller.dart'; +import 'package:flutter_template/shared/widgets/widgets.dart'; + +class DemoPage extends ConsumerWidget { + const DemoPage({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final state = ref.watch(demoControllerProvider); + final controller = ref.read(demoControllerProvider.notifier); + + return Scaffold( + appBar: AppBar(title: const Text('Flutter Template')), + body: SafeAreaWrapper( + child: ListView( + padding: const EdgeInsets.all(AppSpacing.lg), + children: [ + AppSearchBar(hint: '搜索模板组件', onChanged: controller.updateQuery), + const SizedBox(height: AppSpacing.lg), + AppCard( + child: Row( + children: [ + const AppAvatar(initials: 'T', size: 48), + const SizedBox(width: AppSpacing.md), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '通用 Flutter 快速开发模板', + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 4), + Text( + '已内置网络、缓存、路由、主题、权限、日志和常用 UI 组件。', + style: Theme.of(context).textTheme.bodyMedium + ?.copyWith( + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ), + const SizedBox(height: AppSpacing.md), + Wrap( + spacing: 8, + runSpacing: 8, + children: const [ + AppTag(label: 'Riverpod', tone: AppTagTone.info), + AppTag(label: 'Dio', tone: AppTagTone.success), + AppTag(label: '缓存', tone: AppTagTone.warning), + AppTag(label: '无业务代码'), + ], + ), + const SizedBox(height: AppSpacing.lg), + AppCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '状态管理示例', + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: AppSpacing.sm), + Text('当前计数:${state.count}'), + if (state.query.isNotEmpty) ...[ + const SizedBox(height: AppSpacing.sm), + Text('搜索关键字:${state.query}'), + ], + const SizedBox(height: AppSpacing.md), + AppButton( + label: '增加计数', + icon: const Icon(Icons.add, size: 18), + onPressed: controller.increment, + ), + ], + ), + ), + const SizedBox(height: AppSpacing.lg), + AppStatusView( + status: AppViewStatus.empty, + empty: AppEmptyView( + title: '空状态组件', + message: '业务项目可替换图标、文案和操作按钮。', + action: AppButton( + label: '显示确认弹窗', + variant: AppButtonVariant.outline, + icon: const Icon(Icons.open_in_new, size: 18), + onPressed: () async { + final confirmed = await AppDialog.confirm( + context, + title: '模板弹窗', + message: '这是可复用的确认弹窗示例。', + ); + if (confirmed == true) { + AppToast.show('已确认'); + } + }, + ), + ), + child: const SizedBox.shrink(), + ), + ], + ), + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..a0077f4 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,3 @@ +import 'package:flutter_template/app/bootstrap.dart'; + +Future main() => AppBootstrapper.bootstrap(); diff --git a/lib/shared/widgets/app_avatar.dart b/lib/shared/widgets/app_avatar.dart new file mode 100644 index 0000000..bcd50e2 --- /dev/null +++ b/lib/shared/widgets/app_avatar.dart @@ -0,0 +1,37 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_template/shared/widgets/app_network_image.dart'; + +class AppAvatar extends StatelessWidget { + const AppAvatar({super.key, this.imageUrl, this.initials, this.size = 40}); + + final String? imageUrl; + final String? initials; + final double size; + + @override + Widget build(BuildContext context) { + final radius = BorderRadius.circular(size / 2); + return ClipRRect( + borderRadius: radius, + child: SizedBox.square( + dimension: size, + child: imageUrl == null || imageUrl!.isEmpty + ? ColoredBox( + color: Theme.of(context).colorScheme.primaryContainer, + child: Center( + child: Text( + (initials == null || initials!.isEmpty) + ? 'A' + : initials!.characters.first.toUpperCase(), + style: TextStyle( + color: Theme.of(context).colorScheme.onPrimaryContainer, + fontWeight: FontWeight.w700, + ), + ), + ), + ) + : AppNetworkImage(url: imageUrl!, fit: BoxFit.cover), + ), + ); + } +} diff --git a/lib/shared/widgets/app_button.dart b/lib/shared/widgets/app_button.dart new file mode 100644 index 0000000..5b70df4 --- /dev/null +++ b/lib/shared/widgets/app_button.dart @@ -0,0 +1,100 @@ +import 'package:flutter/material.dart'; + +enum AppButtonVariant { primary, secondary, outline, text, danger } + +class AppButton extends StatelessWidget { + const AppButton({ + super.key, + required this.label, + this.onPressed, + this.icon, + this.variant = AppButtonVariant.primary, + this.isLoading = false, + this.expand = false, + this.height = 44, + }); + + final String label; + final VoidCallback? onPressed; + final Widget? icon; + final AppButtonVariant variant; + final bool isLoading; + final bool expand; + final double height; + + @override + Widget build(BuildContext context) { + final child = _ButtonContent( + label: label, + icon: icon, + isLoading: isLoading, + ); + final enabled = isLoading ? null : onPressed; + final size = Size(expand ? double.infinity : 0, height); + + return switch (variant) { + AppButtonVariant.primary => ElevatedButton( + onPressed: enabled, + style: ElevatedButton.styleFrom(minimumSize: size), + child: child, + ), + AppButtonVariant.secondary => FilledButton.tonal( + onPressed: enabled, + style: FilledButton.styleFrom(minimumSize: size), + child: child, + ), + AppButtonVariant.outline => OutlinedButton( + onPressed: enabled, + style: OutlinedButton.styleFrom(minimumSize: size), + child: child, + ), + AppButtonVariant.text => TextButton( + onPressed: enabled, + style: TextButton.styleFrom(minimumSize: size), + child: child, + ), + AppButtonVariant.danger => FilledButton( + onPressed: enabled, + style: FilledButton.styleFrom( + minimumSize: size, + backgroundColor: Theme.of(context).colorScheme.error, + ), + child: child, + ), + }; + } +} + +class _ButtonContent extends StatelessWidget { + const _ButtonContent({ + required this.label, + required this.isLoading, + this.icon, + }); + + final String label; + final Widget? icon; + final bool isLoading; + + @override + Widget build(BuildContext context) { + if (isLoading) { + return const SizedBox.square( + dimension: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ); + } + + if (icon == null) return Text(label); + + return Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + icon!, + const SizedBox(width: 8), + Flexible(child: Text(label, overflow: TextOverflow.ellipsis)), + ], + ); + } +} diff --git a/lib/shared/widgets/app_card.dart b/lib/shared/widgets/app_card.dart new file mode 100644 index 0000000..d7989e6 --- /dev/null +++ b/lib/shared/widgets/app_card.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_template/app/theme/app_theme.dart'; + +class AppCard extends StatelessWidget { + const AppCard({ + super.key, + required this.child, + this.padding = const EdgeInsets.all(AppSpacing.lg), + this.margin, + this.onTap, + }); + + final Widget child; + final EdgeInsetsGeometry padding; + final EdgeInsetsGeometry? margin; + final VoidCallback? onTap; + + @override + Widget build(BuildContext context) { + final card = Container( + margin: margin, + padding: padding, + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: AppTheme.border), + ), + child: child, + ); + + if (onTap == null) return card; + + return InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(8), + child: card, + ); + } +} diff --git a/lib/shared/widgets/app_dialog.dart b/lib/shared/widgets/app_dialog.dart new file mode 100644 index 0000000..edff2a4 --- /dev/null +++ b/lib/shared/widgets/app_dialog.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; + +class AppDialog { + AppDialog._(); + + static Future confirm( + BuildContext context, { + String title = '确认操作', + String message = '是否继续?', + String cancelText = '取消', + String confirmText = '确认', + }) { + return showDialog( + context: context, + builder: (context) { + return AlertDialog( + title: Text(title), + content: Text(message), + actions: [ + TextButton( + onPressed: () => Navigator.of(context).pop(false), + child: Text(cancelText), + ), + FilledButton( + onPressed: () => Navigator.of(context).pop(true), + child: Text(confirmText), + ), + ], + ); + }, + ); + } +} diff --git a/lib/shared/widgets/app_empty_view.dart b/lib/shared/widgets/app_empty_view.dart new file mode 100644 index 0000000..08b96c1 --- /dev/null +++ b/lib/shared/widgets/app_empty_view.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; + +class AppEmptyView extends StatelessWidget { + const AppEmptyView({ + super.key, + this.title = '暂无数据', + this.message, + this.icon = Icons.inbox_outlined, + this.action, + }); + + final String title; + final String? message; + final IconData icon; + final Widget? action; + + @override + Widget build(BuildContext context) { + final colors = Theme.of(context).colorScheme; + return Center( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(icon, size: 56, color: colors.outline), + const SizedBox(height: 12), + Text(title, style: Theme.of(context).textTheme.titleMedium), + if (message != null) ...[ + const SizedBox(height: 6), + Text( + message!, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: colors.onSurfaceVariant, + ), + ), + ], + if (action != null) ...[const SizedBox(height: 16), action!], + ], + ), + ), + ); + } +} diff --git a/lib/shared/widgets/app_error_view.dart b/lib/shared/widgets/app_error_view.dart new file mode 100644 index 0000000..d1f0f02 --- /dev/null +++ b/lib/shared/widgets/app_error_view.dart @@ -0,0 +1,53 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_template/shared/widgets/app_button.dart'; + +class AppErrorView extends StatelessWidget { + const AppErrorView({ + super.key, + this.title = '加载失败', + this.message = '请稍后重试', + this.onRetry, + }); + + final String title; + final String message; + final VoidCallback? onRetry; + + @override + Widget build(BuildContext context) { + return Center( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.error_outline, + size: 56, + color: Theme.of(context).colorScheme.error, + ), + const SizedBox(height: 12), + Text(title, style: Theme.of(context).textTheme.titleMedium), + const SizedBox(height: 6), + Text( + message, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + if (onRetry != null) ...[ + const SizedBox(height: 16), + AppButton( + label: '重试', + icon: const Icon(Icons.refresh, size: 18), + variant: AppButtonVariant.outline, + onPressed: onRetry, + ), + ], + ], + ), + ), + ); + } +} diff --git a/lib/shared/widgets/app_loading_view.dart b/lib/shared/widgets/app_loading_view.dart new file mode 100644 index 0000000..f83454d --- /dev/null +++ b/lib/shared/widgets/app_loading_view.dart @@ -0,0 +1,30 @@ +import 'package:flutter/material.dart'; + +class AppLoadingView extends StatelessWidget { + const AppLoadingView({super.key, this.message = '加载中', this.size = 24}); + + final String message; + final double size; + + @override + Widget build(BuildContext context) { + return Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox.square( + dimension: size, + child: const CircularProgressIndicator(strokeWidth: 2.4), + ), + const SizedBox(height: 12), + Text( + message, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ], + ), + ); + } +} diff --git a/lib/shared/widgets/app_network_image.dart b/lib/shared/widgets/app_network_image.dart new file mode 100644 index 0000000..8e19545 --- /dev/null +++ b/lib/shared/widgets/app_network_image.dart @@ -0,0 +1,48 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; + +class AppNetworkImage extends StatelessWidget { + const AppNetworkImage({ + super.key, + required this.url, + this.width, + this.height, + this.fit = BoxFit.cover, + this.borderRadius, + }); + + final String url; + final double? width; + final double? height; + final BoxFit fit; + final BorderRadius? borderRadius; + + @override + Widget build(BuildContext context) { + final image = CachedNetworkImage( + imageUrl: url, + width: width, + height: height, + fit: fit, + placeholder: (_, __) => ColoredBox( + color: Theme.of(context).colorScheme.surfaceContainerHighest, + child: const Center( + child: SizedBox.square( + dimension: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ), + ), + ), + errorWidget: (_, __, ___) => ColoredBox( + color: Theme.of(context).colorScheme.surfaceContainerHighest, + child: Icon( + Icons.image_not_supported_outlined, + color: Theme.of(context).colorScheme.outline, + ), + ), + ); + + if (borderRadius == null) return image; + return ClipRRect(borderRadius: borderRadius!, child: image); + } +} diff --git a/lib/shared/widgets/app_refresh_list.dart b/lib/shared/widgets/app_refresh_list.dart new file mode 100644 index 0000000..72c2333 --- /dev/null +++ b/lib/shared/widgets/app_refresh_list.dart @@ -0,0 +1,80 @@ +import 'package:flutter/material.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; + +class AppRefreshList extends StatefulWidget { + const AppRefreshList({ + super.key, + required this.items, + required this.itemBuilder, + this.onRefresh, + this.onLoadMore, + this.enablePullUp = false, + this.separator, + this.empty, + this.padding, + }); + + final List items; + final Widget Function(BuildContext context, T item, int index) itemBuilder; + final Future Function()? onRefresh; + final Future Function()? onLoadMore; + final bool enablePullUp; + final Widget? separator; + final Widget? empty; + final EdgeInsetsGeometry? padding; + + @override + State> createState() => _AppRefreshListState(); +} + +class _AppRefreshListState extends State> { + final _controller = RefreshController(); + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + Future _refresh() async { + try { + await widget.onRefresh?.call(); + _controller.refreshCompleted(); + } catch (_) { + _controller.refreshFailed(); + } + } + + Future _loadMore() async { + try { + await widget.onLoadMore?.call(); + _controller.loadComplete(); + } catch (_) { + _controller.loadFailed(); + } + } + + @override + Widget build(BuildContext context) { + final child = widget.items.isEmpty && widget.empty != null + ? widget.empty! + : ListView.separated( + padding: widget.padding, + itemCount: widget.items.length, + separatorBuilder: (_, __) => + widget.separator ?? const SizedBox(height: 8), + itemBuilder: (context, index) { + return widget.itemBuilder(context, widget.items[index], index); + }, + ); + + return SmartRefresher( + controller: _controller, + enablePullDown: widget.onRefresh != null, + enablePullUp: widget.enablePullUp && widget.onLoadMore != null, + onRefresh: _refresh, + onLoading: _loadMore, + child: child, + ); + } +} diff --git a/lib/shared/widgets/app_search_bar.dart b/lib/shared/widgets/app_search_bar.dart new file mode 100644 index 0000000..eb9cfea --- /dev/null +++ b/lib/shared/widgets/app_search_bar.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_template/core/utils/rate_limiter.dart'; + +class AppSearchBar extends StatefulWidget { + const AppSearchBar({ + super.key, + this.hint = '搜索', + this.onChanged, + this.onSubmitted, + this.debounceDuration = const Duration(milliseconds: 300), + }); + + final String hint; + final ValueChanged? onChanged; + final ValueChanged? onSubmitted; + final Duration debounceDuration; + + @override + State createState() => _AppSearchBarState(); +} + +class _AppSearchBarState extends State { + final _controller = TextEditingController(); + final _rateLimit = RateLimitHub(); + + @override + void dispose() { + _rateLimit.clear(); + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return SearchBar( + controller: _controller, + hintText: widget.hint, + leading: const Icon(Icons.search), + trailing: [ + if (_controller.text.isNotEmpty) + IconButton( + tooltip: '清除', + onPressed: () { + setState(_controller.clear); + widget.onChanged?.call(''); + }, + icon: const Icon(Icons.close), + ), + ], + onChanged: (value) { + setState(() {}); + _rateLimit.debounce( + key: 'search', + value: value, + duration: widget.debounceDuration, + onCallback: (text) => widget.onChanged?.call(text), + ); + }, + onSubmitted: widget.onSubmitted, + ); + } +} diff --git a/lib/shared/widgets/app_status_view.dart b/lib/shared/widgets/app_status_view.dart new file mode 100644 index 0000000..73f8430 --- /dev/null +++ b/lib/shared/widgets/app_status_view.dart @@ -0,0 +1,35 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_template/shared/widgets/app_empty_view.dart'; +import 'package:flutter_template/shared/widgets/app_error_view.dart'; +import 'package:flutter_template/shared/widgets/app_loading_view.dart'; + +enum AppViewStatus { loading, empty, error, content } + +class AppStatusView extends StatelessWidget { + const AppStatusView({ + super.key, + required this.status, + required this.child, + this.empty, + this.error, + this.loading, + this.onRetry, + }); + + final AppViewStatus status; + final Widget child; + final Widget? empty; + final Widget? error; + final Widget? loading; + final VoidCallback? onRetry; + + @override + Widget build(BuildContext context) { + return switch (status) { + AppViewStatus.loading => loading ?? const AppLoadingView(), + AppViewStatus.empty => empty ?? const AppEmptyView(), + AppViewStatus.error => error ?? AppErrorView(onRetry: onRetry), + AppViewStatus.content => child, + }; + } +} diff --git a/lib/shared/widgets/app_tag.dart b/lib/shared/widgets/app_tag.dart new file mode 100644 index 0000000..f1c9cc9 --- /dev/null +++ b/lib/shared/widgets/app_tag.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; + +enum AppTagTone { neutral, success, warning, danger, info } + +class AppTag extends StatelessWidget { + const AppTag({ + super.key, + required this.label, + this.tone = AppTagTone.neutral, + this.icon, + }); + + final String label; + final AppTagTone tone; + final IconData? icon; + + @override + Widget build(BuildContext context) { + final (foreground, background) = _colors(context); + return Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: background, + borderRadius: BorderRadius.circular(999), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (icon != null) ...[ + Icon(icon, size: 14, color: foreground), + const SizedBox(width: 4), + ], + Text( + label, + style: Theme.of(context).textTheme.labelSmall?.copyWith( + color: foreground, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ); + } + + (Color, Color) _colors(BuildContext context) { + final colors = Theme.of(context).colorScheme; + return switch (tone) { + AppTagTone.neutral => ( + colors.onSurfaceVariant, + colors.surfaceContainerHighest, + ), + AppTagTone.success => (const Color(0xFF166534), const Color(0xFFDCFCE7)), + AppTagTone.warning => (const Color(0xFF92400E), const Color(0xFFFEF3C7)), + AppTagTone.danger => (colors.error, colors.errorContainer), + AppTagTone.info => (colors.primary, colors.primaryContainer), + }; + } +} diff --git a/lib/shared/widgets/app_text_field.dart b/lib/shared/widgets/app_text_field.dart new file mode 100644 index 0000000..6746065 --- /dev/null +++ b/lib/shared/widgets/app_text_field.dart @@ -0,0 +1,113 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class AppTextField extends StatefulWidget { + const AppTextField({ + super.key, + this.controller, + this.initialValue, + this.label, + this.hint, + this.prefixIcon, + this.suffixIcon, + this.keyboardType, + this.textInputAction, + this.obscureText = false, + this.readOnly = false, + this.maxLines = 1, + this.maxLength, + this.validator, + this.inputFormatters, + this.onChanged, + this.onSubmitted, + this.onFinished, + this.finishLength, + this.debounceDuration = const Duration(milliseconds: 500), + }); + + final TextEditingController? controller; + final String? initialValue; + final String? label; + final String? hint; + final Widget? prefixIcon; + final Widget? suffixIcon; + final TextInputType? keyboardType; + final TextInputAction? textInputAction; + final bool obscureText; + final bool readOnly; + final int maxLines; + final int? maxLength; + final FormFieldValidator? validator; + final List? inputFormatters; + final ValueChanged? onChanged; + final ValueChanged? onSubmitted; + final ValueChanged? onFinished; + final int? finishLength; + final Duration debounceDuration; + + @override + State createState() => _AppTextFieldState(); +} + +class _AppTextFieldState extends State { + late final TextEditingController _controller; + Timer? _debounce; + + @override + void initState() { + super.initState(); + _controller = + widget.controller ?? + TextEditingController(text: widget.initialValue ?? ''); + _controller.addListener(_handleInput); + } + + void _handleInput() { + final text = _controller.text; + if (widget.finishLength != null && text.length == widget.finishLength) { + widget.onFinished?.call(text); + return; + } + + _debounce?.cancel(); + _debounce = Timer(widget.debounceDuration, () { + widget.onFinished?.call(text); + }); + } + + @override + void dispose() { + _debounce?.cancel(); + _controller.removeListener(_handleInput); + if (widget.controller == null) _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return TextFormField( + controller: _controller, + keyboardType: widget.keyboardType, + textInputAction: widget.textInputAction ?? TextInputAction.done, + obscureText: widget.obscureText, + readOnly: widget.readOnly, + maxLines: widget.maxLines, + maxLength: widget.maxLength, + validator: widget.validator, + inputFormatters: widget.inputFormatters, + onChanged: widget.onChanged, + onFieldSubmitted: widget.onSubmitted, + onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(), + decoration: InputDecoration( + labelText: widget.label, + hintText: widget.hint, + prefixIcon: widget.prefixIcon, + suffixIcon: widget.suffixIcon, + border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), + counterText: '', + ), + ); + } +} diff --git a/lib/shared/widgets/app_toast.dart b/lib/shared/widgets/app_toast.dart new file mode 100644 index 0000000..9d4d309 --- /dev/null +++ b/lib/shared/widgets/app_toast.dart @@ -0,0 +1,87 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:flutter_template/app/router/app_navigator.dart'; + +class AppToast { + AppToast._(); + + static OverlayEntry? _entry; + static Timer? _timer; + + static String messageOf(Object? error) { + if (error == null) return '未知错误'; + if (error is FormatException) return error.message; + if (error is TimeoutException) return error.message ?? '请求超时'; + + var text = error.toString().trim(); + const prefix = 'Exception: '; + while (text.startsWith(prefix)) { + text = text.substring(prefix.length).trimLeft(); + } + return text.isEmpty ? '未知错误' : text; + } + + static void show( + String message, { + Duration duration = const Duration(seconds: 2), + }) { + final context = AppNavigator.context; + if (context == null) return; + + _dismiss(); + final overlay = Overlay.maybeOf(context, rootOverlay: true); + if (overlay == null) return; + + _entry = OverlayEntry(builder: (_) => _ToastWidget(message: message)); + overlay.insert(_entry!); + _timer = Timer(duration, _dismiss); + } + + static void showError(Object error) => show(messageOf(error)); + + static void _dismiss() { + _timer?.cancel(); + _timer = null; + try { + _entry?.remove(); + } catch (_) { + // OverlayEntry may already be removed. + } + _entry = null; + } +} + +class _ToastWidget extends StatelessWidget { + const _ToastWidget({required this.message}); + + final String message; + + @override + Widget build(BuildContext context) { + return Positioned.fill( + child: IgnorePointer( + child: Center( + child: Material( + color: Colors.transparent, + child: Container( + constraints: BoxConstraints( + maxWidth: MediaQuery.sizeOf(context).width * 0.8, + ), + padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 11), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.82), + borderRadius: BorderRadius.circular(8), + ), + child: Text( + message, + textAlign: TextAlign.center, + style: const TextStyle(color: Colors.white, fontSize: 14), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/shared/widgets/safe_area_wrapper.dart b/lib/shared/widgets/safe_area_wrapper.dart new file mode 100644 index 0000000..6ca0490 --- /dev/null +++ b/lib/shared/widgets/safe_area_wrapper.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +class SafeAreaWrapper extends StatelessWidget { + const SafeAreaWrapper({ + super.key, + required this.child, + this.backgroundColor, + this.top = true, + this.bottom = true, + this.minimum = EdgeInsets.zero, + }); + + final Widget child; + final Color? backgroundColor; + final bool top; + final bool bottom; + final EdgeInsets minimum; + + @override + Widget build(BuildContext context) { + return ColoredBox( + color: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + child: SafeArea(top: top, bottom: bottom, minimum: minimum, child: child), + ); + } +} diff --git a/lib/shared/widgets/widgets.dart b/lib/shared/widgets/widgets.dart new file mode 100644 index 0000000..9504723 --- /dev/null +++ b/lib/shared/widgets/widgets.dart @@ -0,0 +1,15 @@ +export 'app_avatar.dart'; +export 'app_button.dart'; +export 'app_card.dart'; +export 'app_dialog.dart'; +export 'app_empty_view.dart'; +export 'app_error_view.dart'; +export 'app_loading_view.dart'; +export 'app_network_image.dart'; +export 'app_refresh_list.dart'; +export 'app_search_bar.dart'; +export 'app_status_view.dart'; +export 'app_tag.dart'; +export 'app_text_field.dart'; +export 'app_toast.dart'; +export 'safe_area_wrapper.dart'; diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..46ac430 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1079 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: a49d6cf99e8d8e7a8e93668d09ced0bbdb954d0b4fccc2f5f9241c6b87fad95c + url: "https://pub.dev" + source: hosted + version: "99.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "663efa951fb8a45e06f491223a604c93820598f20e6a99c25617a1576065e8b7" + url: "https://pub.dev" + source: hosted + version: "12.1.0" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + connectivity_plus: + dependency: "direct main" + description: + name: connectivity_plus + sha256: "62ffa266d9a23b79fb3fcbc206afc00bb979417ba57b1324c546b5aab95ba057" + url: "https://pub.dev" + source: hosted + version: "7.1.1" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + sha256: "3c09627c536d22fd24691a905cdd8b14520de69da52c7a97499c8be5284a32ed" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + url: "https://pub.dev" + source: hosted + version: "1.15.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + dbus: + dependency: transitive + description: + name: dbus + sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270 + url: "https://pub.dev" + source: hosted + version: "0.7.12" + device_info_plus: + dependency: "direct main" + description: + name: device_info_plus + sha256: b4fed1b2835da9d670d7bed7db79ae2a94b0f5ad6312268158a9b5479abbacdd + url: "https://pub.dev" + source: hosted + version: "12.4.0" + device_info_plus_platform_interface: + dependency: transitive + description: + name: device_info_plus_platform_interface + sha256: e1ea89119e34903dca74b883d0dd78eb762814f97fb6c76f35e9ff74d261a18f + url: "https://pub.dev" + source: hosted + version: "7.0.3" + dio: + dependency: "direct main" + description: + name: dio + sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c + url: "https://pub.dev" + source: hosted + version: "5.9.2" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_easyloading: + dependency: "direct main" + description: + name: flutter_easyloading + sha256: ba21a3c883544e582f9cc455a4a0907556714e1e9cf0eababfcb600da191d17c + url: "https://pub.dev" + source: hosted + version: "3.0.5" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_riverpod: + dependency: "direct main" + description: + name: flutter_riverpod + sha256: "4e166be88e1dbbaa34a280bdb744aeae73b7ef25fdf8db7a3bb776760a3648e2" + url: "https://pub.dev" + source: hosted + version: "3.3.1" + flutter_screenutil: + dependency: "direct main" + description: + name: flutter_screenutil + sha256: "8239210dd68bee6b0577aa4a090890342d04a136ce1c81f98ee513fc0ce891de" + url: "https://pub.dev" + source: hosted + version: "5.9.3" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + sha256: "77850df57c00dc218bfe96071d576a8babec24cf58b2ed121c83cca4a2fdce7f" + url: "https://pub.dev" + source: hosted + version: "5.2.2" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + sha256: "1ded017b39c8e15c8948ea855070a5ff8ff8b3d5e83f3446e02d6bb12add7ad9" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 + url: "https://pub.dev" + source: hosted + version: "0.12.19" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" + url: "https://pub.dev" + source: hosted + version: "1.18.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + nm: + dependency: transitive + description: + name: nm + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + package_info_plus: + dependency: "direct main" + description: + name: package_info_plus + sha256: "468c26b4254ab01979fa5e4a98cb343ea3631b9acee6f21028997419a80e1a20" + url: "https://pub.dev" + source: hosted + version: "9.0.1" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_parsing: + dependency: transitive + description: + name: path_parsing + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "149441ca6e4f38193b2e004c0ca6376a3d11f51fa5a77552d8bd4d2b0c0912ba" + url: "https://pub.dev" + source: hosted + version: "2.2.23" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "6d13aece7b3f5c5a9731eaf553ff9dcbc2eff41087fd2df587fd0fed9a3eb0c4" + url: "https://pub.dev" + source: hosted + version: "2.5.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + sha256: bc917da36261b00137bbc8896bf1482169cd76f866282368948f032c8c1caae1 + url: "https://pub.dev" + source: hosted + version: "12.0.1" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6" + url: "https://pub.dev" + source: hosted + version: "13.0.1" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023 + url: "https://pub.dev" + source: hosted + version: "9.4.7" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24" + url: "https://pub.dev" + source: hosted + version: "0.1.3+5" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878 + url: "https://pub.dev" + source: hosted + version: "4.3.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" + url: "https://pub.dev" + source: hosted + version: "0.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pull_to_refresh: + dependency: "direct main" + description: + name: pull_to_refresh + sha256: bbadd5a931837b57739cf08736bea63167e284e71fb23b218c8c9a6e042aad12 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + riverpod: + dependency: transitive + description: + name: riverpod + sha256: "8c22216be8ad3ef2b44af3a329693558c98eca7b8bd4ef495c92db0bba279f83" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" + source: hosted + version: "0.28.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: c3025c5534b01739267eb7d76959bbc25a6d10f6988e1c2a3036940133dd10bf + url: "https://pub.dev" + source: hosted + version: "2.5.5" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: e8d4762b1e2e8578fc4d0fd548cebf24afd24f49719c08974df92834565e2c53 + url: "https://pub.dev" + source: hosted + version: "2.4.23" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "649dc798a33931919ea356c4305c2d1f81619ea6e92244070b520187b5140ef9" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88 + url: "https://pub.dev" + source: hosted + version: "2.4.2+2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + state_notifier: + dependency: transitive + description: + name: state_notifier + sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb + url: "https://pub.dev" + source: hosted + version: "1.0.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: c254ade258ec8282947a0acbbc90b9575b4f19673533ee46f2f6e9b3aeefd7c0 + url: "https://pub.dev" + source: hosted + version: "3.4.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test: + dependency: transitive + description: + name: test + sha256: "8d9ceddbab833f180fbefed08afa76d7c03513dfdba87ffcec2718b02bbcbf20" + url: "https://pub.dev" + source: hosted + version: "1.31.0" + test_api: + dependency: transitive + description: + name: test_api + sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + test_core: + dependency: transitive + description: + name: test_core + sha256: "1991d4cfe85d5043241acac92962c3977c8d2f2add1ee73130c7b286417d1d34" + url: "https://pub.dev" + source: hosted + version: "0.6.17" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8 + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "3bb000251e55d4a209aa0e2e563309dc9bb2befea2295fd0cec1f51760aac572" + url: "https://pub.dev" + source: hosted + version: "6.3.29" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: cfde38aa257dae62ffe79c87fab20165dfdf6988c1d31b58ebf59b9106062aad + url: "https://pub.dev" + source: hosted + version: "6.3.6" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a + url: "https://pub.dev" + source: hosted + version: "3.2.2" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18" + url: "https://pub.dev" + source: hosted + version: "3.2.5" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f" + url: "https://pub.dev" + source: hosted + version: "3.1.5" + uuid: + dependency: "direct main" + description: + name: uuid + sha256: "1fef9e8e11e2991bb773070d4656b7bd5d850967a2456cfc83cf47925ba79489" + url: "https://pub.dev" + source: hosted + version: "4.5.3" + vector_graphics: + dependency: transitive + description: + name: vector_graphics + sha256: "6409a25046024f0f8c5d8a59fec314081e81f9d436b66ca4015a8b49772bf445" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + vector_graphics_codec: + dependency: transitive + description: + name: vector_graphics_codec + sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" + url: "https://pub.dev" + source: hosted + version: "1.1.13" + vector_graphics_compiler: + dependency: transitive + description: + name: vector_graphics_compiler + sha256: "5a88dd14c0954a5398af544651c7fb51b457a2a556949bfb25369b210ef73a74" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360" + url: "https://pub.dev" + source: hosted + version: "15.2.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + win32: + dependency: transitive + description: + name: win32 + sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + url: "https://pub.dev" + source: hosted + version: "5.15.0" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "6f1b564492d0147b330dd794fee8f512cec4977957f310f9951b5f9d83618dae" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.10.0-0 <4.0.0" + flutter: ">=3.35.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..ebbd40a --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,104 @@ +name: flutter_template +description: "A reusable Flutter quick-start template for Android and iOS." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.9.0 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + flutter_localizations: + sdk: flutter + + cached_network_image: ^3.4.1 + connectivity_plus: ^7.1.1 + cupertino_icons: ^1.0.8 + device_info_plus: ^12.4.0 + dio: ^5.9.2 + flutter_easyloading: ^3.0.5 + flutter_riverpod: ^3.3.1 + flutter_screenutil: ^5.9.3 + flutter_svg: ^2.2.4 + intl: ^0.20.2 + package_info_plus: ^9.0.1 + permission_handler: ^12.0.1 + pull_to_refresh: ^2.0.0 + shared_preferences: ^2.5.5 + url_launcher: ^6.3.2 + uuid: ^4.5.3 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..6708152 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,14 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:flutter_template/app/app.dart'; + +void main() { + testWidgets('template app renders demo page', (tester) async { + await tester.pumpWidget(const ProviderScope(child: FlutterTemplateApp())); + await tester.pumpAndSettle(); + + expect(find.text('Flutter Template'), findsOneWidget); + expect(find.text('通用 Flutter 快速开发模板'), findsOneWidget); + expect(find.text('增加计数'), findsOneWidget); + }); +}