chore: minor ui fixes.

Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
Sahil Kumar
2023-07-29 00:12:09 +05:30
committed by xsahil03x
parent ff3ad6b16d
commit 795c49480b
2 changed files with 14 additions and 14 deletions
@@ -1,6 +1,6 @@
part of 'attachment_widget_builder.dart'; part of 'attachment_widget_builder.dart';
const _kDefaultUrlAttachmentConstraints = BoxConstraints(maxWidth: 290); const _kDefaultUrlAttachmentConstraints = BoxConstraints(maxWidth: 256);
/// {@template urlAttachmentBuilder} /// {@template urlAttachmentBuilder}
/// A widget builder for url attachment type. /// A widget builder for url attachment type.
@@ -30,25 +30,23 @@ class UrlAttachmentBuilder extends StreamAttachmentWidgetBuilder {
final StreamAttachmentWidgetTapCallback? onAttachmentTap; final StreamAttachmentWidgetTapCallback? onAttachmentTap;
@override @override
bool canHandle( bool canHandle(Message message,
Message message, Map<String, List<Attachment>> attachments,) {
Map<String, List<Attachment>> attachments,
) {
final urls = attachments[AttachmentType.urlPreview]; final urls = attachments[AttachmentType.urlPreview];
return urls != null && urls.isNotEmpty; return urls != null && urls.isNotEmpty;
} }
@override @override
Widget build( Widget build(BuildContext context,
BuildContext context, Message message,
Message message, Map<String, List<Attachment>> attachments,) {
Map<String, List<Attachment>> attachments,
) {
assert(debugAssertCanHandle(message, attachments), ''); assert(debugAssertCanHandle(message, attachments), '');
final urlPreviews = attachments[AttachmentType.urlPreview]!; final urlPreviews = attachments[AttachmentType.urlPreview]!;
final client = StreamChat.of(context).client; final client = StreamChat
.of(context)
.client;
final isMyMessage = message.user?.id == client.state.currentUser?.id; final isMyMessage = message.user?.id == client.state.currentUser?.id;
final streamChatTheme = StreamChatTheme.of(context); final streamChatTheme = StreamChatTheme.of(context);
@@ -62,7 +60,9 @@ class UrlAttachmentBuilder extends StreamAttachmentWidgetBuilder {
onTap = () => onAttachmentTap!(message, urlPreview); onTap = () => onAttachmentTap!(message, urlPreview);
} }
final host = Uri.parse(urlPreview.titleLink!).host; final host = Uri
.parse(urlPreview.titleLink!)
.host;
final splitList = host.split('.'); final splitList = host.split('.');
final hostName = splitList.length == 3 ? splitList[1] : splitList[0]; final hostName = splitList.length == 3 ? splitList[1] : splitList[0];
final hostDisplayName = urlPreview.authorName?.capitalize() ?? final hostDisplayName = urlPreview.authorName?.capitalize() ??
@@ -201,8 +201,8 @@ class BottomRow extends StatelessWidget {
), ),
]; ];
final showThreadTail = !(hasUrlAttachments || isGiphy || isOnlyEmoji) && final showThreadTail =
(showThreadReplyIndicator || showInChannel); (showThreadReplyIndicator || showInChannel) && !isOnlyEmoji;
final threadIndicatorWidgets = [ final threadIndicatorWidgets = [
if (showThreadTail) if (showThreadTail)