-
Notifications
You must be signed in to change notification settings - Fork 303
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
Feat/support flutter widget #904
Conversation
…ken Element tree.
…ppendChild on widgetElement supported.
This isn't related to HTML custom elements right? |
Not web components,web components will support in future. |
List<Widget> children = List.generate(childNodes.length, (index) { | ||
if (childNodes[index] is WidgetElement) { | ||
_KrakenAdapterWidgetState state = (childNodes[index] as WidgetElement)._state!; | ||
return state.build(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
每次刷新,整个列表都要重新 rebuild,性能瓶颈会很明显。需要优化一下,缓存前面已经构建好的 widget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里子节点会调用 WidgetElement 上的 build 方法,该方法也许会依赖父节点的信息做一些转换,重新 build 把优化的权利交给开发者,这里不缓存防止需要重新 build 的时候不执行。KrakenElementToWidgetAdaptor 我加上缓存。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一些优化需要调整。貌似 main 上 widget.dart 没有同步过来,需要手动 check 一下
支持 Flutter Widget 与 Element 混合渲染,互相嵌套。
Example: