encodeDataTableThemeData static method

Map<String, dynamic>? encodeDataTableThemeData(
  1. DataTableThemeData? value
)

Encodes the given value to a JSON representation.

{
  "checkboxHorizontalMargin": "<double>",
  "columnSpacing": "<double>",
  "dataRowColor": "<MaterialStateProperty<Color>>",
  "dataRowCursor": "<MaterialStateProperty<MouseCursor>",
  "dataRowMaxHeight": "<double>",
  "dataRowMinHeight": "<double>",
  "dataTextStyle": "<TextStyle,
  "decoration": "<BoxDecoration>",
  "dividerThickness": "<double>",
  "headingCellCursor": "<MaterialStateProperty<MouseCursor>",
  "headingRowColor": "<MaterialStateProperty<Color>>",
  "headingRowHeight": "<double>",
  "headingTextStyle": "<TextStyle>",
  "horizontalMargin": "<double>"
}

This won't maintain the WidgetStateProperty of each corresponding property, instead will resolve them by using an empty set of states, returning and encoding the resolved object.

See also:

Implementation

static Map<String, dynamic>? encodeDataTableThemeData(
  DataTableThemeData? value,
) {
  Map<String, dynamic>? result;

  if (value != null) {
    result = <String, dynamic>{
      'checkboxHorizontalMargin': value.checkboxHorizontalMargin,
      'columnSpacing': value.columnSpacing,
      'dataRowColor': encodeWidgetStatePropertyColor(
        value.dataRowColor,
      ),
      'dataRowCursor': encodeWidgetStatePropertyMouseCursor(
        value.dataRowCursor,
      ),
      'dataRowMaxHeight': value.dataRowMaxHeight,
      'dataRowMinHeight': value.dataRowMinHeight,
      'dataTextStyle': encodeTextStyle(
        value.dataTextStyle,
      ),
      'decoration': encodeBoxDecoration(
        value.decoration is! BoxDecoration
            ? null
            : value.decoration as BoxDecoration,
      ),
      'dividerThickness': value.dividerThickness,
      'headingCellCursor': encodeWidgetStatePropertyMouseCursor(
        value.headingCellCursor,
      ),
      'headingRowColor': encodeWidgetStatePropertyColor(
        value.headingRowColor,
      ),
      'headingRowHeight': value.headingRowHeight,
      'headingTextStyle': encodeTextStyle(
        value.headingTextStyle,
      ),
      'horizontalMargin': value.horizontalMargin,
    };
  }

  return _stripDynamicNull(result);
}