Merge branch 'fix-linktext' into 'master'

Fix linktext

See merge request ChristianPauly/fluffychat-flutter!12
This commit is contained in:
Christian Pauly 2020-01-06 19:39:05 +00:00
commit f99fe9eda8
2 changed files with 34 additions and 11 deletions

View File

@ -3,6 +3,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:famedlysdk/famedlysdk.dart'; import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:link_text/link_text.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'matrix.dart'; import 'matrix.dart';
@ -113,21 +114,43 @@ class MessageContent extends StatelessWidget {
? "You: " ? "You: "
: "${event.sender.calcDisplayname()}: " : "${event.sender.calcDisplayname()}: "
: ""; : "";
return Text( if (textOnly) {
senderPrefix + event.getBody(), return Text(
maxLines: maxLines, senderPrefix + event.getBody(),
overflow: textOnly ? TextOverflow.ellipsis : null, maxLines: maxLines,
style: TextStyle( overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
decoration:
event.redacted ? TextDecoration.lineThrough : null,
),
);
}
return LinkText(
text: senderPrefix + event.getBody(),
textStyle: TextStyle(
color: textColor, color: textColor,
decoration: event.redacted ? TextDecoration.lineThrough : null, decoration: event.redacted ? TextDecoration.lineThrough : null,
), ),
); );
case MessageTypes.Emote: case MessageTypes.Emote:
return Text( if (textOnly) {
"* " + event.getBody(), return Text(
maxLines: maxLines, "* " + event.getBody(),
overflow: textOnly ? TextOverflow.ellipsis : null, maxLines: maxLines,
style: TextStyle( overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
fontStyle: FontStyle.italic,
decoration:
event.redacted ? TextDecoration.lineThrough : null,
),
);
}
return LinkText(
text: "* " + event.getBody(),
textStyle: TextStyle(
color: textColor, color: textColor,
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
decoration: event.redacted ? TextDecoration.lineThrough : null, decoration: event.redacted ? TextDecoration.lineThrough : null,

View File

@ -11,7 +11,7 @@ description: Chat with your friends.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.2.0+10 version: 0.2.1+11
environment: environment:
sdk: ">=2.1.0 <3.0.0" sdk: ">=2.1.0 <3.0.0"