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 ### Features
- Implemented ignore list - Implemented ignore list
- Jump to events in timeline: When tapping on a reply and when tapping a matrix.to link - 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 ### Fixes
- Timeline randomly resorting while more history is being fetched - Timeline randomly resorting while more history is being fetched
- Automatically request history if the "load more" button is on the screen - 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 Room room;
final TextStyle defaultTextStyle; final TextStyle defaultTextStyle;
final TextStyle linkStyle; final TextStyle linkStyle;
final double emoteSize;
const HtmlMessage( const HtmlMessage(
{this.html, {this.html,
this.maxLines, this.maxLines,
this.room, this.room,
this.defaultTextStyle, this.defaultTextStyle,
this.linkStyle}); this.linkStyle,
this.emoteSize});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,6 +37,7 @@ class HtmlMessage extends StatelessWidget {
return Html( return Html(
data: renderHtml, data: renderHtml,
defaultTextStyle: defaultTextStyle, defaultTextStyle: defaultTextStyle,
emoteSize: emoteSize,
linkStyle: linkStyle ?? linkStyle: linkStyle ??
themeData.textTheme.bodyText2.copyWith( themeData.textTheme.bodyText2.copyWith(
color: themeData.accentColor, color: themeData.accentColor,

View File

@ -49,13 +49,16 @@ class MessageContent extends StatelessWidget {
if (event.messageType == MessageTypes.Emote) { if (event.messageType == MessageTypes.Emote) {
html = '* $html'; html = '* $html';
} }
final bigEmotes = event.onlyEmotes && event.numberEmotes <= 10;
final fontSize = DefaultTextStyle.of(context).style.fontSize;
return HtmlMessage( return HtmlMessage(
html: html, html: html,
defaultTextStyle: TextStyle( defaultTextStyle: TextStyle(
color: textColor, color: textColor,
fontSize: DefaultTextStyle.of(context).style.fontSize, fontSize: bigEmotes ? fontSize * 3 : fontSize,
), ),
room: event.room, room: event.room,
emoteSize: bigEmotes ? fontSize * 3 : fontSize * 1.5,
); );
} }
// else we fall through to the normal message rendering // else we fall through to the normal message rendering
@ -78,11 +81,13 @@ class MessageContent extends StatelessWidget {
onPressed: () => launch(event.body), onPressed: () => launch(event.body),
); );
} }
final bigEmotes = event.onlyEmotes && event.numberEmotes <= 10;
final fontSize = DefaultTextStyle.of(context).style.fontSize;
return LinkText( return LinkText(
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, fontSize: bigEmotes ? fontSize * 3 : fontSize,
decoration: event.redacted ? TextDecoration.lineThrough : null, decoration: event.redacted ? TextDecoration.lineThrough : null,
), ),
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(), onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),

View File

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

View File

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