Skip to content

Commit

Permalink
feat: optimize listview performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall committed Sep 30, 2024
1 parent 2881def commit 952bc46
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webf/lib/src/widget/element_to_widget_adapter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class WebFHTMLElementStatefulWidget extends StatefulWidget {
}
}

class HTMLElementState extends State<WebFHTMLElementStatefulWidget> {
class HTMLElementState extends State<WebFHTMLElementStatefulWidget> with AutomaticKeepAliveClientMixin {
final Set<Widget> customElementWidgets = HashSet();
final dom.Element _webFElement;

Expand Down Expand Up @@ -64,8 +64,12 @@ class HTMLElementState extends State<WebFHTMLElementStatefulWidget> {

@override
Widget build(BuildContext context) {
super.build(context);
return WebFHTMLElementToWidgetAdaptor(_webFElement, children: customElementWidgets.toList(), key: ObjectKey(_webFElement.hashCode),);
}

@override
bool get wantKeepAlive => true;
}

class WebFHTMLElementToWidgetAdaptor extends MultiChildRenderObjectWidget {
Expand Down

0 comments on commit 952bc46

Please sign in to comment.