add channel muted ui
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
|
import 'package:line_awesome_icons/line_awesome_icons.dart';
|
||||||
import 'package:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
import 'package:stream_chat_flutter/src/unread_indicator.dart';
|
import 'package:stream_chat_flutter/src/unread_indicator.dart';
|
||||||
|
|
||||||
@@ -42,7 +43,9 @@ class ChannelPreview extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
return Opacity(
|
||||||
|
opacity: channel.isMuted ? 0.5 : 1,
|
||||||
|
child: ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (onTap != null) {
|
if (onTap != null) {
|
||||||
onTap(channel);
|
onTap(channel);
|
||||||
@@ -61,7 +64,8 @@ class ChannelPreview extends StatelessWidget {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Flexible(
|
Flexible(
|
||||||
child: ChannelName(
|
child: ChannelName(
|
||||||
textStyle: StreamChatTheme.of(context).channelPreviewTheme.title,
|
textStyle:
|
||||||
|
StreamChatTheme.of(context).channelPreviewTheme.title,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (channel.state.unreadCount > 0)
|
if (channel.state.unreadCount > 0)
|
||||||
@@ -96,6 +100,7 @@ class ChannelPreview extends StatelessWidget {
|
|||||||
_buildDate(context),
|
_buildDate(context),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,15 +134,35 @@ class ChannelPreview extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSubtitle(BuildContext context) {
|
Widget _buildSubtitle(BuildContext context) {
|
||||||
|
if (channel.isMuted) {
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
LineAwesomeIcons.volume_off,
|
||||||
|
size: 15,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Channel is muted',
|
||||||
|
style: StreamChatTheme.of(context)
|
||||||
|
.channelPreviewTheme
|
||||||
|
.subtitle
|
||||||
|
.copyWith(
|
||||||
|
color: StreamChatTheme.of(context)
|
||||||
|
.channelPreviewTheme
|
||||||
|
.subtitle
|
||||||
|
.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
return TypingIndicator(
|
return TypingIndicator(
|
||||||
channel: channel,
|
channel: channel,
|
||||||
alternativeWidget: _buildLastMessage(context),
|
alternativeWidget: _buildLastMessage(context),
|
||||||
style: StreamChatTheme.of(context).channelPreviewTheme.subtitle.copyWith(
|
style: StreamChatTheme.of(context).channelPreviewTheme.subtitle.copyWith(
|
||||||
color: StreamChatTheme.of(context)
|
color:
|
||||||
.channelPreviewTheme
|
StreamChatTheme.of(context).channelPreviewTheme.subtitle.color,
|
||||||
.subtitle
|
|
||||||
.color
|
|
||||||
.withOpacity(0.5),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -186,8 +211,7 @@ class ChannelPreview extends StatelessWidget {
|
|||||||
color: StreamChatTheme.of(context)
|
color: StreamChatTheme.of(context)
|
||||||
.channelPreviewTheme
|
.channelPreviewTheme
|
||||||
.subtitle
|
.subtitle
|
||||||
.color
|
.color,
|
||||||
.withOpacity(0.5),
|
|
||||||
fontStyle: (lastMessage.isSystem || lastMessage.isDeleted)
|
fontStyle: (lastMessage.isSystem || lastMessage.isDeleted)
|
||||||
? FontStyle.italic
|
? FontStyle.italic
|
||||||
: FontStyle.normal,
|
: FontStyle.normal,
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class StreamChatThemeData {
|
|||||||
),
|
),
|
||||||
subtitle: TextStyle(
|
subtitle: TextStyle(
|
||||||
fontSize: 12.5,
|
fontSize: 12.5,
|
||||||
color: isDark ? Colors.white : Colors.black,
|
color: (isDark ? Colors.white : Colors.black).withOpacity(0.5),
|
||||||
),
|
),
|
||||||
lastMessageAt: TextStyle(
|
lastMessageAt: TextStyle(
|
||||||
fontSize: 11,
|
fontSize: 11,
|
||||||
|
|||||||
Reference in New Issue
Block a user