flutter_packages:基于 Flutter 社区插件库的 OpenHarmony 兼容适配项目

开发者可通过本项目在 Flutter 应用中无缝集成常用插件,最小化业务改动获得完整 OpenHarmony 原生能力支持。项目基于 Flutter 社区官方插件库扩展,新增对 OpenHarmony 平台的兼容适配,提供多个已适配插件及使用示例。【此简介由AI生成】

分支78Tags42
文件最后提交记录最后更新时间
chore: Add unit test checks. Signed-off-by: 谢代荣 <xiedairong@huawei.com> 11 天前
add cpf-manager to developer Signed-off-by: HHHxm2 <huangxingming2@huawei.com> 1 个月前
chore: update pull request description template Co-authored-by: huangyouhua<huangyouhua2@huawei.com> 4 个月前
!1132 merge master into master 添加webview_flutter-v4.4.4单元测试 Created-by: quanhonghui Commit-by: quanhonghui Merged-by: openharmony_ci Description: <!-- Please remove all comments before submitting to avoid them being included in merge commit message --> ## Why are these changes being made? Reinforcement webview ## Changelog <!-- List user-visible changes in a concise manner. Use one of the following verbs in past tense: - added - fixed - deprecated - removed - optimized Include [breaking] prefix for breaking changes --> ## Test Plan flutter test ## Checklist - [x] No illegal compatibility changes are involved; if any are, they have passed the corresponding review. - [x] No performance issues are present or have been tested and there is no performance degradation. - [x] Compliant with the corresponding coding standards. - [x] No document updates are required, or the documents have been updated. - [x] In terms of testability requirements, necessary self-test cases, reasonable log recording or Trace information have been added. - [x] No illegal file introductions exist, including images and code, etc. - [ ] The branches for the corresponding framework version that need to be merged have been confirmed. - [ ] 3.35 - [ ] 3.32 - [ ] 3.27 - [ ] 3.22 - [ ] 3.7 See merge request: openharmony-tpc/flutter_packages!113220 小时前
[tools,pigeon] Update tooling to handle Windows build output changes (#4826) Updates the tooling that builds and runs Windows unit tests to handle the build output path changes in https://github.com/flutter/flutter/pull/1318432 年前
[all] Add topics to pubspecs (#4771) Adds [topics](https://dart.dev/tools/pub/pubspec#topics) to all packages, supporting the new pub feature for categorizing packages. The heuristics I used were: - Try to use existing topics from https://pub.dev/topics where applicable - Add new topics as necessary to cover things that seemed like obvious relevant topics - Include the plugin name as a topic for all federated plugin packages, for grouping (since pub doesn't inherently group or cross-link implementations) This is not an attempt to be exhaustive; as topics evolve I expect we will add more or adjust. Also updates the repo tooling to enforce topics, so that we don't forget to add them to new packages. The enforced rule is: - All packages must have at least one topic. We could potentially change this to allow an empty topics section so that we are enforcing that we didn't just forget to add the section, but in practice even for packages that we don't expect people to be likely to use, I didn't have any issue coming up with at least one relevant topic. - Federated plugin packages must contain the plugin name as a topic. While this isn't time-critical, I chose to include version bumps so that we aren't rolling out topics in a piecemeal way (e.g., with only a random subset of a federated plugin's packages having topics on pub.dev based on what has happened to have a bugfix).2 年前
[ci] Update minimums for 3.13 stable (#4731) - Updates the N-1 and N-2 analysis bot configs to 3.7 and 3.10 - Updates the minimum allowed SDK to 3.7, since that's now the earliest we have any testing for. - Updates all packages to Flutter 3.7/Dart 2.19 as a minimum. - In packages where we hadn't released since the last minimum version bump, I removed the previous line from the #NEXT section to make it less confusing when we do release. Per https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#version this does not update any package versions.2 年前
chore: Add unit test checks. Signed-off-by: 谢代荣 <xiedairong@huawei.com> 11 天前
[ci] Run analysis with older versions of Flutter (#1152) 4 年前
boilerplate 8 年前
Update .gitignore with missing values from flutter/plugins (#3265) 3 年前
[google_sign_in] Bridge google_sign_in and googleapis. (#2824) Introduce the first version of the extension_google_sign_in_as_googleapis_auth package. This package lets users of the google_sign_in plugin to create an authenticated HTTP clients (from googleapis_auth) that can access any APIs from the googleapis package.5 年前
Adding myself and Michele to AUTHORS (#4527) As per title, because of contributing to the following PRs: [#3702](https://github.com/flutter/packages/pull/3702) [#3665](https://github.com/flutter/packages/pull/3665) [#3627](https://github.com/flutter/packages/pull/3627)2 年前
[two_dimensional_scrollables] TableView (#4536) Design doc: [flutter.dev/go/table-view](https://docs.google.com/document/d/15ecTZE1g3WeswLGFWrnEgMP6SyL6jDRdxOgPsczOcV0/edit?usp=sharing&resourcekey=0-yNd_qFhiPjz6z2TgezWc0A) Fixes https://github.com/flutter/flutter/issues/87370 Fixes https://github.com/flutter/flutter/issues/30770 This adds a new package: two_dimensional_scrollables - a package for widgets that scroll in two dimensions. The first widget in the collection here is TableView. https://github.com/flutter/packages/assets/16964204/8103001a-77dc-489f-9e75-278972f66f30 TableView is built on top of the 2D scrolling foundation that lives in the Flutter framework. Other widgets that will be included in this package in the future are TreeView and TreeTableView.2 年前
把flutter_packages仓库地址从openharmony-sig改为openharmony-tpc Signed-off-by: liujiake <liujiake999@163.com> 11 个月前
Add advice on code review for this repo (#4698) 2 年前
Standardize slight variations in license format (#339) - Uses the exact LICENSE file line breaking used in the other Flutter repositories - Standardizes some slight textual variants in the license block (e.g., use of "(c)", explicitly referencing the AUTHORS file) on the format used in the other repos.4 年前
修改文件版权头 Signed-off-by: huangxiaoyao <976125628@qq.com> 1 年前
修改文件版权头 Signed-off-by: huangxiaoyao <976125628@qq.com> 1 年前
屏蔽静态检查CXX问题 Signed-off-by: qq_77777 <qishijie3@h-partners.com> 2 个月前
补充COMMITTERS和README.OpenSource Signed-off-by: huangxiaoyao <976125628@qq.com> 1 年前
刷新file_select版本号 Signed-off-by: wenwenyang <707997111@qq.com> 16 天前
刷新file_select版本号 Signed-off-by: wenwenyang <707997111@qq.com> 16 天前
[various] Fixes unawaited_futures violations (#4067) This option had been disabled to match flutter/flutter, but the reason it was disabled there was "too many false positives", mostly around animation. That doesn't apply to most packages here, and we've had a number of production bugs—especially in plugins, that use async heavily in ways that are intended to be client-awaitable—that this would have caught. This PR: - Enables the option at the repo level. - Permanently (unless the owners decide to change it) opts out animations and go_router, both of which looked like mostly or entirely false positives. - Temporarily opted out a few plugins that have a lot of violations that should be handled in their own PRs later (camera_android_camerax, most of webview_flutter). - Fixes all remaining violations. In many cases this PR is behavior-changing, replacing implicitly unawaited futures that did not seem obviously intentional with awaited futures, so non-test code in particular should be reviewed carefully to make sure the changes are correct. All of the changes are manual, not fix-generated. Part of https://github.com/flutter/flutter/issues/1273232 年前
remove temporary flag after migration (#3498) remove temporary flag after migration3 年前
remove temporary flag after migration (#3498) remove temporary flag after migration3 年前

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(可选) : 指定要拉取的版本,可以是 分支名标签(tag)commit 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 get,ohos/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.1.0 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 未适配

常见问题解答

  1. 运行 flutter pub get 时遇到 "File name too long"(文件名过长)问题。

    打开 Git Bash运行 cmd(需将 Git 添加到环境变量中),执行以下命令:

      git config --global core.longpaths true
    

问题交流

项目介绍

开发者可通过本项目在 Flutter 应用中无缝集成常用插件,最小化业务改动获得完整 OpenHarmony 原生能力支持。项目基于 Flutter 社区官方插件库扩展,新增对 OpenHarmony 平台的兼容适配,提供多个已适配插件及使用示例。【此简介由AI生成】

定制我的领域

下载使用量

0

项目总下载次数(含Clone、Pull、 zip 包及 release 下载),每日凌晨更新

语言类型

Dart67.56%
Java11.08%
Objective-C7.52%
C++5.31%
ArkTS3.43%