Skip to content

Commit

Permalink
chore: Follow up html rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
krille-chan committed Feb 2, 2025
1 parent a9a23c6 commit 979b30e
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lib/pages/chat/events/html_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,10 @@ class HtmlMessage extends StatelessWidget {
if (node is! dom.Element) {
// Inside of a list so we add some prefix text:
var text = node.text ?? '';
if (text == '\n') text = '';
if (node.parent?.localName == 'li') {
if (node.parent?.parent?.localName == 'ul') {
text = ' $text';
text = ' $text';
}
if (node.parent?.parent?.localName == 'ol') {
text =
Expand Down Expand Up @@ -172,7 +173,7 @@ class HtmlMessage extends StatelessWidget {
uri: href,
outerContext: context,
fontSize: fontSize,
color: textColor,
color: linkStyle.color,
),
);
}
Expand All @@ -187,7 +188,7 @@ class HtmlMessage extends StatelessWidget {
uri: href,
outerContext: context,
fontSize: fontSize,
color: textColor,
color: linkStyle.color,
),
);
}
Expand Down Expand Up @@ -410,16 +411,18 @@ class HtmlMessage extends StatelessWidget {
}

@override
Widget build(BuildContext context) => Text.rich(
_renderHtml(
parser.parse(html).body ?? dom.Element.html(''),
context,
),
style: TextStyle(
fontSize: fontSize,
color: textColor,
),
);
Widget build(BuildContext context) {
return Text.rich(
_renderHtml(
parser.parse(html).body ?? dom.Element.html(''),
context,
),
style: TextStyle(
fontSize: fontSize,
color: textColor,
),
);
}
}

class MatrixPill extends StatelessWidget {
Expand Down

0 comments on commit 979b30e

Please sign in to comment.