make username next to timestamp opt-in

This commit is contained in:
Salvatore Giordano
2020-04-08 09:48:29 +02:00
parent 946a99cab7
commit ff68d8f9b1
2 changed files with 10 additions and 1 deletions
+5
View File
@@ -61,6 +61,7 @@ class MessageListView extends StatefulWidget {
this.parentMessage,
this.threadBuilder,
this.onThreadTap,
this.showOtherMessageUsername = false,
}) : super(key: key);
/// Function used to build a custom message widget
@@ -79,6 +80,9 @@ class MessageListView extends StatefulWidget {
/// Parent message in case of a thread
final Message parentMessage;
/// If true show the other users username next to the timestamp of the message
final bool showOtherMessageUsername;
@override
_MessageListViewState createState() => _MessageListViewState();
}
@@ -193,6 +197,7 @@ class _MessageListViewState extends State<MessageListView> {
message: message,
nextMessage: nextMessage,
onThreadTap: _onThreadTap,
showOtherMessageUsername: widget.showOtherMessageUsername,
);
},
childCount: _messages.length + 2,
+5 -1
View File
@@ -38,6 +38,7 @@ class MessageWidget extends StatefulWidget {
this.onMessageActions,
this.isParent = false,
this.onMentionTap,
this.showOtherMessageUsername = false,
}) : super(key: key);
/// Function called on mention tap
@@ -46,6 +47,9 @@ class MessageWidget extends StatefulWidget {
/// Function called on long press
final Function(BuildContext, Message) onMessageActions;
/// If true show the other users username next to the timestamp of the message
final bool showOtherMessageUsername;
/// This message
final Message message;
@@ -984,7 +988,7 @@ class _MessageWidgetState extends State<MessageWidget>
text: TextSpan(
style: _messageTheme.createdAt,
children: <TextSpan>[
if (!_isMyMessage)
if (!_isMyMessage && widget.showOtherMessageUsername)
TextSpan(
text: widget.message.user.name,
style: TextStyle(fontWeight: FontWeight.bold),