add multiplr_conversation example

This commit is contained in:
Salvatore Giordano
2020-02-24 16:46:05 +01:00
parent d3b6a7e5e5
commit e0e36f50cc
7 changed files with 139 additions and 161 deletions
+27 -31
View File
@@ -9,27 +9,21 @@ void main() async {
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoid2lsZC1icmVlemUtNyJ9.VM2EX1EXOfgqa-bTH_3JzeY0T99ngWzWahSauP3dBMo',
);
runApp(StreamChat(
client: client,
child: MyApp(),
));
}
final channelClient = client.channel('messaging', id: 'godevs');
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
channelClient.watch();
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.blue,
runApp(
StreamChat(
client: client,
child: MaterialApp(
home: StreamChat(
client: client,
child: ChannelListPage(),
),
),
home: ChannelListPage(),
);
}
),
);
}
class ChannelListPage extends StatelessWidget {
@@ -48,7 +42,10 @@ class ChannelListPage extends StatelessWidget {
),
onChannelTap: (channelClient) {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return ChannelPage(channelClient);
return StreamChannel(
child: ChannelPage(),
channelClient: channelClient,
);
}));
},
),
@@ -57,21 +54,20 @@ class ChannelListPage extends StatelessWidget {
}
class ChannelPage extends StatelessWidget {
ChannelPage(this.channelClient);
final ChannelClient channelClient;
const ChannelPage({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return StreamChannel(
channelClient: channelClient,
child: Scaffold(
body: Column(
children: <Widget>[
Expanded(child: MessageListView()),
MessageInput(),
],
),
return Scaffold(
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(),
),
MessageInput(),
],
),
);
}
+21 -10
View File
@@ -19,18 +19,29 @@ void main() async {
client: client,
child: StreamChannel(
channelClient: channelClient,
child: Scaffold(
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(),
),
MessageInput(),
],
),
),
child: ChannelPage(),
),
),
),
);
}
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
Expanded(
child: MessageListView(),
),
MessageInput(),
],
),
);
}
}