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>,
"semanticsLabel": <String>,
"softWrap": <bool>,
"strutStyle": <StrutStyle>,
"style": <TextStyle>,
"text": <String>,
"textAlign": <TextAlign>,
"textDirection": <TextDirection>,
"textHeightBehavior": <TextHeightBehavior>,
"textScaleFactor": <double>,
"textWidthBasis": <TextWidthBasis>,
}
See also:
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.parseInt(map['maxLines']),
overflow: ThemeDecoder.decodeTextOverflow(
map['overflow'],
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.parseDouble(map['textScaleFactor']),
textWidthBasis: ThemeDecoder.decodeTextWidthBasis(
map['textWidthBasis'],
validate: false,
),
);
}
return result;
}