diff --git a/example/lib/main.dart b/example/lib/main.dart index c2bb1a74..c958efb8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -398,6 +398,34 @@ class _ChannelListPageState extends State { limit: 20, ), channelWidget: ChannelPage(), + onViewInfoTap: (channel) { + if (channel.memberCount == 2 && + channel.isDistinct) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => StreamChannel( + channel: channel, + child: ChatInfoScreen( + user: channel.state.members.first.user, + ), + ), + ), + ); + } else { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => StreamChannel( + channel: channel, + child: GroupInfoScreen(), + ), + ), + ); + } + + // TODO: Add group screen + }, ), ), ), diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index 831696f7..6c4e967e 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -22,6 +22,8 @@ typedef ChannelTapCallback = void Function(Channel, Widget); /// Builder used to create a custom [ChannelPreview] from a [Channel] typedef ChannelPreviewBuilder = Widget Function(BuildContext, Channel); +typedef ViewInfoCallback = void Function(Channel); + /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_list_view.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/channel_list_view_paint.png) /// @@ -77,6 +79,7 @@ class ChannelListView extends StatefulWidget { this.crossAxisCount = 1, this.padding, this.selectedChannels = const [], + this.onViewInfoTap, }) : super(key: key); /// The builder that will be used in case of error @@ -145,6 +148,8 @@ class ChannelListView extends StatefulWidget { final List selectedChannels; + final ViewInfoCallback onViewInfoTap; + @override _ChannelListViewState createState() => _ChannelListViewState(); } @@ -579,23 +584,7 @@ class _ChannelListViewState extends State return StreamChannel( child: ChannelBottomSheet( onViewInfoTap: () { - if (channel.memberCount == 2 && - channel.isDistinct) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => StreamChannel( - channel: channel, - child: ChatInfoScreen( - user: - channel.state.members.first.user, - ), - ), - ), - ); - } - - // TODO: Add group screen + widget.onViewInfoTap(channel); }, ), channel: channel, diff --git a/lib/src/option_list_tile.dart b/lib/src/option_list_tile.dart index 5a9641f7..a18c2ab1 100644 --- a/lib/src/option_list_tile.dart +++ b/lib/src/option_list_tile.dart @@ -26,18 +26,12 @@ class OptionListTile extends StatelessWidget { return Column( children: [ Container( - color: separatorColor ?? Color(0xffe6e6e6), + color: separatorColor ?? + StreamChatTheme.of(context).colorTheme.greyGainsboro, height: 2.0, ), Material( - color: tileColor ?? Colors.white, - child: Container( - height: 56.0, - color: StreamChatTheme.of(context).colorTheme.greyGainsboro, - height: 1.0, - ), - Material( - color: StreamChatTheme.of(context).colorTheme.white, + color: tileColor ?? StreamChatTheme.of(context).colorTheme.white, child: Container( height: 63.0, child: InkWell(