feat: Display emotes/emojis bigger
This commit is contained in:
parent
d2c883488e
commit
fb101e0796
5 changed files with 17 additions and 8 deletions
|
|
@ -11,13 +11,15 @@ class HtmlMessage extends StatelessWidget {
|
|||
final Room room;
|
||||
final TextStyle defaultTextStyle;
|
||||
final TextStyle linkStyle;
|
||||
final double emoteSize;
|
||||
|
||||
const HtmlMessage(
|
||||
{this.html,
|
||||
this.maxLines,
|
||||
this.room,
|
||||
this.defaultTextStyle,
|
||||
this.linkStyle});
|
||||
this.linkStyle,
|
||||
this.emoteSize});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -35,6 +37,7 @@ class HtmlMessage extends StatelessWidget {
|
|||
return Html(
|
||||
data: renderHtml,
|
||||
defaultTextStyle: defaultTextStyle,
|
||||
emoteSize: emoteSize,
|
||||
linkStyle: linkStyle ??
|
||||
themeData.textTheme.bodyText2.copyWith(
|
||||
color: themeData.accentColor,
|
||||
|
|
|
|||
|
|
@ -49,13 +49,16 @@ class MessageContent extends StatelessWidget {
|
|||
if (event.messageType == MessageTypes.Emote) {
|
||||
html = '* $html';
|
||||
}
|
||||
final bigEmotes = event.onlyEmotes && event.numberEmotes <= 10;
|
||||
final fontSize = DefaultTextStyle.of(context).style.fontSize;
|
||||
return HtmlMessage(
|
||||
html: html,
|
||||
defaultTextStyle: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||
fontSize: bigEmotes ? fontSize * 3 : fontSize,
|
||||
),
|
||||
room: event.room,
|
||||
emoteSize: bigEmotes ? fontSize * 3 : fontSize * 1.5,
|
||||
);
|
||||
}
|
||||
// else we fall through to the normal message rendering
|
||||
|
|
@ -78,11 +81,13 @@ class MessageContent extends StatelessWidget {
|
|||
onPressed: () => launch(event.body),
|
||||
);
|
||||
}
|
||||
final bigEmotes = event.onlyEmotes && event.numberEmotes <= 10;
|
||||
final fontSize = DefaultTextStyle.of(context).style.fontSize;
|
||||
return LinkText(
|
||||
text: event.getLocalizedBody(L10n.of(context), hideReply: true),
|
||||
textStyle: TextStyle(
|
||||
color: textColor,
|
||||
fontSize: DefaultTextStyle.of(context).style.fontSize,
|
||||
fontSize: bigEmotes ? fontSize * 3 : fontSize,
|
||||
decoration: event.redacted ? TextDecoration.lineThrough : null,
|
||||
),
|
||||
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue