fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"locale": "<Locale>",
"maxLines": "<int>",
"overflow": "<TextOverflow>",
"selectionColor": "<Color>",
"semanticsLabel": "<String>",
"softWrap": "<bool>",
"strutStyle": "<StrutStyle>",
"style": "<TextStyle>",
"text": "<String>",
"textAlign": "<TextAlign>",
"textDirection": "<TextDirection>",
"textHeightBehavior": "<TextHeightBehavior>",
"textScaleFactor": "<double>",
"textWidthBasis": "<TextWidthBasis>"
}
See also:
ThemeDecoder.decodeColor
ThemeDecoder.decodeLocale
ThemeDecoder.decodeTextOverflow
ThemeDecoder.decodeStrutStyle
ThemeDecoder.decodeTextAlign
ThemeDecoder.decodeTextDirection
ThemeDecoder.decodeTextHeightBehavior
ThemeDecoder.decodeTextStyle
ThemeDecoder.decodeTextWidthBasis
Implementation
static JsonTextBuilder? fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
JsonTextBuilder? result;
if (map != null) {
result = JsonTextBuilder(
locale: ThemeDecoder.decodeLocale(
map['local'],
validate: false,
),
maxLines: JsonClass.maybeParseInt(map['maxLines']),
overflow: ThemeDecoder.decodeTextOverflow(
map['overflow'],
validate: false,
),
selectionColor: ThemeDecoder.decodeColor(
map['selectionColor'],
validate: false,
),
semanticsLabel: map['semanticsLabel'],
softWrap: map['softWrap'] == null
? null
: JsonClass.parseBool(map['softWrap']),
strutStyle: ThemeDecoder.decodeStrutStyle(
map['strutStyle'],
validate: false,
),
style: ThemeDecoder.decodeTextStyle(
map['style'],
validate: false,
),
text: map['text'].toString(),
textAlign: ThemeDecoder.decodeTextAlign(
map['textAlign'],
validate: false,
),
textDirection: ThemeDecoder.decodeTextDirection(
map['textDirection'],
validate: false,
),
textHeightBehavior: ThemeDecoder.decodeTextHeightBehavior(
map['textHeightBehavior'],
validate: false,
),
textScaleFactor: JsonClass.maybeParseDouble(map['textScaleFactor']),
textWidthBasis: ThemeDecoder.decodeTextWidthBasis(
map['textWidthBasis'],
validate: false,
),
);
}
return result;
}