export method
export the runtime widget to json
Implementation
@override
Map<String, dynamic> export(Widget? widget, BuildContext? buildContext) {
var realWidget = widget as Text;
if (realWidget.textSpan == null) {
return <String, dynamic>{
"type": "Text",
"data": realWidget.data,
"textAlign": realWidget.textAlign != null
? exportTextAlign(realWidget.textAlign)
: "start",
"overflow": exportTextOverflow(realWidget.overflow),
"maxLines": realWidget.maxLines,
"semanticsLabel": realWidget.semanticsLabel,
"softWrap": realWidget.softWrap,
"textDirection": exportTextDirection(realWidget.textDirection),
"style": exportTextStyle(realWidget.style),
"textScaleFactor": realWidget.textScaleFactor
};
} else {
var parser = TextSpanParser();
return <String, dynamic>{
"type": "Text",
"textSpan": parser.export(realWidget.textSpan as TextSpan),
"textAlign": realWidget.textAlign != null
? exportTextAlign(realWidget.textAlign)
: "start",
"overflow": exportTextOverflow(realWidget.overflow),
"maxLines": realWidget.maxLines,
"semanticsLabel": realWidget.semanticsLabel,
"softWrap": realWidget.softWrap,
"textDirection": exportTextDirection(realWidget.textDirection),
"style": exportTextStyle(realWidget.style),
"textScaleFactor": realWidget.textScaleFactor
};
}
}