fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"borderOnForeground": <bool>,
"clipBehavior": <Clip>,
"color": <Color>,
"elevation": <double>,
"margin": <EdgeInsetsGeometry>,
"semanticContainer": <bool>,
"shadowColor": <Color>,
"shape": <ShapeBorder>,
"surfaceTintColor": <Color>
}
See also:
ThemeDecoder.decodeClip
ThemeDecoder.decodeEdgeInsetsGeometry
ThemeDecoder.decodeShapeBorder
Implementation
static JsonCardBuilder? fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
JsonCardBuilder? result;
if (map != null) {
result = JsonCardBuilder(
borderOnForeground: map['borderOnForeground'] == null
? true
: JsonClass.parseBool(
map['borderOnForeground'],
),
clipBehavior: ThemeDecoder.decodeClip(
map['clipBehavior'],
validate: false,
),
color: ThemeDecoder.decodeColor(
map['color'],
validate: false,
),
elevation: JsonClass.parseDouble(map['elevation']),
margin: ThemeDecoder.decodeEdgeInsetsGeometry(
map['margin'],
validate: false,
),
semanticContainer: map['semanticContainer'] == null
? true
: JsonClass.parseBool(
map['semanticContainer'],
),
shadowColor: ThemeDecoder.decodeColor(
map['color'],
validate: false,
),
shape: ThemeDecoder.decodeShapeBorder(
map['shape'],
validate: false,
),
surfaceTintColor: ThemeDecoder.decodeColor(
map['color'],
validate: false,
),
);
}
return result;
}