name: new_learn description: "A new Flutter project." # 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.12.2 # 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 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 # 网络请求库:Dio(生产级封装,官方推荐) # 版本说明:5.10.0 为当前稳定版,Min Dart SDK 2.18,兼容本工程 Dart 3.12 dio: ^5.10.0 # 路由:go_router(Flutter 官方推荐声明式路由,对标 Vue 的 vue-router) # 用法:lib/router/app_router.dart 集中管路由表 + redirect 登录守卫 + # ShellRoute 包 4 个 tab;页面跳转用 context.push('/xxx') / context.go('/') # 版本说明:17.4.0 为当前稳定版 go_router: ^17.4.0 # 状态管理:flutter_riverpod(官方推荐,对标 Vue 的 Pinia) # 用法:ProviderScope 包根(main.dart)→ lib/providers/ 定义全局状态 → # 页面用 ConsumerWidget + ref.watch(provider) 响应式读取 # 版本说明:3.3.2 为当前稳定版(AsyncNotifier 为 3.x 推荐写法) flutter_riverpod: ^3.3.2 # 屏幕适配:flutter_screenutil(本项目统一使用 5.9.0) # 用法:所有尺寸(宽/高/字号/圆角)乘以 .w/.h/.sp/.r 自动按设计稿缩放 flutter_screenutil: ^5.9.0 # 分页列表:infinite_scroll_pagination(Flutter Favorite 官方认证,对标 z-paging) # 用法:见 lib/components/common_paged_list.dart(通用分页组件,所有分页页面复用) # 版本说明:5.1.1 为当前稳定版,API 与 4.x 完全不同(PagingController 直接传 fetchPage + PagingListener 渲染) infinite_scroll_pagination: ^5.1.1 # 图片选择(生产端 Android/iOS):wechat 系列,UI 对标微信 8.0.51 # wechat_assets_picker:相册多选/预览/排序/压缩(自带 photo_manager,不用另配) # wechat_camera_picker:微信风格相机(拍照/切镜头/重拍) # 注意:两者均不支持 Web,Web 调试走 image_picker 兜底(见 core/services/picker_service.dart) wechat_assets_picker: ^9.8.0 wechat_camera_picker: ^4.6.0 # 图片选择(仅 Web 调试兜底):官方维护,支持 Web image_picker: ^1.2.3 # 图片处理(压缩/EXIF 方向修正/尺寸过滤):纯 Dart,全平台含 Web # image 包主要兜底 Web 和 PNG 保真场景: # decodeImage 解码 → bakeOrientation 修正 EXIF 方向 → # copyResize 等比缩放 → encodeJpg(quality:) / encodePng。 # 与 OSS 直传“读字节”策略天然契合(不碰 dart:io,Web 也能编译); # 注意 import 时必须别名 `as img`,否则会和 Flutter 的 Image 类冲突。 # 版本:4.8.0(当前项目已验证可用) image: ^4.8.0 # 原生图片压缩:Android/iOS 用系统编解码器做方向自动修正 + 压缩 # 关键参数 autoCorrectionAngle: true,可直接处理拍照文件方向; # Web 不依赖它,仍走 image 纯 Dart 方案。 # 版本:2.5.1(当前稳定线) flutter_image_compress: ^2.5.1 # 网络图片加载 + 本地缓存(baseflow 维护,6.9k likes,全平台含 Web) # 替代 Image.network:自动把下载的图片缓存到本地缓存目录, # 二次加载秒出(不走网络),对标 Web 端浏览器 HTTP 缓存。 # 用法:CachedNetworkImage(imageUrl, placeholder, progressIndicatorBuilder, errorWidget); # 头像场景用 CachedNetworkImageProvider(url) 作为 ImageProvider。 # 版本:3.4.1(Min Dart SDK 3.0,兼容本工程 Dart 3.12) cached_network_image: ^3.4.1 # 视频播放(官方底层 + 社区 UI 封装):播放学习课程视频 # video_player:官方维护,Android→ExoPlayer / iOS→AVPlayer / Web→HTML5 video # chewie:fluttercommunity 维护的 UI 封装(进度条/全屏/倍速/字幕/循环) # 版本说明:不能升 1.14.x!它依赖 wakelock_plus 1.6.x → win32 ^6, # 与 flutter_secure_storage 9.2.4 的 win32 ^5 冲突(pub 解析失败)。 # 锁在 1.13.1(要求 Flutter 3.32+,本工程满足),等以后 # flutter_secure_storage 升级到 11.x 后再考虑升 chewie。 video_player: ^2.13.0 chewie: ^1.13.1 # 音频播放(社区事实标准,Android/iOS/Web/macOS/Windows/Linux 全平台) # just_audio:ryanheise 维护,4.1k likes;网络流/本地文件/播放列表/倍速/ # 循环/音频会话管理都有,但不带 UI,控制条由本项目组件自绘 # (lib/core/components/audio_player_card.dart) # 版本说明:0.10.x 为当前稳定线;0.x 版本号升级可能有 breaking change, # 升级前先看 pub.dev 的 changelog(0.9→0.10 就变了 setAudioSource API) just_audio: ^0.10.6 # 富文本渲染(题目/解析 HTML → Flutter widget) # flutter_widget_from_html_core:活跃维护(0.17.2,2026-04), # 纯 widget 渲染(非 WebView)→ 列表页性能好,全平台含 Web; # 支持 70+ 标签、内联 CSS、表格横滚、sub/sup 上标下标。 # 用 core 版(不带 fwfh 全家桶):audio 标签由本项目 AudioPlayerCard # 替换(customWidgetBuilder),video 留扩展点,图片/表格原生支持。 # 版本:0.17.x 要求 Flutter 3.32+ / just_audio ^0.10.4(本项目满足) flutter_widget_from_html_core: ^0.17.2 flutter_svg: ^2.0.17 # 图片预览:社区成熟方案,支持双指缩放/拖拽/多图左右切换 # 单图用 PhotoView,多图用 PhotoViewGallery; # 本项目统一封装到 core/components/image_preview_viewer.dart。 photo_view: ^0.15.0 # 加密库:登录密码 MD5 加密(对齐 Vue 端 stringToMd5) crypto: ^3.0.6 # 本地存储组合(业界标准:凭据安全、配置轻量) # 1. flutter_secure_storage:Token 等敏感凭据 → Android Keystore/iOS Keychain 加密 # 2. shared_preferences:用户信息等非敏感缓存 → 明文快速读写 # 3. isar_community:题库/错题/播放记录等大批量业务数据 → 本地 NoSQL 数据库 # ⚠ 为什么用 isar_community 而不是 hive / isar: # - hive:存 Map 无类型保障,官方已停更; # - isar 3.1.8:只发在已宕机的 pub.isar-community.dev,装不上; # - isar_community:社区在 pub.dev 的维护版,API 与 isar 完全一致。 # ⚠ Isar 是强类型数据库:模型类必须加 @collection 注解, # 每次改模型字段后要重跑 dart run build_runner build 重新生成 Schema。 shared_preferences: ^2.5.3 flutter_secure_storage: 10.3.1 isar_community: ^3.3.2 isar_community_flutter_libs: ^3.3.2 path_provider: ^2.1.5 # 权限管理(相机/相册等系统权限:检查状态、请求授权、跳转系统设置) # 用法:PickerService 内部统一调用,业务页不需要碰权限逻辑 # 合规要求:Android 上架审核(应用宝/华为/小米)必须先弹前置弹窗说明用途, # 再触发系统权限弹窗,否则审核直接打回。 permission_handler: ^11.3.1 # 分享(系统分享面板:文本/图片/文件,Android→ACTION_SEND,iOS→UIActivityViewController) # 用法:ShareService 统一封装,业务页调 shareText / shareImage / shareFromWidget # 后续如需精确分享到微信好友/朋友圈,再加 fluwx(微信 OpenSDK) share_plus: 13.2.0 # 保存到相册(图片/视频写入系统相册,Android→MediaStore,iOS→PHPhotoLibrary) # 用法:ShareService.saveToGallery / saveToGalleryFromBytes # gal 自带权限处理,588 likes,localsend 等大项目在用 gal: ^2.3.3 # 版本更新机制依赖 # package_info_plus:读取本机 app 版本名、buildNumber(隐私协议同意后才能调用) package_info_plus: 10.0.0 # url_launcher:跳转应用商店 / 外部浏览器下载地址 url_launcher: ^6.3.1 # WebView(内嵌 H5 报告详情页,支持 JS ↔ Flutter 双向通信) # 为什么用 flutter_inappwebview 而不是 webview_flutter: # - 需要 H5 内部按钮回调到 Flutter(JS bridge:addJavaScriptHandler) # - 比官方 webview_flutter 功能强:支持 callAsyncJavaScript、cookie 管理等 # - 6.1.5 stable 最低 Flutter 3.24 / Dart 3.5,项目 Flutter 3.44.8 完全兼容 # ⚠ Android 端要求 minSdkVersion >= 19(flutter_inappwebview 6.x 默认) flutter_inappwebview: ^6.1.5 # 常驻底部面板(smooth_sheets:3 停靠点拖拽面板,支持内部 ListView 滚动联动) # 用法:lib/core/components/persistent_snap_sheet.dart 封装组件 # 版本:1.1.1(2026-07 发布,支持 persistent + modal 两种模式) smooth_sheets: ^1.1.1 # JSON 序列化注解(配合 json_serializable 自动生成 fromJson / toJson) json_annotation: ^4.12.0 # 全局日志面板(Debug 下启用悬浮球查看日志 + Dio 网络请求日志): # - talker_flutter:应用内日志面板/悬浮球入口(Release 模式自动关闭) # - talker_dio_logger:Dio 拦截器日志输出到 talker(便于追踪请求链路) talker_flutter: ^5.1.20 talker_dio_logger: ^5.1.20 # 网络状态感知(做题过程可识别离线/断网/假网): # - connectivity_plus:监听网卡类型变化(wifi/mobile/none...),不保证能上网 # - internet_connection_checker_plus:探针检测真实互联网可用性(hasInternet) connectivity_plus: ^7.3.1 internet_connection_checker_plus: ^3.1.1 # 本地通知(Android/iOS):定时通知 + 点击通知跳转指定页面 # 定时推荐配套: # - timezone:TZDateTime(避免夏令时/时区变化导致时间漂移) # - flutter_timezone:读取设备本地时区名(用于设置 tz.local) flutter_local_notifications: ^22.3.0 timezone: ^0.11.1 flutter_timezone: ^5.1.0 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: ^6.0.0 # Isar 代码生成器:根据 @collection 模型生成 Schema(*.g.dart) # 改完模型后执行:dart run build_runner build --delete-conflicting-outputs isar_community_generator: ^3.3.2 build_runner: ^2.4.13 # JSON 序列化代码生成器(配合 @JsonSerializable 注解自动生成 *.g.dart) json_serializable: ^6.8.0 # 集成测试:在真机/模拟器上跑完整 App(区别于 flutter test 的纯虚拟机测试) # 运行:flutter test integration_test -d integration_test: sdk: flutter # 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 # 注册本地资源图片。 # 坑:assets/ 只包含它【直接子文件】,不会递归包含子目录! # 所以 img/tabbar 下的 PNG 必须单独列一行。 assets: - assets/ - assets/mock/ - assets/img/tabbar/ - assets/img/tabbar/default/ - assets/audio/ - assets/img/class/ - assets/img/my/ # 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