make username next to timestamp opt-in
This commit is contained in:
@@ -61,6 +61,7 @@ class MessageListView extends StatefulWidget {
|
|||||||
this.parentMessage,
|
this.parentMessage,
|
||||||
this.threadBuilder,
|
this.threadBuilder,
|
||||||
this.onThreadTap,
|
this.onThreadTap,
|
||||||
|
this.showOtherMessageUsername = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// Function used to build a custom message widget
|
/// Function used to build a custom message widget
|
||||||
@@ -79,6 +80,9 @@ class MessageListView extends StatefulWidget {
|
|||||||
/// Parent message in case of a thread
|
/// Parent message in case of a thread
|
||||||
final Message parentMessage;
|
final Message parentMessage;
|
||||||
|
|
||||||
|
/// If true show the other users username next to the timestamp of the message
|
||||||
|
final bool showOtherMessageUsername;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_MessageListViewState createState() => _MessageListViewState();
|
_MessageListViewState createState() => _MessageListViewState();
|
||||||
}
|
}
|
||||||
@@ -193,6 +197,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
message: message,
|
message: message,
|
||||||
nextMessage: nextMessage,
|
nextMessage: nextMessage,
|
||||||
onThreadTap: _onThreadTap,
|
onThreadTap: _onThreadTap,
|
||||||
|
showOtherMessageUsername: widget.showOtherMessageUsername,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
childCount: _messages.length + 2,
|
childCount: _messages.length + 2,
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class MessageWidget extends StatefulWidget {
|
|||||||
this.onMessageActions,
|
this.onMessageActions,
|
||||||
this.isParent = false,
|
this.isParent = false,
|
||||||
this.onMentionTap,
|
this.onMentionTap,
|
||||||
|
this.showOtherMessageUsername = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// Function called on mention tap
|
/// Function called on mention tap
|
||||||
@@ -46,6 +47,9 @@ class MessageWidget extends StatefulWidget {
|
|||||||
/// Function called on long press
|
/// Function called on long press
|
||||||
final Function(BuildContext, Message) onMessageActions;
|
final Function(BuildContext, Message) onMessageActions;
|
||||||
|
|
||||||
|
/// If true show the other users username next to the timestamp of the message
|
||||||
|
final bool showOtherMessageUsername;
|
||||||
|
|
||||||
/// This message
|
/// This message
|
||||||
final Message message;
|
final Message message;
|
||||||
|
|
||||||
@@ -984,7 +988,7 @@ class _MessageWidgetState extends State<MessageWidget>
|
|||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: _messageTheme.createdAt,
|
style: _messageTheme.createdAt,
|
||||||
children: <TextSpan>[
|
children: <TextSpan>[
|
||||||
if (!_isMyMessage)
|
if (!_isMyMessage && widget.showOtherMessageUsername)
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: widget.message.user.name,
|
text: widget.message.user.name,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
style: TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
|||||||
Reference in New Issue
Block a user