FitGridColumnLayout class

The resolved horizontal geometry of a grid: which columns are visible, how wide each one is, where each one starts, and which of them are pinned to an edge instead of scrolling.

offsets is a prefix sum with one extra trailing entry, so the span of column i is offsets[i]..offsets[i + 1] and offsets.last is the total content width. Keeping it precomputed is what lets the render layer binary search for the first visible column instead of walking from zero on every paint.

Frozen columns are not a separate structure. The visible columns arrive already partitioned — leading-pinned, then scrolling, then trailing-pinned — so the three bands are contiguous index ranges over the same arrays, and every offset below is still one subtraction. Anything else would mean three parallel layouts that have to be kept in agreement.

Annotations

Constructors

FitGridColumnLayout({required List<String> ids, required List<double> widths, List<FitGridFreeze>? freezes})

Properties

freezes → List<FitGridFreeze>
Freeze state of each visible column, parallel to ids. Sorted: every FitGridFreeze.start precedes every FitGridFreeze.none, which precedes every FitGridFreeze.end.
final
hasFrozenColumns → bool
Whether any column is pinned. The render layer takes a markedly cheaper path when nothing is, which is the common case.
no setter
hashCode → int
The hash code for this object.
no setteroverride
ids → List<String>
Ids of the visible columns, in display order.
final
isEmpty → bool
no setter
leadingFrozenCount → int
How many columns are pinned to the leading edge. They occupy 0..leadingFrozenCount.
final
leadingFrozenWidth → double
Screen width taken by the leading pinned band.
no setter
length → int
no setter
offsets → List<double>
Prefix sums of widths, length widths.length + 1.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollableWidth → double
Content width of the columns that actually scroll.
no setter
totalWidth → double
Total width of all visible columns.
no setter
trailingFrozenStart → int
Index of the first column pinned to the trailing edge, or length when none are. They occupy trailingFrozenStart..length.
final
trailingFrozenWidth → double
Screen width taken by the trailing pinned band.
no setter
widths → List<double>
Resolved width of each visible column, parallel to ids.
final

Methods

columnAtOffset(double x) → int
Index of the first column whose trailing edge is past x in content space, or length when x is past the end. Binary search over offsets.
indexOf(String id) → int
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
scrollableColumnAtOffset(double x) → int
columnAtOffset confined to the scrolling band, which is what the render layer wants when it maps a pointer that missed both pinned bands.
scrolls(int index) → bool
Whether column index scrolls rather than being pinned.
toString() → String
A string representation of this object.
override
widthOf(String id) → double

Operators

operator ==(Object other) → bool
The equality operator.
override

Constants

empty → const FitGridColumnLayout
An empty layout, for a grid with no visible columns.