Merge branch 'soru/fix-html-render' into 'master'
Hopefully fix font size & link colour See merge request ChristianPauly/fluffychat-flutter!56
This commit is contained in:
commit
fb47b030c0
|
@ -7,19 +7,25 @@ import 'matrix.dart';
|
|||
|
||||
class HtmlMessage extends StatelessWidget {
|
||||
final String html;
|
||||
final Color textColor;
|
||||
final int maxLines;
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
// there is no need to pre-validate the html, as we validate it while rendering
|
||||
|
||||
final themeData = Theme.of(context);
|
||||
return Html(
|
||||
data: html,
|
||||
defaultTextStyle: TextStyle(color: textColor),
|
||||
defaultTextStyle: defaultTextStyle,
|
||||
linkStyle: linkStyle ?? themeData.textTheme.bodyText2.copyWith(
|
||||
color: themeData.accentColor,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
shrinkToFit: true,
|
||||
maxLines: maxLines,
|
||||
onLinkTap: (String url) {
|
||||
|
|
|
@ -51,7 +51,10 @@ class MessageContent extends StatelessWidget {
|
|||
}
|
||||
return HtmlMessage(
|
||||
html: html,
|
||||
textColor: textColor,
|
||||
defaultTextStyle: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||
),
|
||||
room: event.room,
|
||||
);
|
||||
}
|
||||
|
@ -79,6 +82,7 @@ class MessageContent extends StatelessWidget {
|
|||
text: event.getLocalizedBody(L10n.of(context), hideReply: true),
|
||||
textStyle: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||
decoration: event.redacted ? TextDecoration.lineThrough : null,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -29,9 +29,12 @@ class ReplyContent extends StatelessWidget {
|
|||
}
|
||||
replyBody = HtmlMessage(
|
||||
html: html,
|
||||
textColor: lightText
|
||||
defaultTextStyle: TextStyle(
|
||||
color: lightText
|
||||
? Colors.white
|
||||
: Theme.of(context).textTheme.bodyText2.color,
|
||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||
),
|
||||
maxLines: 1,
|
||||
room: replyEvent.room,
|
||||
);
|
||||
|
@ -46,9 +49,11 @@ class ReplyContent extends StatelessWidget {
|
|||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
color: lightText
|
||||
? Colors.white
|
||||
: Theme.of(context).textTheme.bodyText2.color),
|
||||
color: lightText
|
||||
? Colors.white
|
||||
: Theme.of(context).textTheme.bodyText2.color,
|
||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Row(
|
||||
|
|
Loading…
Reference in a new issue