refactor(ui): deprecate MentionTileBuilder.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -56,13 +56,25 @@ typedef AttachmentThumbnailBuilder = Widget Function(
|
|||||||
Attachment,
|
Attachment,
|
||||||
);
|
);
|
||||||
|
|
||||||
/// Builder function for building a mention tile
|
/// Builder function for building a mention tile.
|
||||||
/// Use [MentionTile] for the default implementation
|
///
|
||||||
|
/// Use [MentionTile] for the default implementation.
|
||||||
|
@Deprecated(
|
||||||
|
'Use `UserMentionTileBuilder` instead. Will be removed in future release',
|
||||||
|
)
|
||||||
typedef MentionTileBuilder = Widget Function(
|
typedef MentionTileBuilder = Widget Function(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
Member member,
|
Member member,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// Builder function for building a user mention tile.
|
||||||
|
///
|
||||||
|
/// Use [UserMentionTile] for the default implementation.
|
||||||
|
typedef UserMentionTileBuilder = Widget Function(
|
||||||
|
BuildContext context,
|
||||||
|
User user,
|
||||||
|
);
|
||||||
|
|
||||||
/// Widget builder for action button.
|
/// Widget builder for action button.
|
||||||
///
|
///
|
||||||
/// [defaultActionButton] is the default [IconButton] configuration,
|
/// [defaultActionButton] is the default [IconButton] configuration,
|
||||||
@@ -184,7 +196,9 @@ class MessageInput extends StatefulWidget {
|
|||||||
this.idleSendButton,
|
this.idleSendButton,
|
||||||
this.activeSendButton,
|
this.activeSendButton,
|
||||||
this.showCommandsButton = true,
|
this.showCommandsButton = true,
|
||||||
this.mentionsTileBuilder,
|
@Deprecated('''Use `userMentionsTileBuilder` instead. Will be removed in future release''')
|
||||||
|
this.mentionsTileBuilder,
|
||||||
|
this.userMentionsTileBuilder,
|
||||||
this.maxAttachmentSize = _kDefaultMaxAttachmentSize,
|
this.maxAttachmentSize = _kDefaultMaxAttachmentSize,
|
||||||
this.compressedVideoQuality = VideoQuality.DefaultQuality,
|
this.compressedVideoQuality = VideoQuality.DefaultQuality,
|
||||||
this.compressedVideoFrameRate = 30,
|
this.compressedVideoFrameRate = 30,
|
||||||
@@ -279,9 +293,12 @@ class MessageInput extends StatefulWidget {
|
|||||||
/// Send button widget in an active state
|
/// Send button widget in an active state
|
||||||
final Widget? activeSendButton;
|
final Widget? activeSendButton;
|
||||||
|
|
||||||
/// Customize the tile for the mentions overlay
|
/// Customize the tile for the mentions overlay.
|
||||||
final MentionTileBuilder? mentionsTileBuilder;
|
final MentionTileBuilder? mentionsTileBuilder;
|
||||||
|
|
||||||
|
/// Customize the tile for the mentions overlay.
|
||||||
|
final UserMentionTileBuilder? userMentionsTileBuilder;
|
||||||
|
|
||||||
/// A callback for error reporting
|
/// A callback for error reporting
|
||||||
final ErrorListener? onError;
|
final ErrorListener? onError;
|
||||||
|
|
||||||
@@ -1153,12 +1170,26 @@ class MessageInputState extends State<MessageInput> {
|
|||||||
// ignore: cast_nullable_to_non_nullable
|
// ignore: cast_nullable_to_non_nullable
|
||||||
final renderObject = context.findRenderObject() as RenderBox;
|
final renderObject = context.findRenderObject() as RenderBox;
|
||||||
|
|
||||||
|
var tileBuilder = widget.userMentionsTileBuilder;
|
||||||
|
if (tileBuilder == null && widget.mentionsTileBuilder != null) {
|
||||||
|
tileBuilder = (context, user) {
|
||||||
|
final member = Member(
|
||||||
|
user: user,
|
||||||
|
userId: user.id,
|
||||||
|
createdAt: user.createdAt,
|
||||||
|
updatedAt: user.updatedAt,
|
||||||
|
);
|
||||||
|
return widget.mentionsTileBuilder!.call(context, member);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return UserMentionsOverlay(
|
return UserMentionsOverlay(
|
||||||
query: query,
|
query: query,
|
||||||
mentionAllAppUsers: widget.mentionAllAppUsers,
|
mentionAllAppUsers: widget.mentionAllAppUsers,
|
||||||
client: StreamChat.of(context).client,
|
client: StreamChat.of(context).client,
|
||||||
channel: StreamChannel.of(context).channel,
|
channel: StreamChannel.of(context).channel,
|
||||||
size: Size(renderObject.size.width - 16, 400),
|
size: Size(renderObject.size.width - 16, 400),
|
||||||
|
mentionsTileBuilder: tileBuilder,
|
||||||
onMentionUserTap: (user) {
|
onMentionUserTap: (user) {
|
||||||
_mentionedUsers.add(user);
|
_mentionedUsers.add(user);
|
||||||
splits[splits.length - 1] = user.name;
|
splits[splits.length - 1] = user.name;
|
||||||
|
|||||||
Reference in New Issue
Block a user