Skip to content

[Documentation] update InteractiveViewer.builder example to make it more performant #96005

@jollygreenlaser

Description

@jollygreenlaser

Details

https://api.flutter.dev/flutter/widgets/InteractiveViewer/builder.html

On line 114, change the rowCount: 60 to anything small yet reasonable, like 250. Observe the scroll functionality drop to single digit framerate.

Not quite as small, but still reasonable values like 1,000 drop to fractional frames per second. 10,000 crashes the page on scroll. Debug lowers these thresholds but they are still quite apparent even in a release build.

Obviously, a list like this should be using more specialized widgets like Slivers. However the documentation, the original issue (#58603), the PR that added it (#77414) all talk about this as a performance constructor. This doesn't seem feasible in the current form.

EDIT: Removed some stuff now that I realized that Positioned works to turn the builder form into a viewport. It would be nice to have this better documented and perhaps available in a more explicit manner.

justinmc thanks for all your work on making InteractiveViewer as powerful and easy to use as it currently is.

Target Platform:
Web

Target OS version/browser:
OSX, both Chrome and Firefox

Devices:
Macbook Pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)d: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.perf: speedPerformance issues related to (mostly rendering) speed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions