Skip to content

AnimatedList/ListView missing elements on scroll #59819

Closed

Description

@prvenk25

When updating a list in the middle of a scroll, animated list does not render all elements. Everything works as expected if the list is updated while scroll position is in the beginning of the list.

Steps to Reproduce

https://dartpad.dev/5ea587e079e7a05f4954cfd680e3f71c

  1. Scroll to middle/end of list.
  2. Press 'Show' to unhide elements
  3. Scroll up, list breaks, doesn't show all elements

Expected results: List should load all elements

Actual results: List stops loading at random.

Activity

  1. prvenk25 commented on Jun 19, 2020

    @prvenk25
    Author

    Similar issue with ListView as well

  2. changed the title [-]AnimatedList missing elements on scroll[/-] [+]AnimatedList/ListView missing elements on scroll[/+] on Jun 19, 2020
  3. iapicca commented on Jun 19, 2020

    @iapicca

    Hi @prvenk25
    I'm testing your code sample with the latest master

    screenshot

    image

    doctor
    [✓] Flutter (Channel master, 1.20.0-1.0.pre.118, on Mac OS X 10.15.5 19F101, locale en-GB)
        • Flutter version 1.20.0-1.0.pre.118 at /Users/nevercode/development/flutter_master
        • Framework revision 8665e13801 (8 hours ago), 2020-06-18 18:08:01 -0700
        • Engine revision b5f5e6332c
        • Dart version 2.9.0 (build 2.9.0-17.0.dev 54481776c9)
    
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
        • Android SDK at /Users/nevercode/Library/Android/sdk
        • Platform android-29, build-tools 29.0.2
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.5)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.5, Build version 11E608c
        • CocoaPods version 1.9.0
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 3.6)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 45.1.1
        • Dart plugin version 192.7761
        • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    
    [✓] VS Code
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.11.0
    
    [✓] Connected device (3 available)
        • macOS desktop • macos      • darwin-x64     • Mac OS X 10.15.5 19F101
        • Web Server    • web-server • web-javascript • Flutter Tools
        • Chrome        • chrome     • web-javascript • Google Chrome 83.0.4103.106
    
    • No issues found!

    the issue occur as described
    thank you for reporting this

  4. added
    f: scrollingViewports, list views, slivers, etc.
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    P0Critical issues such as a build break or regression
    on Jun 19, 2020
  5. HansMuller commented on Jun 19, 2020

    @HansMuller
    Contributor

    It's not yet clear if the source of this issue is the test case or if it's a real bug. Although further analysis may prove otherwise, I don't think it merits the P0 label. Removing the label now, and reviewing the issue.

  6. removed
    P0Critical issues such as a build break or regression
    on Jun 19, 2020
  7. justinmc commented on Jun 19, 2020

    @justinmc
    Contributor

    @ferhatb I see it in master at least.

  8. justinmc commented on Jun 19, 2020

    @justinmc
    Contributor

    This is definitely unexpected, but maybe someone that knows more about ListView/Sliver can say if it's a bug or not.

    The docs say "the builder is only called for those children that are actually visible". I don't know if that's a warning against returning non-visible children, but certainly you can work around this issue by not returning empty Containers from itemBuilder.

    Also just to make a note of another thing I checked, adding keys to the widgets returned from itemBuilder did not fix the problem.

  9. chunhtai commented on Jun 19, 2020

    @chunhtai
    Contributor

    finished investigation, there is a bug in layout offset calculation in the rendersliver performlayout. The self-correct after the toggle cause a certain child to have layout offset of zero and the sliver list think that child is the first child and refuse to layout anything before it.

  10. chunhtai commented on Jun 19, 2020

    @chunhtai
    Contributor

    it is pretty similar to #42142 it is another corner case i wasn't aware when i was fixing that issue

  11. nyzstar commented on Jun 19, 2020

    @nyzstar

    Do you guys have a recommendation for a short-term work around?

  12. self-assigned this
    on Jun 19, 2020
  13. chunhtai commented on Jun 19, 2020

    @chunhtai
    Contributor

    @nyzstar depending on your use case, This may be avoided if the app does not print out empty box, or each item has slight different sizes.

  14. iapicca commented on Jun 26, 2020

    @iapicca

    Hi all,
    I confirm is fixed in

    [✓] Flutter (Channel master, 1.20.0-1.0.pre.219, on Mac OS X 10.15.5 19F101, locale en-GB)
        • Flutter version 1.20.0-1.0.pre.219 at /Users/nevercode/development/flutter_master
        • Framework revision 98d66de888 (73 minutes ago), 2020-06-25 23:38:02 -0400
        • Engine revision 22b099bc63
        • Dart version 2.9.0 (build 2.9.0-19.0.dev ea87c9b01a)
    
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
        • Android SDK at /Users/nevercode/Library/Android/sdk
        • Platform android-29, build-tools 29.0.2
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.5)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.5, Build version 11E608c
        • CocoaPods version 1.9.0
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.0)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 46.0.2
        • Dart plugin version 193.7361
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    
    [✓] VS Code
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.11.0
    
    [✓] Connected device (4 available)
        • Pixel 3a      • 965AY0WP5C • android-arm64  • Android 10 (API 29)
        • macOS desktop • macos      • darwin-x64     • Mac OS X 10.15.5 19F101
        • Web Server    • web-server • web-javascript • Flutter Tools
        • Chrome        • chrome     • web-javascript • Google Chrome 83.0.4103.116
    
    • No issues found!
  15. github-actions commented on Aug 19, 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.

  16. locked as resolved and limited conversation to collaborators on Aug 19, 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.found in release: 1.17Found to occur in 1.17found in release: 1.19Found to occur in 1.19found in release: 1.20Found to occur in 1.20frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions