buildDefaultTheme method
Builds the default theme for cells in this row.
Creates a TableCellTheme with default styling when no explicit cellTheme is provided. The default theme includes:
- Border with bottom line using theme border color
- Background color that changes to muted on hover
- Text style that becomes muted when disabled
The theme uses WidgetStateProperty to adapt styling based on cell state (hovered, selected, disabled).
Parameters:
context(BuildContext, required): Build context for accessing theme data
Returns TableCellTheme with default or custom cell styling.
Implementation
TableCellTheme buildDefaultTheme(BuildContext context) {
if (cellTheme != null) {
return cellTheme!;
}
final theme = Theme.of(context);
return TableCellTheme(
border: WidgetStateProperty.resolveWith(
(states) {
return Border(
bottom: BorderSide(
color: theme.colorScheme.border,
width: 1,
),
);
},
),
backgroundColor: WidgetStateProperty.resolveWith(
(states) {
return states.contains(WidgetState.hovered)
? theme.colorScheme.muted.withValues(alpha: 0.5)
: null;
},
),
textStyle: WidgetStateProperty.resolveWith(
(states) {
return TextStyle(
color: states.contains(WidgetState.disabled)
? theme.colorScheme.muted
: null,
);
},
),
);
}