Constructs a new BaseCollectionViewLayout.
The background rectangle for the layout.
PrivatecellArray storing individual cell positions (virtual X positions) when isVariableWidth is true. Index corresponds to cell index.
Map of cell indices to cell instances.
PrivatecellArray storing individual cell widths when isVariableWidth is true. Index corresponds to cell index.
Current header style key for component-based headers.
The debug label for the layout.
Indicates whether this layout is enabled.
Injected font manager for font lookups.
Whether this layout has a header.
Header fragment for component-based headers.
Header label node, if present.
PrivatehorizontalCached physical content extent for variable-width rows.
Injected instance pool for cell reuse.
The last updated visible cells virtual position.
Injected node pool for managing reusable nodes.
The callback to invoke when the row is released.
The callback to invoke at the end of row layout rendering.
The callback to invoke at the start of row layout rendering.
Array of currently rendered cells.
The row this layout manages.
The current screen position (y offset).
Injected view fragment provider for component-based headers.
The current virtual scroll position.
Returns the number of items in the row.
Assigns a row to this layout and configures cell and header settings.
The row to assign.
Calculates and updates the visible cells based on the given virtual position. Overrides base implementation to support variable cell widths.
The virtual position to calculate the visible cells from.
The y position (unused for horizontal rows).
Whether to add buffer cells for smooth scrolling.
Configures the header for the row based on settings. Supports both legacy single-label headers and new component-based headers.
Converts placeholder cells to real cells (to be implemented by subclasses).
Retrieves a cell at the specified index. If the cell does not exist, it reserves a new cell from the instancePool, sets it to visible, assigns the index, and stores it in the cellsByIndex array.
The pool key is normally the row's cellSettingsKey (or loadingCellStyleKey for loading placeholders). When the
row has useMixedCellStyleKeys, each item may supply its own cellSettingsKey so different cells in the same row
can use different styles.
The index of the cell to retrieve.
The cell at the specified index, or a newly reserved cell if it did not exist.
Gets the cell index at a given virtual position. Overrides base implementation to support variable cell widths.
The virtual position.
The cell index.
PrivategetGets the virtual position for a specific cell index. Returns the stored position if variable width is enabled, otherwise calculates using fixed width.
The cell index.
The virtual X position.
Gets the current cell positions array.
Array of cell positions.
Gets the width for a specific cell index. Returns the stored width if variable width is enabled, otherwise returns the row's cellSize[0].
The cell index.
The cell width.
Gets the current cell widths array.
Array of cell widths.
Gets the item index whose center is closest to the stored focused cell X position. Used for FocusOnClosestItem strategy.
The item index closest to the stored X position.
Returns the horizontal content extent in physical layout coordinates.
Gets the virtual position for a given cell index. Overrides base implementation to support variable cell widths.
The cell index.
The virtual position.
Returns the initial horizontal offset that exposes logical item zero.
Returns the largest valid horizontal scroll offset for this row.
Gets the next item index when moving vertically within row. Override this function if your row has more than one item per sub-row, and you want to move to the next item when moving vertically. That is, for rows containing one line of items (for instance, HorizontalRow), the method returns -1 (because the next or previous line of items does not exist)
1 for up, 1 for down
Gets the next page item index when moving horizontally within row. Override this function if your row has more than one item per sub-row, and you want to move to the next page item when moving horizontally.
1 for left, 1 for right
The index of the next page item.
Gets the rendered cell at the specified index.
The cell index.
The rendered cell, if any.
Gets the rendered cell at a given virtual position.
The virtual position.
The rendered cell.
Calculates the on-screen position for a cell index, accounting for the current horizontal scroll (virtualPosition). Used by pointer/touch focus so the focus indicator follows the item to its scrolled location rather than its release point. The returned X is clamped to the visible viewport so the indicator never renders past the row edges. Assumes a horizontal layout; subclasses may override.
The cell index.
The base offset to apply ([x, y]); offset[0] is the minimum X, offset[1] is the Y.
The clamped [x, y] screen position, or undefined if the index is out of bounds.
Gets the target item index in the horizontal direction.
1 for left, 1 for right
Whether the key press is a long press.
The index of the target item.
Returns the [x, y] virtual position within this row necessary to bring the target item index
into view according to the requested position strategy. Base implementation returns a default
x using xOffset and a y based on the row's rendered list position and screen position.
Specialized layouts should override this to provide accurate item positions.
Returns the vertical position of the item index.
The item index.
The vertical position of the item index. The same as getVerticalCorrectedPositionForItemIndex, but without the screen position offset.
Gets the virtual vertical position for a specific row index related to the row header.
The item index.
The virtual vertical position for the row.
Gets the virtual row index for the target index.
The target index.
The virtual row index.
Gets the number of virtual rows in the layout.
The number of virtual rows in the layout.
Determines if a cell index is visible on screen at the given virtual position. Overrides base implementation to support variable cell widths.
The cell index.
The virtual position.
True if the cell is on screen, false otherwise.
Called when the row enters the screen. Handles any necessary initialization or state updates for the row.
Called when the row exits the screen. Handles any necessary cleanup or state updates for the row.
Called before the layout is released back to the pool. Clears cell widths and positions arrays.
Called before the layout is reused from the pool. Clears cell widths and positions arrays.
Refreshes only compatibility-installed direction members after a locale change.
Renders the horizontal row at the specified virtual position. Overrides base implementation to support variable cell widths in rendering.
The render event containing virtual position and other details.
Renders the row as a hidden row (to be implemented by subclasses).
Sets the cell widths and positions arrays. This method should be called from the row's OnContentReady callback to populate the cellWidths and cellPositions arrays based on content.
Array of cell widths, indexed by cell index.
Array of cell virtual X positions, indexed by cell index.
Determines if the visible cells should be recalculated.
The virtual screen y position.
True if the visible cells should be recalculated, false otherwise.
Shows placeholder cells (not implemented).
HorizontalRowLayoutis a specialized implementation ofBaseCollectionViewLayoutdesigned to handle horizontal layouts for rows in a collection view. It manages the rendering, lifecycle events, and layout calculations for horizontally arranged rows.