feat: Display emotes/emojis bigger

This commit is contained in:
Sorunome 2020-09-20 11:35:28 +02:00
parent 168b8b076f
commit 9cccd07643
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
5 changed files with 17 additions and 8 deletions

View File

@ -2,6 +2,7 @@
### Features
- Implemented ignore list
- Jump to events in timeline: When tapping on a reply and when tapping a matrix.to link
- Display messages with up to 10 emotes or emoji bigger
### Fixes
- Timeline randomly resorting while more history is being fetched
- Automatically request history if the "load more" button is on the screen

View File

@ -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,

View File

@ -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(),

View File

@ -180,8 +180,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "864cbfa9068f5bb285336ca73ab2551204e62044"
resolved-ref: "864cbfa9068f5bb285336ca73ab2551204e62044"
ref: ba7a01ddea430a6eec2661e2f9b7714d3719c652
resolved-ref: ba7a01ddea430a6eec2661e2f9b7714d3719c652
url: "https://gitlab.com/famedly/famedlysdk.git"
source: git
version: "0.0.1"
@ -306,7 +306,7 @@ packages:
name: flutter_matrix_html
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
flutter_olm:
dependency: "direct main"
description:

View File

@ -27,7 +27,7 @@ dependencies:
famedlysdk:
git:
url: https://gitlab.com/famedly/famedlysdk.git
ref: 864cbfa9068f5bb285336ca73ab2551204e62044
ref: ba7a01ddea430a6eec2661e2f9b7714d3719c652
localstorage: ^3.0.1+4
memoryfilepicker: ^0.1.3
@ -50,7 +50,7 @@ dependencies:
open_file: ^3.0.1
mime_type: ^0.3.0
bot_toast: ^3.0.0
flutter_matrix_html: ^0.1.4
flutter_matrix_html: ^0.1.5
moor: ^3.3.1
sqlite3: ^0.1.4
random_string: ^2.0.1