pag-flutter插件兼容鸿蒙 #2526
-
pag-flutter兼容鸿蒙,参照安卓、iOS逻辑写,画面黑屏不出来,使用texturesRegistry加载png格式图片是可以的,texturesRegistry逻辑应该是对的,pag文件不行,如下: |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 11 replies
-
检查一下surface创建的返回值是不是空,或者有没有打印失败信息。如果创建失败了,去检查surfaceID你分配内存了没有。就是从上面要能用鸿蒙接口查询出有效宽高才行。PAG不帮你分配内存。 |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
flutter端模块,如上图:目录中pag-flutter、res、third_plugin是同级的三个模块,xxx.pag文件在res模块中资源目录下,third_plugin模块某页面中调用了pag-flutter模块中 PAGView.asset()。 |
Beta Was this translation helpful? Give feedback.
-
已经修复了,此处添加代码 if (flutterPackage != undefined && (flutterPackage?.length > 0)) { assetName = 'packages/' + flutterPackage + '/'+ assetName } |
Beta Was this translation helpful? Give feedback.
-
有新的问题,app的一级页面(底部tab对应页面)有一个pag动画在播放,当我跳转到二级页面,再返回,然后每一秒输出一条:FlutterNapi --> Tried to send a platform message to Flutter, but FlutterNapi was detached from native C++. Could not send. Channel: flutter_pag_plugin. Response ID: 88。如上多操作几次,然后每一秒输出的越多。最重要的是页面开始卡顿,甚至闪退。 |
Beta Was this translation helpful? Give feedback.
-
通过输出日志查看,在PagView.dispose 方法中的release 方法是调用了,不是这个原因。新发现一点希望有帮助,一级页面跳转二级页面,使用路由跳转 router.pushUrl()没问题,改用Navigation() {}组件跳转就有问题(动画几乎不动),必现。 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
可以参考下这个实现 libpag/pag-flutter#51