14 Star 47 Fork 51

OpenHarmony-SIG/flutter_packages

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

仓库介绍

该仓库基于上游Flutter社区packages仓库,基于commitId:b8b84b2304f00a3f93ce585cc7a30e1235bde7a0。

该仓库主要新增对OpenHarmony平台的兼容。

OpenHarmony平台已兼容库

仓库名 依赖路径 类型
pigeon packages/pigeons 工具库
file_selector packages/file_selector/file_selector 插件
image_picker packages/image_picker/image_picker 插件
animations packages/animations 新增示例
url_launcher packages/url_launcher/url_launcher 插件
shared_preferences packages/shared_preferences/shared_preferences 插件
path_provuder packages/path_provuder/path_provuder 插件
local_auth packages/local_auth/local_auth 插件

如何引用这些库

一、工具库pigeon使用

  1. 引入pigeon库,在pubspec.yaml中dev_dependencies新增配置:
dev_dependencies:
 pigeon:
   git:
     url: "https://gitee.com/openharmony-sig/flutter_packages.git"
     path: "packages/pigeon"
  1. 项目根目录运行flutter pub get

  2. 项目根目录运行flutter pub run pigeon --input <dart通信模型文件路径> --arkts_out <arkts平台方法代码输出文件路径,示例./ohos/entry/src/main/ets/xxx.ets>

将会生成Flutter与OpenHarmony平台通信的模板代码;

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

二、 插件库使用

以path_provider举例:

  1. 在引用的项目中,pubspec.yaml中dependencies新增配置:
dependencies:
  path_provider:
    git:
      url: "https://gitee.com/openharmony-sig/flutter_packages.git"
      path: "packages/path_provider/path_provider"

2、项目根目录运行flutter pub get;(ohos/entry/oh-package.json5会自动添加相关插件har依赖)

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

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

可参考示例:https://gitee.com/openharmony-sig/flutter_samples/tree/master/ohos/pictures_provider_demo。

FAQ

一、 运行 flutter pub get 遇到 "File name too long" 问题

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

  git config --global core.longpaths true
Copyright 2013 The Flutter Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

暂无描述 展开 收起
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony-sig/flutter_packages.git
git@gitee.com:openharmony-sig/flutter_packages.git
openharmony-sig
flutter_packages
flutter_packages
master

搜索帮助

Cb406eda 1850385 E526c682 1850385