Added onUserAvatarTap

This commit is contained in:
Luis Pulido
2020-04-23 11:41:07 -04:00
parent 1542675c8c
commit 061962ea8b
2 changed files with 20 additions and 1 deletions
+8
View File
@@ -65,6 +65,7 @@ class MessageListView extends StatefulWidget {
this.showOtherMessageUsername = false,
this.showVideoFullScreen = true,
this.onMentionTap,
this.onUserAvatarTap,
this.onMessageActions,
}) : super(key: key);
@@ -93,6 +94,9 @@ class MessageListView extends StatefulWidget {
/// Function called on message mention tap
final void Function(User) onMentionTap;
/// Function called on User Avatar tap
final void Function(User) onUserAvatarTap;
/// Function called on message long press
final Function(BuildContext, Message) onMessageActions;
@@ -154,6 +158,7 @@ class _MessageListViewState extends State<MessageListView> {
showOtherMessageUsername:
widget.showOtherMessageUsername,
onMentionTap: widget.onMentionTap,
onUserAvatarTap: widget.onUserAvatarTap,
onMessageActions: widget.onMessageActions,
),
Padding(
@@ -216,6 +221,7 @@ class _MessageListViewState extends State<MessageListView> {
showOtherMessageUsername: widget.showOtherMessageUsername,
showVideoFullScreen: widget.showVideoFullScreen,
onMentionTap: widget.onMentionTap,
onUserAvatarTap: widget.onUserAvatarTap,
onMessageActions: widget.onMessageActions,
);
}
@@ -363,6 +369,7 @@ class _MessageListViewState extends State<MessageListView> {
showVideoFullScreen: widget.showVideoFullScreen,
showOtherMessageUsername: widget.showOtherMessageUsername,
onMentionTap: widget.onMentionTap,
onUserAvatarTap: widget.onUserAvatarTap,
onMessageActions: widget.onMessageActions,
);
}
@@ -402,6 +409,7 @@ class _MessageListViewState extends State<MessageListView> {
showVideoFullScreen: widget.showVideoFullScreen,
showOtherMessageUsername: widget.showOtherMessageUsername,
onMentionTap: widget.onMentionTap,
onUserAvatarTap: widget.onUserAvatarTap,
onMessageActions: widget.onMessageActions,
);
}
+12 -1
View File
@@ -35,6 +35,7 @@ class MessageWidget extends StatefulWidget {
@required this.message,
@required this.nextMessage,
this.onThreadTap,
this.onUserAvatarTap,
this.onMessageActions,
this.isParent = false,
this.onMentionTap,
@@ -63,6 +64,9 @@ class MessageWidget extends StatefulWidget {
/// The function called when tapping on replies
final void Function(Message) onThreadTap;
/// The function called when tapping on UserAvatar
final void Function(User) onUserAvatarTap;
/// True if this is the parent of the thread being showed
final bool isParent;
@@ -151,7 +155,14 @@ class _MessageWidgetState extends State<MessageWidget>
),
child: Row(
children: <Widget>[
UserAvatar(user: widget.message.user),
GestureDetector(
onTap: () {
if (widget.onUserAvatarTap != null) {
widget.onUserAvatarTap(widget.message.user);
}
},
child: UserAvatar(user: widget.message.user),
),
if (_isMyMessage &&
widget.nextMessage == null &&
(widget.message.status == MessageSendingStatus.SENT ||