rfac: Moved pages to sample app
This commit is contained in:
@@ -3,10 +3,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
|
|
||||||
import '../stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'channel_file_display_screen.dart';
|
|
||||||
import 'channel_media_display_screen.dart';
|
|
||||||
import 'option_list_tile.dart';
|
|
||||||
|
|
||||||
/// Detail screen for a 1:1 chat correspondence
|
/// Detail screen for a 1:1 chat correspondence
|
||||||
class ChatInfoScreen extends StatefulWidget {
|
class ChatInfoScreen extends StatefulWidget {
|
||||||
@@ -84,7 +84,6 @@ class ChannelListPage extends StatelessWidget {
|
|||||||
channel: channel,
|
channel: channel,
|
||||||
),
|
),
|
||||||
title: ChannelName(
|
title: ChannelName(
|
||||||
channel: channel,
|
|
||||||
textStyle:
|
textStyle:
|
||||||
StreamChatTheme.of(context).channelPreviewTheme.title.copyWith(
|
StreamChatTheme.of(context).channelPreviewTheme.title.copyWith(
|
||||||
color: Colors.black.withOpacity(opacity),
|
color: Colors.black.withOpacity(opacity),
|
||||||
|
|||||||
@@ -3,13 +3,12 @@ import 'dart:async';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
import 'package:stream_chat_flutter/src/chat_info_screen.dart';
|
import 'file:///Users/deven9852/Stream/stream-chat-flutter/example/lib/chat_info_screen.dart';
|
||||||
import 'package:stream_chat_flutter/src/option_list_tile.dart';
|
import 'package:stream_chat_flutter/src/option_list_tile.dart';
|
||||||
import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
|
import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
|
||||||
|
|
||||||
import '../stream_chat_flutter.dart';
|
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||||
import 'channel_file_display_screen.dart';
|
import 'main.dart';
|
||||||
import 'channel_media_display_screen.dart';
|
|
||||||
|
|
||||||
class GroupInfoScreen extends StatefulWidget {
|
class GroupInfoScreen extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
@@ -83,7 +82,6 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
leadingWidth: 36.0,
|
leadingWidth: 36.0,
|
||||||
title: Column(
|
title: Column(
|
||||||
children: [
|
children: [
|
||||||
// TODO: Add member names instead of Demo (if name = null)
|
|
||||||
FutureBuilder<QueryMembersResponse>(
|
FutureBuilder<QueryMembersResponse>(
|
||||||
future: _memberQueryFuture,
|
future: _memberQueryFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
@@ -163,8 +161,10 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
return Material(
|
return Material(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
var userMember = snapshot.data.members.firstWhere((e) => e.user.id == StreamChat.of(context).user.id);
|
var userMember = snapshot.data.members.firstWhere(
|
||||||
_showUserInfoModal(snapshot.data.members[position].user, userMember.role == 'owner');
|
(e) => e.user.id == StreamChat.of(context).user.id);
|
||||||
|
_showUserInfoModal(snapshot.data.members[position].user,
|
||||||
|
userMember.role == 'owner');
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 65.0,
|
height: 65.0,
|
||||||
@@ -675,9 +675,31 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
color: Color(0xff7a7a7a),
|
color: Color(0xff7a7a7a),
|
||||||
size: 24.0,
|
size: 24.0,
|
||||||
),
|
),
|
||||||
'Message',
|
'Message', () async {
|
||||||
() {}),
|
var client = StreamChat.of(context).client;
|
||||||
if (!channel.isDistinct && StreamChat.of(context).user.id != user.id && isUserAdmin)
|
|
||||||
|
var c = client.channel('messaging', extraData: {
|
||||||
|
'members': [
|
||||||
|
user.id,
|
||||||
|
StreamChat.of(context).user.id,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
await c.watch();
|
||||||
|
|
||||||
|
await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => StreamChannel(
|
||||||
|
channel: c,
|
||||||
|
child: ChannelPage(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
if (!channel.isDistinct &&
|
||||||
|
StreamChat.of(context).user.id != user.id &&
|
||||||
|
isUserAdmin)
|
||||||
_buildModalListTile(
|
_buildModalListTile(
|
||||||
StreamSvgIcon.userAdd(
|
StreamSvgIcon.userAdd(
|
||||||
color: Color(0xff7a7a7a),
|
color: Color(0xff7a7a7a),
|
||||||
@@ -686,7 +708,9 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
|
|||||||
'Make Owner', () {
|
'Make Owner', () {
|
||||||
// TODO: I have no clue how to make someone an owner
|
// TODO: I have no clue how to make someone an owner
|
||||||
}),
|
}),
|
||||||
if (!channel.isDistinct && StreamChat.of(context).user.id != user.id && isUserAdmin)
|
if (!channel.isDistinct &&
|
||||||
|
StreamChat.of(context).user.id != user.id &&
|
||||||
|
isUserAdmin)
|
||||||
_buildModalListTile(
|
_buildModalListTile(
|
||||||
StreamSvgIcon.userRemove(
|
StreamSvgIcon.userRemove(
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:example/choose_user_page.dart';
|
import 'package:example/choose_user_page.dart';
|
||||||
|
import 'package:example/chat_info_screen.dart';
|
||||||
|
import 'package:example/group_info_screen.dart';
|
||||||
import 'package:example/new_chat_screen.dart';
|
import 'package:example/new_chat_screen.dart';
|
||||||
import 'package:example/new_group_chat_screen.dart';
|
import 'package:example/new_group_chat_screen.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@@ -426,6 +428,44 @@ class ChannelPage extends StatelessWidget {
|
|||||||
backgroundColor: Color.fromRGBO(252, 252, 252, 1),
|
backgroundColor: Color.fromRGBO(252, 252, 252, 1),
|
||||||
appBar: ChannelHeader(
|
appBar: ChannelHeader(
|
||||||
showTypingIndicator: false,
|
showTypingIndicator: false,
|
||||||
|
onImageTap: () async {
|
||||||
|
var channel = StreamChannel.of(context).channel;
|
||||||
|
|
||||||
|
if (channel.memberCount == 2 && channel.isDistinct) {
|
||||||
|
final currentUser = StreamChat.of(context).user;
|
||||||
|
final otherUser = channel.state.members.firstWhere(
|
||||||
|
(element) => element.user.id != currentUser.id,
|
||||||
|
orElse: () => null,
|
||||||
|
);
|
||||||
|
if (otherUser != null) {
|
||||||
|
final pop = await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => StreamChannel(
|
||||||
|
child: ChatInfoScreen(
|
||||||
|
user: otherUser.user,
|
||||||
|
),
|
||||||
|
channel: channel,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (pop == true) {
|
||||||
|
Navigator.pop(context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
await Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => StreamChannel(
|
||||||
|
child: GroupInfoScreen(),
|
||||||
|
channel: channel,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import '../main.dart';
|
|||||||
import '../group_chat_details_screen.dart';
|
import '../group_chat_details_screen.dart';
|
||||||
import '../new_group_chat_screen.dart';
|
import '../new_group_chat_screen.dart';
|
||||||
import '../new_chat_screen.dart';
|
import '../new_chat_screen.dart';
|
||||||
|
import '../chat_info_screen.dart';
|
||||||
|
import '../group_info_screen.dart';
|
||||||
|
|
||||||
class AppRoutes {
|
class AppRoutes {
|
||||||
/// Add entry for new route here
|
/// Add entry for new route here
|
||||||
@@ -59,6 +61,20 @@ class AppRoutes {
|
|||||||
selectedUsers: args,
|
selectedUsers: args,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
case Routes.CHAT_INFO_SCREEN:
|
||||||
|
return MaterialPageRoute(
|
||||||
|
settings: const RouteSettings(name: Routes.CHAT_INFO_SCREEN),
|
||||||
|
builder: (_) {
|
||||||
|
return ChatInfoScreen(
|
||||||
|
user: args,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
case Routes.GROUP_INFO_SCREEN:
|
||||||
|
return MaterialPageRoute(
|
||||||
|
settings: const RouteSettings(name: Routes.GROUP_INFO_SCREEN),
|
||||||
|
builder: (_) {
|
||||||
|
return GroupInfoScreen();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,4 +7,6 @@ class Routes {
|
|||||||
static const String NEW_CHAT = '/new_chat';
|
static const String NEW_CHAT = '/new_chat';
|
||||||
static const String NEW_GROUP_CHAT = '/new_group_chat';
|
static const String NEW_GROUP_CHAT = '/new_group_chat';
|
||||||
static const String NEW_GROUP_CHAT_DETAILS = '/new_group_chat_details';
|
static const String NEW_GROUP_CHAT_DETAILS = '/new_group_chat_details';
|
||||||
|
static const String CHAT_INFO_SCREEN = '/chat_info_screen';
|
||||||
|
static const String GROUP_INFO_SCREEN = '/group_info_screen';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
|||||||
import '../stream_chat_flutter.dart';
|
import '../stream_chat_flutter.dart';
|
||||||
import './channel_name.dart';
|
import './channel_name.dart';
|
||||||
import 'channel_image.dart';
|
import 'channel_image.dart';
|
||||||
import 'chat_info_screen.dart';
|
|
||||||
import 'group_info_screen.dart';
|
|
||||||
import 'stream_channel.dart';
|
import 'stream_channel.dart';
|
||||||
|
|
||||||
/// 
|
/// 
|
||||||
@@ -100,43 +98,7 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
padding: const EdgeInsets.only(right: 10.0),
|
padding: const EdgeInsets.only(right: 10.0),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ChannelImage(
|
child: ChannelImage(
|
||||||
onTap: onImageTap ??
|
onTap: onImageTap,
|
||||||
() async {
|
|
||||||
if (channel.memberCount == 2 && channel.isDistinct) {
|
|
||||||
final currentUser = StreamChat.of(context).user;
|
|
||||||
final otherUser = channel.state.members.firstWhere(
|
|
||||||
(element) => element.user.id != currentUser.id,
|
|
||||||
orElse: () => null,
|
|
||||||
);
|
|
||||||
if (otherUser != null) {
|
|
||||||
final pop = await Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => StreamChannel(
|
|
||||||
channel: channel,
|
|
||||||
child: ChatInfoScreen(
|
|
||||||
user: otherUser.user,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pop == true) {
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
await Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => StreamChannel(
|
|
||||||
channel: channel,
|
|
||||||
child: GroupInfoScreen(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,13 +2,11 @@ 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:stream_chat/stream_chat.dart';
|
import 'package:stream_chat/stream_chat.dart';
|
||||||
import 'package:stream_chat_flutter/src/group_info_screen.dart';
|
|
||||||
import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
|
import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
|
||||||
|
|
||||||
import '../stream_chat_flutter.dart';
|
import '../stream_chat_flutter.dart';
|
||||||
import 'channel_name.dart';
|
import 'channel_name.dart';
|
||||||
import 'channel_unread_indicator.dart';
|
import 'channel_unread_indicator.dart';
|
||||||
import 'chat_info_screen.dart';
|
|
||||||
|
|
||||||
/// 
|
/// 
|
||||||
/// 
|
/// 
|
||||||
@@ -62,39 +60,7 @@ class ChannelPreview extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
leading: ChannelImage(
|
leading: ChannelImage(
|
||||||
onTap: onImageTap ??
|
onTap: onImageTap,
|
||||||
() {
|
|
||||||
if (channel.memberCount == 2 && channel.isDistinct) {
|
|
||||||
final currentUser = StreamChat.of(context).user;
|
|
||||||
final otherUser = channel.state.members.firstWhere(
|
|
||||||
(element) => element.user.id != currentUser.id,
|
|
||||||
orElse: () => null,
|
|
||||||
);
|
|
||||||
if (otherUser != null) {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => StreamChannel(
|
|
||||||
channel: channel,
|
|
||||||
child: ChatInfoScreen(
|
|
||||||
user: otherUser.user,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => StreamChannel(
|
|
||||||
channel: channel,
|
|
||||||
child: GroupInfoScreen(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
title: Row(
|
title: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
|||||||
@@ -44,3 +44,6 @@ export 'src/message_search_bloc.dart';
|
|||||||
export 'src/message_search_item.dart';
|
export 'src/message_search_item.dart';
|
||||||
export 'src/message_search_list_view.dart';
|
export 'src/message_search_list_view.dart';
|
||||||
export 'src/unread_indicator.dart';
|
export 'src/unread_indicator.dart';
|
||||||
|
export 'src/option_list_tile.dart';
|
||||||
|
export 'src/channel_file_display_screen.dart';
|
||||||
|
export 'src/channel_media_display_screen.dart';
|
||||||
|
|||||||
Reference in New Issue
Block a user