Skip to content

SliverFillRemaining fill more than remaining space available  #17444

Closed

Description

@asoseil

It seems that SliverFillRemaining fills a space with a height equal to the height of the viewport and not equal to remaining available space.

new CustomScrollView(
        slivers: <Widget>[
          new SliverToBoxAdapter(
          child: new Container(color: Colors.red,
          height: 150.0,
          )),
          new SliverFillRemaining(
            child: new Container(color: Colors.white),
          )
        ],
      )

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    f: scrollingViewports, list views, slivers, etc.
    on May 9, 2018
  2. kbrz commented on May 31, 2018

    @kbrz

    Same thing happens to me. Having CustomScrollView with SliverAppBar, SliverList using SliverChildBuilderDelegate and SliverFillRemaining results in SliverFillRemaining's height equal to viewport's height. So I can scroll until last element of the list is scrolled out of the screen.

  3. figengungor commented on Oct 26, 2018

    @figengungor

    +1

  4. added this to the milestone on Oct 27, 2018
  5. fit-aditya commented on Nov 15, 2018

    @fit-aditya

    I can confirm this is the behavior as of 0.11.3, any workarounds?

    Edit: there is some unexpected behavior -

    1. Create a CustomScrollView with SliverAppBar and SliverFillRemaining
    2. Add a FractionallySizedBox inside SliverFillRemaining with heightFactor 0.5 and a Container with color green
    3. Scrolling the UI changes height of the FractionallySizedBox

    How is scrolling adding height to the SliverFillRemaining?

  6. lubritto commented on Jan 15, 2019

    @lubritto
    Contributor

    @zoechi Any update ?

  7. aloisdeniel commented on Apr 10, 2019

    @aloisdeniel

    Not working for me too.

    After profiling the source code, it seems that the issue comes from :

    aloisdeniel@54952a9#diff-85d3eb0d3e238772f866f76eab9b7acd

    When replacing with scrollExtent: constraints.scrollOffset, I get the expected behaviour.

  8. thekeenant commented on Apr 11, 2019

    @thekeenant
    Contributor

    This helped me out: https://pub.dartlang.org/packages/sliver_fill_remaining_box_adapter
    I didn't look into how it works/fixed the issue I was facing, but it seems related to the issue reported here.

  9. minhdtb commented on Apr 30, 2019

    @minhdtb

    I got the same issue. Any update now?

  10. dnfield commented on May 15, 2019

    @dnfield
    Contributor

    Was looking at this with @chunhtai and @Piinks - it seems like changing line 127 of sliver_fill.dart to

     scrollExtent: extent,
    

    Fixes this but breaks the nested scroll view tests. It's possible those nested scroll view tests are incorrect. @Piinks says she'll look into it a bit more.

  11. self-assigned this
    on May 15, 2019
  12. ziakhan110 commented on May 26, 2019

    @ziakhan110

    any fix for this yet?

  13. Piinks commented on May 30, 2019

    @Piinks
    Contributor

    ... it seems like changing line 127 of sliver_fill.dart to

     scrollExtent: extent,
    

    Fixes this but breaks the nested scroll view tests. It's possible those nested scroll view tests are incorrect.

    This appears to not only break the NestedScrollView tests, but also breaks the expected physics in regards to the iOS bounce at the top and bottom of the CustomScrollView.

    When replacing with scrollExtent: constraints.scrollOffset, I get the expected behaviour.

    Does seem to work for this issue. I think that the use cases for SliverFillRemaining on its own in the sample code above and within NestedScrollView have different behavior expectations.

    I have a PR up now (#33627) that instead creates a flag for SliverFillRemaining to be able to specify which behavior you want from this widget. Currently, it defaults to work appropriately in this situation.

  14. modified the milestones: , June 2019 on Jun 12, 2019
  15. chloe722 commented on Jun 14, 2019

    @chloe722

    +1

  16. eliwowlol123 commented on Apr 12, 2020

    @eliwowlol123

    This helped me out: https://pub.dartlang.org/packages/sliver_fill_remaining_box_adapter
    I didn't look into how it works/fixed the issue I was facing, but it seems related to the issue reported here.

    thanks, you are a g-d

  17. niallshaw commented on Jun 8, 2020

    @niallshaw

    I don't think this issue should be closed.

  18. galacticgibbon commented on Jul 13, 2020

    @galacticgibbon

    I'm not sure what @Piinks PR fixed here?
    @dnfield solution to

    seems like changing line 127 of sliver_fill.dart to

     scrollExtent: extent,
    

    Isn't available anymore, and the issue is not related to NestedScrollViews. The issue still exists

  19. Piinks commented on Jul 13, 2020

    @Piinks
    Contributor

    I'm not sure what @Piinks PR fixed here?
    @dnfield solution to

    seems like changing line 127 of sliver_fill.dart to

     scrollExtent: extent,
    

    Isn't available anymore, and the issue is not related to NestedScrollViews. The issue still exists

    @magpiedigital I would recommend filing a new issue with a code sample that reproduces the bug you are experiencing along with the output of flutter doctor -v . Feel free to ping me on it and we can take a look! :)

  20. galacticgibbon commented on Jul 13, 2020

    @galacticgibbon

    It's the same issue as the OP and their code is all you need to reproduce the bug. Just scroll down. Perhaps I'm wrong, but my expected behavior is that it works like a sliver version of Expanded widget.

  21. Piinks commented on Jul 13, 2020

    @Piinks
    Contributor

    It's the same issue as the OP and their code is all you need to reproduce the bug. Just scroll down. Perhaps I'm wrong, but my expected behavior is that it works like a sliver version of Expanded widget.

    The OP was solved by the introduction of SliverFillRemaining.hasScrollBody, which defaults to true. By default, SliverFillRemaining will maintain the behavior of the OP, but by using hasScrollBody: false, it is solved. There are several sample apps that demonstrate different use cases in the api documentation: https://master-api.flutter.dev/flutter/widgets/SliverFillRemaining-class.html

    If you find you are still experiencing an issue, please file a new bug. Thanks! :)

  22. dvirgiln commented on Feb 5, 2021

    @dvirgiln

    I opened a similar issue. It seems that using TabBar and setting hasScrollBody:false does not make it to work.

    #75517

  23. dvirgiln commented on Feb 5, 2021

    @dvirgiln

    @Piinks could you have a look to the ticket I opened. It is quite related.

    Thanks

  24. github-actions commented on Aug 6, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  25. locked as resolved and limited conversation to collaborators on Aug 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

f: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions