styleForCell method
Returns a style when the effect applies to the target cell.
Implementation
Style? styleForCell({
required int row,
required int column,
required TableThemeSection section,
required int rowCount,
required int columnCount,
required bool hasHeader,
required bool hasDarkBackground,
}) {
if (!_matchesSection(section) || !_matchesCoordinates(row, column)) {
return null;
}
if (style == null && gradient.isEmpty) return null;
Style? result = style?.copy();
if (gradient.isNotEmpty) {
final sampled = _sampleGradientCellColor(
row: row,
column: column,
rowCount: rowCount,
columnCount: columnCount,
hasHeader: hasHeader,
axis: gradientAxis,
hasDarkBackground: hasDarkBackground,
gradientPalette: gradient,
);
if (sampled != null) {
if (result == null) {
result = Style();
result.foreground(sampled);
} else {
final existing = result.foregroundColor;
if (existing == null || blendMode == TableBlendMode.normal) {
result.foreground(sampled);
} else {
result.foreground(
TableTheme.applyBlendMode(
existing,
sampled,
blendMode,
hasDarkBackground: hasDarkBackground,
),
);
}
}
}
}
return result;
}