Deprecating RenderSliverFillViewport

Skip to first unread message

Weiyu Huang

Aug 13, 2019, 6:40:51 PM8/13/19
to Flutter Public Announcements (flutter-announce)
As a part of this PR:, I propose to deprecate the RenderSliverFillViewport class.
This should only affect those who are using the SliverFillViewport widget or RenderSliverFillViewport directly. 

# Why deprecating RenderSliverFillViewport?

Currently RenderSliverFillViewport has a few bugs in its implementation, such as With the introduction of SliverLayoutBuilder, the functionality of RenderSliverFillViewport can be perfectly replicated at the widget level, without those bugs. 
Instead of continuing to maintain RenderSliverFillViewport, deprecating it in favor of SliverLayoutBuilder seems to be more appealing, as SliverLayoutBuilder is more generic, composable and it is a widget.

# Migration Path

Mostly like no migration will be needed for code that's not using `RenderSliverFillViewport` directly. 

If you're using `SliverFillViewport`, it should continue to work, except when viewportFraction > 1 the initial scroll offset will be 0 instead of a negative number and you may have to override ViewportOffset.applyContentDimensions to counteract this. Please refer to for example. 

If you're using `RenderSliverFillViewport`, consider replacing it with a SliverLayoutBuilder at the widget level.

If I can be of any help in porting code or answering questions, please contact me directly or add a comment to the pull request:

Weiyu Huang

Aug 13, 2019, 8:28:03 PM8/13/19
to Flutter Public Announcements (flutter-announce)
If you're using RenderSliverFillViewport or its subclasses, and it's not feasible to convert to SliverLayoutBuilder, consider subclassing RenderSliverFixedExtentBoxAdaptor
A minimal implementation of a render sliver class that fills the main axis of the view port would look like:

class RenderSliverFillViewport extends RenderSliverFixedExtentBoxAdaptor {
    @required RenderSliverBoxChildManager childManager,
  }) : super(childManager: childManager);

  double get itemExtent => constraints.viewportMainAxisExtent;

Reply all
Reply to author
0 new messages