1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Use DisplayString for messages

This commit is contained in:
2020-04-16 15:10:47 +02:00
parent 32c491ae84
commit 0ec0f216e2
5 changed files with 22 additions and 15 deletions

View File

@ -15,11 +15,13 @@ class TextWidget extends StatelessWidget {
final DisplayedString content;
final bool parseBBcode;
final TextStyle style;
final TextAlign textAlign;
const TextWidget({
Key key,
@required this.content,
this.parseBBcode = false,
this.textAlign = TextAlign.start,
this.style,
}) : assert(content != null),
assert(parseBBcode != null),
@ -40,6 +42,7 @@ class TextWidget extends StatelessWidget {
// Just parse link
return RichText(
textAlign: textAlign,
text: TextSpan(children: _parseLinks(context, content, style)),
);
}
@ -74,7 +77,7 @@ class TextWidget extends StatelessWidget {
child: InkWell(
child: Text(
word,
style: style.copyWith(color: Colors.blueAccent),
style: style.copyWith(color: Colors.indigo),
),
onTap: () => launch(word),
),
@ -93,7 +96,7 @@ class TextWidget extends StatelessWidget {
child: InkWell(
child: Text(
word,
style: style.copyWith(color: Colors.blueAccent),
style: style.copyWith(color: Colors.indigo),
),
onTap: () => openVirtualDirectory(context, word),
),
@ -110,7 +113,8 @@ class TextWidget extends StatelessWidget {
}
}
if (buff.isNotEmpty) changeWordType();
if (buff.isNotEmpty && (buff.length > 1 || buff.toString() != " "))
changeWordType();
return list;
}