1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-26 14:59:22 +00:00

Disable pre-rendering

This commit is contained in:
Pierre HUBERT 2020-05-08 09:14:25 +02:00
parent c7f970ae70
commit edff7868f2

View File

@ -13,18 +13,15 @@ import 'package:url_launcher/url_launcher.dart';
/// @author Pierre HUBERT /// @author Pierre HUBERT
class TextRichContentWidget extends StatelessWidget { class TextRichContentWidget extends StatelessWidget {
final TextSpan rootSpan;
final TextAlign textAlign; final TextAlign textAlign;
final TextStyle style; final TextStyle style;
final String text;
TextRichContentWidget( TextRichContentWidget(
String text, { this.text, {
this.textAlign, this.textAlign,
this.style, this.style,
}) : assert(text != null), }) : assert(text != null);
/// Parse content now so we won't have to do it later
rootSpan = TextSpan(style: style, children: _parse(text, style));
/// Parse the text and return it as a list of span elements /// Parse the text and return it as a list of span elements
static List<TextSpan> _parse(String text, TextStyle style) { static List<TextSpan> _parse(String text, TextStyle style) {
@ -67,6 +64,7 @@ class TextRichContentWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return RichText(textAlign: textAlign, text: rootSpan); return RichText(
textAlign: textAlign, text: TextSpan(children: _parse(text, style)));
} }
} }