Skip to content

Commit

Permalink
fixup! TW-893: Remove pill on mentionned users
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian KOUNE committed Nov 10, 2023
1 parent fd9a0c4 commit 240f3bb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/pages/chat/events/html_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -174,7 +174,7 @@ class HtmlMessage extends StatelessWidget {
if (chatController == null) {
return null;
}
return TaggedUser(
return MentionnedUser(
identifier: identifier,
chatController: chatController!,
url: url,
Expand Down
20 changes: 16 additions & 4 deletions lib/pages/chat/input_bar/input_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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,
Expand All @@ -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],
),
),
],
),
);
Expand Down
6 changes: 3 additions & 3 deletions lib/widgets/pill.dart → lib/widgets/mentionned_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) {
Expand Down

0 comments on commit 240f3bb

Please sign in to comment.