Skip to content

[Feature/Optimization] Add an itemExtentPerIndex property to ListView.builder #113431

@oddko

Description

@oddko

Use case

On large spreadsheet-like UIs with cells of different size, there is currently no way to optimize scrolling, which has to (lazily-)build all widgets when scrolling to a new position, resulting in laggy scrolling with a large amount of rows or complex widgets (particularly on Desktop where an arbitrary scroll position can be set by the user, or with search features that jump to a certain row, etc.).

The current itemExtent and prototypeItem properties only cover the use case where items all have the same size.

Proposal

Allow passing a property itemExtentPerIndex or similar in the ListView.builder constructor that is a function taking the index in the ListView as a parameter and returns the size in pixels. That way scrolling can be made smooth even if the items have different sizes inside of the ListView and are lazily built.

In case this is considered too much of an edge-case to put in the API, would you have hints (if it is possible) on how to implement this with a custom list view ?

Thank you very much.

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterf: scrollingViewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions