Hopefully fix font size & link colour
This commit is contained in:
parent
cacc0c4854
commit
6184c60d80
|
@ -7,19 +7,25 @@ import 'matrix.dart';
|
||||||
|
|
||||||
class HtmlMessage extends StatelessWidget {
|
class HtmlMessage extends StatelessWidget {
|
||||||
final String html;
|
final String html;
|
||||||
final Color textColor;
|
|
||||||
final int maxLines;
|
final int maxLines;
|
||||||
final Room room;
|
final Room room;
|
||||||
|
final TextStyle defaultTextStyle;
|
||||||
|
final TextStyle linkStyle;
|
||||||
|
|
||||||
const HtmlMessage({this.html, this.textColor, this.maxLines, this.room});
|
const HtmlMessage({this.html, this.maxLines, this.room, this.defaultTextStyle, this.linkStyle});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// there is no need to pre-validate the html, as we validate it while rendering
|
// there is no need to pre-validate the html, as we validate it while rendering
|
||||||
|
|
||||||
|
final themeData = Theme.of(context);
|
||||||
return Html(
|
return Html(
|
||||||
data: html,
|
data: html,
|
||||||
defaultTextStyle: TextStyle(color: textColor),
|
defaultTextStyle: defaultTextStyle,
|
||||||
|
linkStyle: linkStyle ?? themeData.textTheme.bodyText2.copyWith(
|
||||||
|
color: themeData.accentColor,
|
||||||
|
decoration: TextDecoration.underline,
|
||||||
|
),
|
||||||
shrinkToFit: true,
|
shrinkToFit: true,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
onLinkTap: (String url) {
|
onLinkTap: (String url) {
|
||||||
|
|
|
@ -51,7 +51,10 @@ class MessageContent extends StatelessWidget {
|
||||||
}
|
}
|
||||||
return HtmlMessage(
|
return HtmlMessage(
|
||||||
html: html,
|
html: html,
|
||||||
textColor: textColor,
|
defaultTextStyle: TextStyle(
|
||||||
|
color: textColor,
|
||||||
|
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||||
|
),
|
||||||
room: event.room,
|
room: event.room,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -79,6 +82,7 @@ class MessageContent extends StatelessWidget {
|
||||||
text: event.getLocalizedBody(L10n.of(context), hideReply: true),
|
text: event.getLocalizedBody(L10n.of(context), hideReply: true),
|
||||||
textStyle: TextStyle(
|
textStyle: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
|
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||||
decoration: event.redacted ? TextDecoration.lineThrough : null,
|
decoration: event.redacted ? TextDecoration.lineThrough : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,9 +29,12 @@ class ReplyContent extends StatelessWidget {
|
||||||
}
|
}
|
||||||
replyBody = HtmlMessage(
|
replyBody = HtmlMessage(
|
||||||
html: html,
|
html: html,
|
||||||
textColor: lightText
|
defaultTextStyle: TextStyle(
|
||||||
|
color: lightText
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: Theme.of(context).textTheme.bodyText2.color,
|
: Theme.of(context).textTheme.bodyText2.color,
|
||||||
|
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||||
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
room: replyEvent.room,
|
room: replyEvent.room,
|
||||||
);
|
);
|
||||||
|
@ -48,7 +51,9 @@ class ReplyContent extends StatelessWidget {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: lightText
|
color: lightText
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: Theme.of(context).textTheme.bodyText2.color),
|
: Theme.of(context).textTheme.bodyText2.color,
|
||||||
|
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Row(
|
return Row(
|
||||||
|
|
Loading…
Reference in a new issue