Skip to content

SliverGridLayout's documentation for get[Min|Max]ChildIndexForScrollOffset is misleading #16045

@apwilson

Description

@apwilson

Current documentation:

getMaxChildIndexForScrollOffset(double scrollOffset) → int
The maximum child index that is visible at (or before) this scroll offset.
getMinChildIndexForScrollOffset(double scrollOffset) → int
The minimum child index that is visible at (or after) this scroll offset.

How these are actually used seems to indicate this should be the documentation:

getMaxChildIndexForScrollOffset(double scrollOffset) → int
The maximum child index that intersects with (or is before) this scroll offset.
getMinChildIndexForScrollOffset(double scrollOffset) → int
The minimum child index that intersects with (or is after) this scroll offset.

Basically, all the children from getMin...(scrollOffset) to getMax...(scrollOffset+extent) are being laid out but the documentation suggests that getMin...(scrollOffset) to getMax...(scrollOffset) should be all the children being laid out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/f: scrollingViewports, list views, slivers, etc.found in release: 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.good first issueRelatively approachable for first-time contributorshas 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