added filters to MessageListView
This commit is contained in:
@@ -113,6 +113,7 @@ class _ChannelPageState extends State<ChannelPage> {
|
||||
initialAlignment: widget.initialAlignment,
|
||||
highlightInitialMessage: widget.highlightInitialMessage,
|
||||
onMessageSwiped: _reply,
|
||||
messageFilter: defaultFilter,
|
||||
messageBuilder: (context, details, messages, defaultMessage) {
|
||||
return defaultMessage.copyWith(
|
||||
onReplyTap: _reply,
|
||||
@@ -185,4 +186,12 @@ class _ChannelPageState extends State<ChannelPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool defaultFilter(Message m) {
|
||||
var _currentUser = StreamChat.of(context).currentUser;
|
||||
final isMyMessage = m.user?.id == _currentUser?.id;
|
||||
final isDeletedOrShadowed = m.isDeleted == true || m.shadowed == true;
|
||||
if (isDeletedOrShadowed && !isMyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,9 +268,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
||||
),
|
||||
Container(
|
||||
height: 1.0,
|
||||
color: StreamChatTheme.of(context)
|
||||
.colorTheme
|
||||
.disabled,
|
||||
color: StreamChatTheme.of(context).colorTheme.disabled,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -992,7 +990,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
||||
context,
|
||||
StreamSvgIcon.userRemove(
|
||||
color: StreamChatTheme.of(context)
|
||||
.colorTheme.accentError,
|
||||
.colorTheme
|
||||
.accentError,
|
||||
size: 24.0,
|
||||
),
|
||||
'Remove From Group', () async {
|
||||
@@ -1010,8 +1009,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
||||
}
|
||||
Navigator.pop(context);
|
||||
},
|
||||
color: StreamChatTheme.of(context)
|
||||
.colorTheme.accentError),
|
||||
color:
|
||||
StreamChatTheme.of(context).colorTheme.accentError),
|
||||
_buildModalListTile(
|
||||
context,
|
||||
StreamSvgIcon.closeSmall(
|
||||
|
||||
@@ -49,6 +49,7 @@ class _ThreadPageState extends State<ThreadPage> {
|
||||
initialScrollIndex: widget.initialScrollIndex,
|
||||
initialAlignment: widget.initialAlignment,
|
||||
onMessageSwiped: _reply,
|
||||
messageFilter: defaultFilter,
|
||||
messageBuilder: (context, details, messages, defaultMessage) {
|
||||
return defaultMessage.copyWith(
|
||||
onReplyTap: _reply,
|
||||
@@ -71,4 +72,12 @@ class _ThreadPageState extends State<ThreadPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool defaultFilter(Message m) {
|
||||
var _currentUser = StreamChat.of(context).currentUser;
|
||||
final isMyMessage = m.user?.id == _currentUser?.id;
|
||||
final isDeletedOrShadowed = m.isDeleted == true || m.shadowed == true;
|
||||
if (isDeletedOrShadowed && !isMyMessage) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user