resolveCellStyle function
CellStyle
resolveCellStyle({
- required Iterable<
CellStyle?> cascade, - Set<
CellStyleState> states = const {},
Resolves cascade from lowest to highest priority.
Base styles merge in order. For each active state, the highest-priority non-null patch wins as a unit and is then merged over the base. An explicit CellStyle.none therefore suppresses a lower-priority state cue. Disabled is exclusive of transient/value states.
Implementation
CellStyle resolveCellStyle({
required Iterable<CellStyle?> cascade,
Set<CellStyleState> states = const {},
}) {
final layers = [for (final style in cascade) ?style];
var result = CellStyle.none;
for (final layer in layers) {
result = result.merge(_plainCellStyle(layer));
}
final active = states.contains(CellStyleState.disabled)
? const [CellStyleState.disabled]
: _cellStyleStatePaintOrder.where(states.contains);
for (final state in active) {
CellStyle? patch;
for (final layer in layers) {
if (layer is _InteractiveCellStyle) {
patch = layer._styleFor(state) ?? patch;
}
}
if (patch != null) {
result = result.merge(_plainCellStyle(patch));
}
}
return result;
}