sliding_up_panel
sliding_up_panel copied to clipboard
Too much widget rebuild occurring when using PanelBuilder
The PanelBuilder is rebuilding too often that it has affected the performance of the scrolling effect when the PanelBuilder's scroll controller is connected to its child widget. You can reference this bug to #94, this can be seen as the duplicate of #94, I am opening this issue only because the bug in that issue seems not fixed, but the topic is already closed.
Any updates on this?
Try the following approach. This workaround might not stop the rebuilds but caches the child and fixes the scroll jank. What worked was, to store the widget inside the builder in a variable and return that variable from the builder.
var child;
return SlidingUpPanel(
panelBuilder: (scrollController) {
if(child == null) {
child = SomeScrollableWidget();
}
return child;
}
);
For those of u who want a temporary solution .. Download the source code and make some changes by urself.
#1 Keyboard trigger rebuild: Wrap the first Stack of _SlidingUpPanelState within a LayoutBuilder Replace all entries in the source code (panel.dart) with MediaQuery.of(context)... with constraints.maxHeight/maxWidth
#2 Scrolling trigger rebuild Remove/Comment the setState of _onGestureSlide
I don't know which side effects these changes can have. For my purpose it worked.
Try the following approach. This workaround might not stop the rebuilds but caches the child and fixes the scroll jank. What worked was, to store the widget inside the builder in a variable and return that variable from the builder.
var child; return SlidingUpPanel( panelBuilder: (scrollController) { if(child == null) { child = SomeScrollableWidget(); } return child; } );
I've used this and worked. Please fix this issue.