parse method
Widget
parse(
- Map<
String, dynamic> map, - BuildContext buildContext,
- ClickListener? listener
override
parse the json map into a flutter widget.
Implementation
@override
Widget parse(Map<String, dynamic> map, BuildContext buildContext,
ClickListener? listener) {
String? data = map['data'];
String? textAlignString = map['textAlign'];
int? maxLines = map['maxLines'];
String? textDirectionString = map['textDirection'];
// double textScaleFactor = map['textScaleFactor'];
var textSpan;
var textSpanParser = SelectableTextSpanParser();
if (map.containsKey("textSpan")) {
textSpan = textSpanParser.parse(map['textSpan'], listener);
}
if (textSpan == null) {
return SelectableText(
data!,
textAlign: parseTextAlign(textAlignString),
maxLines: maxLines,
textDirection: parseTextDirection(textDirectionString),
style: map.containsKey('style') ? parseTextStyle(map['style']) : null,
// textScaleFactor: textScaleFactor,
);
} else {
return SelectableText.rich(
textSpan,
textAlign: parseTextAlign(textAlignString),
maxLines: maxLines,
textDirection: parseTextDirection(textDirectionString),
style: map.containsKey('style') ? parseTextStyle(map['style']) : null,
// textScaleFactor: textScaleFactor,
);
}
}