decodeSearchViewThemeData static method

SearchViewThemeData? decodeSearchViewThemeData(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to an SearchViewThemeData. This expects the given value to follow the structure below:

{
  "backgroundColor": "<Color>",
  "constraints": "<BoxConstraints>",
  "dividerColor": "<Color>",
  "elevation": "<double>",
  "headerHintStyle": "<TextStyle>",
  "headerTextStyle": "<TextStyle>",
  "shape": "<OutlinedBorder>",
  "side": "<BorderSide>",
  "surfaceTintColor": "<Color>"
}

See also:

Implementation

static SearchViewThemeData? decodeSearchViewThemeData(
  dynamic value, {
  bool validate = true,
}) {
  SearchViewThemeData? result;

  if (value is SearchViewThemeData) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/search_view_theme_data',
      value: value,
      validate: validate,
    ));

    result = SearchViewThemeData(
      backgroundColor: decodeColor(
        value['backgroundColor'],
        validate: false,
      ),
      constraints: decodeBoxConstraints(
        value['constraints'],
        validate: false,
      ),
      dividerColor: decodeColor(
        value['dividerColor'],
        validate: false,
      ),
      elevation: JsonClass.maybeParseDouble(value['elevation']),
      headerHintStyle: decodeTextStyle(
        value['headerHintStyle'],
        validate: false,
      ),
      headerTextStyle: decodeTextStyle(
        value['headerTextStyle'],
        validate: false,
      ),
      shape: decodeOutlinedBorder(
        value['shape'],
        validate: false,
      ),
      side: decodeBorderSide(
        value['side'],
        validate: false,
      ),
      surfaceTintColor: decodeColor(
        value['surfaceTintColor'],
        validate: false,
      ),
    );
  }

  return result;
}