decodeBoxShadow static method
Decodes the given value
into a BoxDecoration. If the value is null
then null
will be returned. Otherwise, this expects a Map like value
that in JSON would look like:
{
"blurRadius": "<double>",
"blurStyle": "<BlurStyle>",
"color": "<Color>",
"offset": "<Offset>",
"spreadRadius": "<double>"
}
See also:
Implementation
static BoxShadow? decodeBoxShadow(
dynamic value, {
bool validate = true,
}) {
BoxShadow? result;
if (value is BoxShadow) {
result = value;
} else if (value != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/box_shadow',
value: value,
validate: validate,
));
result = BoxShadow(
blurStyle: decodeBlurStyle(
value['blurStyle'],
validate: false,
) ??
BlurStyle.normal,
blurRadius: JsonClass.maybeParseDouble(value['blurRadius']) ?? 0.0,
color: decodeColor(
value['color'],
validate: false,
) ??
const Color(0xFF000000),
offset: decodeOffset(
value['offset'],
validate: false,
) ??
Offset.zero,
spreadRadius: JsonClass.maybeParseDouble(value['spreadRadius']) ?? 0.0,
);
}
return result;
}