Files
xianyan/Packages.md
Developer b5157c19f4 feat: 新增壁纸图库组件和编辑器功能优化
- 新增壁纸图库相关组件(WallpaperGalleryView/WallpaperSearchBar等)
- 优化编辑器主题服务和系统UI管理
- 新增虚线边框和拖拽描边风格支持
- 完善今日诗词服务和阅读报告功能
- 修复多个UI问题和空指针异常
- 更新依赖库版本和SVG资源
- 优化交互动画和状态管理
- 补充文档和API测试脚本
2026-05-05 05:03:33 +08:00

28 KiB
Raw Blame History

Flutter Packages

仓库介绍

本仓库基于 Flutter 社区官方插件库(flutter/packages)进行扩展,新增对 OpenHarmony 平台的兼容适配。通过本仓库,开发者可在 Flutter 应用中无缝集成常用插件通过最小化业务改动获得完整的OpenHarmony原生能力支持。

OpenHarmony平台已适配packages三方库

OpenHarmony平台已适配三方库列表

三方库问题请在对应仓库提交 issue三方库适配请求请至 OpenHarmony-Flutter 组织提交 issue。

贡献指南

本仓库采用多分支管理策略,每个三方库版本都有对应的 dev 分支和release分支

分支名 命名格式
dev 分支 br_<库名>-v<版本号>_ohos_dev
release 分支 br_<库名>-v<版本号>_ohos

开发者贡献代码时,请遵循以下流程:

  1. 确定目标分支:根据您要修改的三方库及版本,找到对应的 dev 分支。
  2. 基于 dev 分支开发fork 从对应的 dev 分支进行开发。
  3. **提交 PR将代码变更提交到对应的 dev 分支

注意release 分支为发布分支不接受直接提交PR。所有代码贡献请务必提交到对应三方库版本的 dev 分支上。

开始使用

使用本仓库插件前,请确保已完成 Flutter SDK 的 OpenHarmony 环境配置。

引用方式

适配了OpenHarmony的三方库需通过Git仓库引入。除必填的 url 外,常用参数如下:

  • path : 库在仓库中的实际路径,否则可能找不到 pubspec.yaml
  • ref(可选) : 指定要拉取的版本,可以是 分支名标签tagcommit id,不写则使用仓库默认分支。

按分支引用branch:

dev_dependencies:
  pigeon:
    git:
      url: https://gitcode.com/openharmony-tpc/flutter_packages.git
      path: packages/pigeon
      ref: pigeon-v21.2.0 # 分支名

按标签引用tag)

dev_dependencies:
  pigeon:
    git:
      url: https://gitcode.com/openharmony-tpc/flutter_packages.git
      path: packages/pigeon
      ref: gitee/pigeon-v11.0.1	# 发布标签

使用示例

一、工具库pigeon使用

  1. 引入pigeon库在pubspec.yaml中dev_dependencies新增配置

    dev_dependencies:
      pigeon:
        git:
          url: https://gitcode.com/openharmony-tpc/flutter_packages.git
          path: packages/pigeon
          ref: br_pigeon-v26.1.5_ohos
    
  2. 项目根目录运行 flutter pub get

  3. 项目根目录运行 flutter pub run pigeon --input <dart通信模型文件路径> --arkts_out <arkts平台方法代码输出文件路径示例./ohos/entry/src/main/ets/xxx.ets>将会生成Flutter与OpenHarmony平台通信的模板代码。

  4. 调用示例参考packages/pigeon/example/app/ohos/entry/src/main/ets/plugins/MessagePlugin.ets。

二、 插件库使用

以 path_provider 举例:

  1. 在引用的项目中pubspec.yaml中dependencies新增配置

    dependencies:
      path_provider:
        git:
          url: https://gitcode.com/openharmony-tpc/flutter_packages.git
          path: packages/path_provider/path_provider
          ref: br_path_provider-v2.1.5_ohos
    
  2. 项目根目录运行 flutter pub getohos/entry/oh-package.json5会自动添加相关插件har依赖。

  3. 在业务代码中调用path_provider相关api它会在OpenHarmony平台正常运行。

    示例在某个Flutter兼容OpenHarmony项目中加入支持OpenHarmony平台的path_provider库依赖。

    可参考示例:pictures_provider_demo

OpenHarmony平台已适配packages三方库

序号 原库名 3.7推荐使用版本 3.22推荐使用版本 3.27推荐使用版本 3.35推荐使用版本 仓库名 状态
1 pigeon 14.0.0 21.2.0 25.3.2 26.1.5 pigeon 已适配
2 file_selector 1.0.1 1.0.3 1.0.3 1.0.3 file_selector 已适配
3 image_picker 1.0.4 1.1.2 1.1.2 1.2.1 image_picker 已适配
4 animations 2.0.8 2.0.8 2.0.11 2.0.11 animations 已适配
5 url_launcher 6.1.11 6.3.0 6.3.1 6.3.2 url_launcher 已适配
6 shared_preferences 2.2.2 2.3.2 2.5.3 2.5.4 shared_preferences 已适配
7 path_provider 2.1.1 2.1.4 2.1.5 2.1.5 path_provider 已适配
8 local_auth 2.1.6 2.3.0 2.3.0 3.0.0 local_auth 已适配
9 camera 0.10.5+5 0.11.0+2 0.11.1 0.11.3 camera 已适配
10 video_player 2.7.2 2.9.2 2.10.0 2.10.1 video_player 已适配
11 webview_flutter 4.4.2 4.8.0 4.13.0 4.13.0 webview_flutter 已适配
12 webview_flutter-v4.4.4 4.4.4 - - - webview_flutter-v4.4.4 已适配
13 in_app_purchase 3.1.11 3.2.0 3.2.3 3.2.3 in_app_purchase 已适配
14 css_colors 1.1.3 1.1.3 1.1.3 1.1.3 css_colors 未适配
15 espresso 0.3.0+6 0.3.0+6 0.3.0+6 0.3.0+6 espresso 未适配
16 extension_google_sign_in_as_googleapis_auth 2.0.11 2.0.11 2.0.11 2.0.11 extension_google_sign_in_as_googleapis_auth 未适配
17 flutter_adaptive_scaffold 0.1.4 0.1.4 0.1.4 0.1.4 flutter_adaptive_scaffold 未适配
18 flutter_image 4.1.9 4.1.9 4.1.9 4.1.9 flutter_image 未适配
19 flutter_lints 2.0.3 2.0.3 2.0.3 2.0.3 flutter_lints 未适配
20 flutter_markdown 0.6.15 0.6.15 0.6.15 0.6.15 flutter_markdown 未适配
21 flutter_migrate 0.1.0 0.1.0 0.1.0 0.1.0 flutter_migrate 未适配
22 flutter_plugin_android_lifecycle 2.0.17 2.0.17 2.0.17 2.0.17 flutter_plugin_android_lifecycle 未适配
23 flutter_template_images 4.2.1 4.2.1 4.2.1 4.2.1 flutter_template_images 未适配
24 go_router 12.1.1 12.1.1 12.1.1 12.1.1 go_router 未适配
25 go_router_builder 2.3.4 2.3.4 2.3.4 2.3.4 go_router_builder 未适配
26 google_identity_services_web 0.2.2 0.2.2 0.2.2 0.2.2 google_identity_services_web 未适配
27 google_maps_flutter 2.3.0 2.3.0 2.3.0 2.3.0 google_maps_flutter 未适配
28 google_sign_in 6.1.6 6.1.6 6.1.6 6.1.6 google_sign_in 未适配
29 ios_platform_images 0.2.3 0.2.3 0.2.3 0.2.3 ios_platform_images 未适配
30 metrics_center 1.0.12 1.0.12 1.0.12 1.0.12 metrics_center 未适配
31 multicast_dns 0.3.2+4 0.3.2+4 0.3.2+4 0.3.2+4 multicast_dns 未适配
32 palette_generator 0.3.3+3 0.3.3+3 0.3.3+3 0.3.3+3 palette_generator 未适配
33 pointer_interceptor 0.9.3+5 0.9.3+5 0.9.3+5 0.9.3+5 pointer_interceptor 未适配
34 rfw 1.0.9 1.0.9 1.0.9 1.0.9 rfw 未适配
35 standard_message_codec 0.0.1+4 0.0.1+4 0.0.1+4 0.0.1+4 standard_message_codec 未适配
36 two_dimensional_scrollables - - - - two_dimensional_scrollables 未适配
37 web_benchmarks 0.1.0+8 0.1.0+8 0.1.0+8 0.1.0+8 web_benchmarks 未适配
38 webview_flutter_platform_interface 2.6.0 2.6.0 2.6.0 2.6.0 webview_flutter_platform_interface 未适配
39 xdg_directories 1.0.3 1.0.3 1.0.3 1.0.3 xdg_directories 未适配

FAQ

  1. 运行 flutter pub get 遇到 "File name too long" 问题。

    打开 Git Bash运行 cmd需要将git添加到环境变量中执行以下命令

      git config --global core.longpaths true
    

问题交流