SfDataGridThemeData constructor Null safety
- {Brightness? brightness,
- Color? gridLineColor,
- double? gridLineStrokeWidth,
- Color? selectionColor,
- DataGridCurrentCellStyle? currentCellStyle,
- Color? frozenPaneLineColor,
- double? frozenPaneLineWidth,
- Color? sortIconColor,
- Color? headerHoverColor,
- Color? headerColor,
- double? frozenPaneElevation,
- Color? rowHoverColor,
- Color? columnResizeIndicatorColor,
- double? columnResizeIndicatorStrokeWidth,
- TextStyle? rowHoverTextStyle}
Create a SfDataGridThemeData that's used to configure a SfDataGridTheme.
Implementation
factory SfDataGridThemeData({
Brightness? brightness,
Color? gridLineColor,
double? gridLineStrokeWidth,
Color? selectionColor,
DataGridCurrentCellStyle? currentCellStyle,
Color? frozenPaneLineColor,
double? frozenPaneLineWidth,
Color? sortIconColor,
Color? headerHoverColor,
Color? headerColor,
double? frozenPaneElevation,
Color? rowHoverColor,
Color? columnResizeIndicatorColor,
double? columnResizeIndicatorStrokeWidth,
TextStyle? rowHoverTextStyle,
}) {
brightness = brightness ?? Brightness.light;
final bool isLight = brightness == Brightness.light;
gridLineColor ??= isLight
? const Color.fromRGBO(0, 0, 0, 0.26)
: const Color.fromRGBO(255, 255, 255, 0.26);
gridLineStrokeWidth ??= 1;
selectionColor ??= isLight
? const Color.fromRGBO(238, 238, 238, 1)
: const Color.fromRGBO(48, 48, 48, 1);
currentCellStyle ??= isLight
? const DataGridCurrentCellStyle(
borderColor: Color.fromRGBO(0, 0, 0, 0.36), borderWidth: 1.0)
: const DataGridCurrentCellStyle(
borderColor: Color.fromRGBO(255, 255, 255, 0.36), borderWidth: 1.0);
frozenPaneLineColor ??= isLight
? const Color.fromRGBO(0, 0, 0, 0.24)
: const Color.fromRGBO(255, 255, 255, 0.24);
frozenPaneLineWidth ??= 2;
headerHoverColor ??= isLight
? const Color.fromRGBO(245, 245, 245, 1)
: const Color.fromRGBO(66, 66, 66, 1);
sortIconColor ??= isLight ? Colors.black54 : Colors.white54;
headerColor ??= isLight
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(33, 33, 33, 1);
frozenPaneElevation ??= 5.0;
columnResizeIndicatorColor ??=
isLight ? Colors.blue[500]! : Colors.tealAccent[200]!;
columnResizeIndicatorStrokeWidth ??= 2;
rowHoverColor ??= isLight
? const Color.fromRGBO(0, 0, 0, 0.08)
: const Color.fromRGBO(255, 255, 255, 0.12);
rowHoverTextStyle ??= isLight
? const TextStyle(
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
fontSize: 14,
color: Colors.black87)
: const TextStyle(
fontFamily: 'Roboto',
fontWeight: FontWeight.w400,
fontSize: 14,
color: Color.fromRGBO(255, 255, 255, 1));
return SfDataGridThemeData.raw(
brightness: brightness,
gridLineColor: gridLineColor,
gridLineStrokeWidth: gridLineStrokeWidth,
selectionColor: selectionColor,
currentCellStyle: currentCellStyle,
frozenPaneLineColor: frozenPaneLineColor,
frozenPaneLineWidth: frozenPaneLineWidth,
headerHoverColor: headerHoverColor,
sortIconColor: sortIconColor,
headerColor: headerColor,
frozenPaneElevation: frozenPaneElevation,
rowHoverColor: rowHoverColor,
columnResizeIndicatorColor: columnResizeIndicatorColor,
columnResizeIndicatorStrokeWidth: columnResizeIndicatorStrokeWidth,
rowHoverTextStyle: rowHoverTextStyle,
);
}