Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ohos适配 #805

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

ohos适配 #805

wants to merge 2 commits into from

Conversation

HandwerSTD
Copy link

帮忙做了一些ohos适配的杂活体力活,包括:

  • 降级到 dart2(这意味着不能合入主线了,需要单开一个ohos分支维护
  • 调整一大堆插件的依赖关系,降级版本,以及openharmony-sig的插件override
  • 调整了一些不能在 dart2 上使用的代码(比如删除了整个fluentui组件,修改了一些 dart2 和 3 写法不同的地方)
  • 适配了桌面图标和文字,状态栏导航栏沉浸

受限于我的能力,做的不完善的:

  • 平台相关 bug 修复
  • mobx,riverpod 相关修复(因为我没写过这个)
  • 降级后的一些诡异 flutter bug
  • 未适配功能禁用(其实没多少)

目前的状况是可以正常编译运行,加载列表,无法加载图片(报 type 'Response' is not a subtype of type 'StreamedResponse' in type cast ),平板端的适配还没来得及做

@Notsfsssf
Copy link
Owner

感谢PR,华为sig flutter_flutter自己改的sdk只到3.7.12 我觉得无论是靠降级来适配还是切分支出去,将来都是不可维护的,或者说精力上大家维护不了两头,我希望的是跟随flutter stable channel。如果鸿蒙next允许三方安装包,flutter_flutter能够跟进的话再适配也不迟,估计社区到时候也会有类似add platform不依托旧版sdk的解决方案吧,这个PR不会被合并,总之,感谢你的贡献

@bgli100
Copy link

bgli100 commented Jan 8, 2025

跟着这个PR的改动尝试自行移植了一下

  1. flutter SDK有3.22.0的了:https://gitee.com/harmonycommando_flutter/flutter
  2. 由于SDK支持到Dart 3.4.0, 对依赖的降级只限于四五个库,也不涉及写法变更问题
  3. 整个fluent组件我还是删掉处理了,没有详细尝试是否可以留下

如果只是这样的话还好,不过 0.9.54 开始引入了rhttp这个没适配ohos的库(考虑到这个本身是跨语言库,个人感觉把这个库移植到ohos有点困难),导致目前启动直接卡死在 await Rhttp.init(); 这里

不知道维持两套http请求机制是否可行,ohos用老的,其他平台用rhttp?

@Notsfsssf @HandwerSTD

@HandwerSTD
Copy link
Author

条件编译用Platform.isOhos判断就行了,简单看了一下网络请求的封装,感觉改起来似乎不会太困难?

不过这种方法仍然要开一个单独分支,但至少对master的修改能比较方便的同步给ohos了,不像之前完全不可维护

@bgli100
Copy link

bgli100 commented Jan 8, 2025

https://github.com/bgli100/pixez-flutter-ohos

姑且能用了
dart不熟,rhttp库相关的代码是回滚处理的,没有额外封装两种方式(反正都是merge conflict)
图存到虚空的问题打算引入这个处理
https://gitee.com/openharmony-sig/flutter_image_gallery_saver
用户名密码登录的问题后面再看

@bgli100
Copy link

bgli100 commented Jan 10, 2025

web登录(无法直连)和图片保存适配好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants