decodeDialogTheme static method

DialogTheme? decodeDialogTheme(
  1. dynamic value, {
  2. bool validate = true,
})

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

{
  "actionsPadding": "<EdgeInsetsGeometry>",
  "alignment": "<Alignment>",
  "backgroundColor": "<Color>",
  "contentTextStyle": "<TextStyle>",
  "elevation": "<double>",
  "iconColor": "<Color>",
  "shadowColor": "<Color>",
  "shape": "<ShapeBorder>",
  "surfaceColor": "<Color>",
  "titleTextStyle": "<TextStyle>"
}

See also:

Implementation

static DialogTheme? decodeDialogTheme(
  dynamic value, {
  bool validate = true,
}) {
  DialogTheme? result;

  if (value is DialogTheme) {
    result = value;
  } else if (value != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/dialog_theme',
      value: value,
      validate: validate,
    ));
    result = DialogTheme(
      actionsPadding: decodeEdgeInsetsGeometry(
        value['actionsPadding'],
        validate: false,
      ),
      alignment: decodeAlignment(
        value['alignment'],
        validate: false,
      ),
      backgroundColor: decodeColor(
        value['backgroundColor'],
        validate: false,
      ),
      contentTextStyle: decodeTextStyle(
        value['contentTextStyle'],
        validate: false,
      ),
      elevation: JsonClass.maybeParseDouble(value['elevation']),
      iconColor: decodeColor(
        value['iconColor'],
        validate: false,
      ),
      shadowColor: decodeColor(
        value['shadowColor'],
        validate: false,
      ),
      shape: decodeShapeBorder(
        value['shape'],
        validate: false,
      ),
      surfaceTintColor: decodeColor(
        value['surfaceTintColor'],
        validate: false,
      ),
      titleTextStyle: decodeTextStyle(
        value['titleTextStyle'],
        validate: false,
      ),
    );
  }

  return result;
}