repeating<T> static method
FrameNode
repeating<T>({
- required List<
T> over, - required List<
SceneNode> row(- T item
- String name = '',
- double x = 0,
- double y = 0,
- double? width,
- double? height,
- SceneColor? fill,
- SceneColor? borderColor,
- double borderWidth = 1,
- double corner = 0,
- double opacity = 1,
- NodeLayout layout = NodeLayout.absolute,
- double gap = 8,
- double? padding,
- double? paddingLeft,
- double? paddingTop,
- double? paddingRight,
- double? paddingBottom,
- SceneMainAxisAlignment mainAlign = SceneMainAxisAlignment.start,
- SceneCrossAxisAlignment crossAlign = SceneCrossAxisAlignment.center,
A frame drawn once per item of over, its cells built by row.
A static rather than a constructor because it is GENERIC: T is the
item type, inferred from the list, and that is what makes line.item
checked rather than dynamic. The cast inside cannot fail — the list
and the closure arrive together.
The frame's own children are the first item's cells, so the thing on screen and the thing in the file are the same row.
Implementation
static FrameNode repeating<T>({
required List<T> over,
required List<SceneNode> Function(T item) row,
String name = '',
double x = 0,
double y = 0,
double? width,
double? height,
SceneColor? fill,
SceneColor? borderColor,
double borderWidth = 1,
double corner = 0,
double opacity = 1,
NodeLayout layout = NodeLayout.absolute,
double gap = 8,
double? padding,
double? paddingLeft,
double? paddingTop,
double? paddingRight,
double? paddingBottom,
SceneMainAxisAlignment mainAlign = SceneMainAxisAlignment.start,
SceneCrossAxisAlignment crossAlign = SceneCrossAxisAlignment.center,
}) => FrameNode(
name: name,
x: x,
y: y,
width: width,
height: height,
fill: fill,
borderColor: borderColor,
borderWidth: borderWidth,
corner: corner,
opacity: opacity,
layout: layout,
gap: gap,
padding: padding,
paddingLeft: paddingLeft,
paddingTop: paddingTop,
paddingRight: paddingRight,
paddingBottom: paddingBottom,
mainAlign: mainAlign,
crossAlign: crossAlign,
children: over.isEmpty ? const [] : row(over.first),
)..repeated = SceneRepeat(items: over, row: (item) => row(item as T));