feat: Fixed conflicts, added group info screen

This commit is contained in:
Deven Joshi
2021-01-01 14:04:33 +05:30
parent 3006725ad7
commit dc643c0f71
3 changed files with 37 additions and 26 deletions
+28
View File
@@ -398,6 +398,34 @@ class _ChannelListPageState extends State<ChannelListPage> {
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
},
),
),
),
+6 -17
View File
@@ -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<Channel> selectedChannels;
final ViewInfoCallback onViewInfoTap;
@override
_ChannelListViewState createState() => _ChannelListViewState();
}
@@ -579,23 +584,7 @@ class _ChannelListViewState extends State<ChannelListView>
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,
+3 -9
View File
@@ -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(