decodeDialogTheme static method
Decodes the given value
to an DialogTheme. This expects the given
value
to follow the structure below:
{
"alignment": <Alignment>,
"backgroundColor": <Color>,
"contentTextStyle": <TextStyle>,
"elevation": <double>,
"shape": <ShapeBorder>,
"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(
alignment: decodeAlignment(
value['alignment'],
validate: false,
),
backgroundColor: decodeColor(
value['backgroundColor'],
validate: false,
),
contentTextStyle: decodeTextStyle(
value['contentTextStyle'],
validate: false,
),
elevation: JsonClass.parseDouble(value['elevation']),
shape: decodeShapeBorder(
value['shape'],
validate: false,
),
titleTextStyle: decodeTextStyle(
value['titleTextStyle'],
validate: false,
),
);
}
return result;
}