From 240f3bb44e9032a2144b41124d73f0fb4c784857 Mon Sep 17 00:00:00 2001 From: Julian KOUNE Date: Fri, 10 Nov 2023 10:23:50 +0100 Subject: [PATCH] fixup! TW-893: Remove pill on mentionned users --- lib/pages/chat/events/html_message.dart | 4 ++-- lib/pages/chat/input_bar/input_bar.dart | 20 +++++++++++++++---- .../{pill.dart => mentionned_user.dart} | 6 +++--- 3 files changed, 21 insertions(+), 9 deletions(-) rename lib/widgets/{pill.dart => mentionned_user.dart} (89%) diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index 0230596795..059abb9d0f 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -4,7 +4,7 @@ import 'package:fluffychat/pages/chat/chat.dart'; import 'package:fluffychat/pages/image_viewer/image_viewer.dart'; import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart'; import 'package:fluffychat/utils/url_launcher.dart'; -import 'package:fluffychat/widgets/pill.dart'; +import 'package:fluffychat/widgets/mentionned_user.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -174,7 +174,7 @@ class HtmlMessage extends StatelessWidget { if (chatController == null) { return null; } - return TaggedUser( + return MentionnedUser( identifier: identifier, chatController: chatController!, url: url, diff --git a/lib/pages/chat/input_bar/input_bar.dart b/lib/pages/chat/input_bar/input_bar.dart index 848d9a098f..0f5c6c8cfa 100644 --- a/lib/pages/chat/input_bar/input_bar.dart +++ b/lib/pages/chat/input_bar/input_bar.dart @@ -14,6 +14,7 @@ import 'package:fluffychat/widgets/mxc_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart'; +import 'package:linagora_design_flutter/linagora_design_flutter.dart'; import 'package:matrix/matrix.dart'; import 'package:slugify/slugify.dart'; @@ -535,7 +536,7 @@ class SuggestionTile extends StatelessWidget { if (suggestion['type'] == 'user' || suggestion['type'] == 'room') { final url = Uri.parse(suggestion['avatar_url'] ?? ''); return Container( - padding: const EdgeInsetsDirectional.all(4.0), + padding: const EdgeInsetsDirectional.all(8.0), height: InputBarStyle.suggestionSize, child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -548,14 +549,25 @@ class SuggestionTile extends StatelessWidget { fontSize: InputBarStyle.suggestionAvatarFontSize, client: client, ), - const SizedBox(width: 6), - Flexible( + const SizedBox(width: 8), + Expanded( child: Text( suggestion['displayname'] ?? suggestion['mxid']!, maxLines: 1, - overflow: TextOverflow.clip, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.bodyLarge?.copyWith( + color: Theme.of(context).colorScheme.onSurface, + fontSize: 17, + ), ), ), + const Spacer(), + Text( + suggestion['mxid']!, + style: Theme.of(context).textTheme.labelLarge?.copyWith( + color: LinagoraRefColors.material().tertiary[30], + ), + ), ], ), ); diff --git a/lib/widgets/pill.dart b/lib/widgets/mentionned_user.dart similarity index 89% rename from lib/widgets/pill.dart rename to lib/widgets/mentionned_user.dart index 959cb20344..2c68abb62e 100644 --- a/lib/widgets/pill.dart +++ b/lib/widgets/mentionned_user.dart @@ -4,14 +4,14 @@ import 'package:fluffychat/utils/string_extension.dart'; import 'package:flutter/material.dart'; import 'package:flutter_matrix_html/text_parser.dart'; -class TaggedUser extends StatelessWidget { +class MentionnedUser extends StatelessWidget { final String identifier; final String url; final OnPillTap? onTap; final TextStyle? textStyle; final ChatController chatController; - const TaggedUser({ + const MentionnedUser({ Key? key, required this.identifier, required this.chatController, @@ -20,7 +20,7 @@ class TaggedUser extends StatelessWidget { this.onTap, }) : super(key: key); - static const int maxCharactersDisplayNameForPill = 28; + static const int maxCharactersDisplayNameForPill = 12; @override Widget build(BuildContext context) {