返回首页

一周热榜

1作者: flfljh6 天前原帖
# HarmonyOS Flutter 插件开发详细指南 ## 0. 环境设置 *前提条件*: 配置 HarmonyOS Flutter 环境 *参考资料*: [HarmonyOS Flutter 环境设置指南](https://juejin.cn/post/7317214081261207603) *注意*: 下载和编译引擎耗时较长。如需可用的预构建引擎,请联系获取。 ------ ## 1. 获取原始插件代码 ``` git clone <original_plugin_repository> ``` ------ ## 2. 生成 OHOS 目录 ``` # 选项 1: 直接生成(可能失败) flutter create -t plugin --platforms ohos # 选项 2: 创建演示项目并复制 flutter create -t plugin --platforms ohos demo cp -r demo/ohos ./ ``` ------ ## 3. 配置本地依赖 在 `pubspec.yaml` 中添加本地依赖: ``` dependencies: your_plugin: path: ../path_to_plugin ``` ![iwEcAqNwbmcDAQTRCQAF0QS4BrDBDM9ETs38UAcIagyL5gAAB9IGLKvECAAJomltCgAL0gALGaw.png_620x10000q90](https://p.ipic.vip/kjme9r.jpg) ## 4. 构建插件包 ```bash flutter build hap \ --local-engine-src-path /path/to/ohos_flutter/src \ --local-engine ohos_release_arm64 ``` *成功输出*: ```markdown √ Built build/hap/release/entry-release.hap (XX.XMB) ``` ------ ## 5. 验证生成的文件 成功构建后: ![1](https://p.ipic.vip/6k3z3k.png) ## 6. 定位插件 HAR 包 插件输出目录: ```markdown your_plugin/ohos/build/outputs/ └── har └── your_plugin_ohos.har # 插件包 ``` ![2](https://p.ipic.vip/2cjnbx.png) ## 7. 将 HAR 添加到演示项目 将 HAR 复制到演示项目: ```bash cp your_plugin_ohos.har demo_portal/module/ohos/libs/ ``` ------ ![3](https://p.ipic.vip/n9sgfo.png) ## 8. 配置 HAR 依赖 ![4](https://p.ipic.vip/wlkxik.png) ## 9. 初始化插件 ![5](https://p.ipic.vip/ee33ah.png) ## 10. 测试插件功能 ![6](https://p.ipic.vip/4fy0hk.png) ![7](https://p.ipic.vip/w30wew.png) ## 11. 开发原生实现 按照以下步骤进行原生开发: 1. 分析现有的 iOS/Android 原生逻辑 2. 在 `ohos/src/main/cpp/` 中创建 HarmonyOS 等效实现 3. 实现平台接口: cpp
1作者: samuraikmc6 天前原帖
I&#x27;ve been getting increasingly frustrated finding good background music for work. Ads interrupting flow, spending forever choosing playlists, inconsistent audio quality, among many other smaller peeves.<p>Curious if others have similar issues, so I put together a quick survey about how people use music for focus and workouts: https:&#x2F;&#x2F;docs.google.com&#x2F;forms&#x2F;d&#x2F;e&#x2F;1FAIpQLScxfFY5_mueTHuZr2_hZqPcMWI6esjSY9Pk6U0Q4d_Ss4lKYg&#x2F;viewform?usp=dialog<p>It should only take about 3 minutes and covers what platforms you use, your biggest frustrations, and what an ideal solution would look like.<p>Happy to share the results back with the community once I get enough responses!