Merge remote-tracking branch 'origin/develop' into feat/localization
# Conflicts: # packages/stream_chat_flutter/example/lib/main.dart # packages/stream_chat_flutter/example/pubspec.yaml # packages/stream_chat_flutter/lib/src/channel_bottom_sheet.dart # packages/stream_chat_flutter/lib/src/channel_list_view.dart # packages/stream_chat_flutter/lib/src/gallery_footer.dart # packages/stream_chat_flutter/lib/src/message_input.dart # packages/stream_chat_flutter/lib/src/message_list_view.dart # packages/stream_chat_flutter/lib/src/user_item.dart
This commit is contained in:
@@ -34,84 +34,96 @@ class _HindiStreamChatLocalizationsDelegate
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
/// Create a new instance of [StreamChatClient] passing the apikey obtained from your
|
||||
/// project dashboard.
|
||||
/// Create a new instance of [StreamChatClient] passing the apikey obtained
|
||||
/// from your project dashboard.
|
||||
final client = StreamChatClient(
|
||||
's2dxdhpxd94g',
|
||||
logLevel: Level.INFO,
|
||||
);
|
||||
|
||||
/// Set the current user and connect the websocket. In a production scenario, this should be done using
|
||||
/// a backend to generate a user token using our server SDK.
|
||||
/// Set the current user and connect the websocket. In a production
|
||||
/// scenario, this should be done using a backend to generate a user token
|
||||
/// using our server SDK.
|
||||
///
|
||||
/// Please see the following for more information:
|
||||
/// https://getstream.io/chat/docs/ios_user_setup_and_tokens/
|
||||
await client.connectUser(
|
||||
User(id: 'super-band-9'),
|
||||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A',
|
||||
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoic3VwZXItYmFuZC05In0.'
|
||||
'0L6lGoeLwkz0aZRUcpZKsvaXtNEDHBcezVTZ0oPq40A',
|
||||
);
|
||||
|
||||
final channel = client.channel('messaging', id: 'godevs');
|
||||
|
||||
await channel.watch();
|
||||
|
||||
runApp(MyApp(client, channel));
|
||||
runApp(
|
||||
MyApp(
|
||||
client: client,
|
||||
channel: channel,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Example application using Stream Chat Flutter widgets.
|
||||
/// Stream Chat Flutter is a set of Flutter widgets which provide full chat functionalities
|
||||
/// for building Flutter applications using Stream.
|
||||
/// If you'd prefer using minimal wrapper widgets for your app, please see our other
|
||||
///
|
||||
/// Stream Chat Flutter is a set of Flutter widgets which provide full chat
|
||||
/// functionalities for building Flutter applications using Stream. If you'd
|
||||
/// prefer using minimal wrapper widgets for your app, please see our other
|
||||
/// package, `stream_chat_flutter_core`.
|
||||
class MyApp extends StatelessWidget {
|
||||
/// Example using Stream's Flutter package.
|
||||
///
|
||||
/// If you'd prefer using minimal wrapper widgets for your app, please see
|
||||
/// our other package, `stream_chat_flutter_core`.
|
||||
const MyApp({
|
||||
Key? key,
|
||||
required this.client,
|
||||
required this.channel,
|
||||
}) : super(key: key);
|
||||
|
||||
/// Instance of Stream Client.
|
||||
/// Stream's [StreamChatClient] can be used to connect to our servers and set the default
|
||||
/// user for the application. Performing these actions trigger a websocket connection
|
||||
/// allowing for real-time updates.
|
||||
///
|
||||
/// Stream's [StreamChatClient] can be used to connect to our servers and
|
||||
/// set the default user for the application. Performing these actions
|
||||
/// trigger a websocket connection allowing for real-time updates.
|
||||
final StreamChatClient client;
|
||||
|
||||
/// Instance of the Channel
|
||||
final Channel channel;
|
||||
|
||||
/// Example using Stream's Flutter package.
|
||||
/// If you'd prefer using minimal wrapper widgets for your app, please see our other
|
||||
/// package, `stream_chat_flutter_core`.
|
||||
MyApp(this.client, this.channel);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData.light(),
|
||||
darkTheme: ThemeData.dark(),
|
||||
themeMode: ThemeMode.system,
|
||||
supportedLocales: [
|
||||
Locale('en', 'US'),
|
||||
Locale('hi', 'IN'),
|
||||
],
|
||||
localizationsDelegates: [
|
||||
GlobalStreamChatLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
StreamChatLocalizationsHi.delegate,
|
||||
],
|
||||
builder: (context, widget) {
|
||||
return StreamChat(
|
||||
Widget build(BuildContext context) => MaterialApp(
|
||||
theme: ThemeData.light(),
|
||||
darkTheme: ThemeData.dark(),
|
||||
themeMode: ThemeMode.system,
|
||||
supportedLocales: [
|
||||
Locale('en', 'US'),
|
||||
Locale('hi', 'IN'),
|
||||
],
|
||||
localizationsDelegates: [
|
||||
GlobalStreamChatLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
StreamChatLocalizationsHi.delegate,
|
||||
],
|
||||
builder: (context, widget) => StreamChat(
|
||||
client: client,
|
||||
child: widget,
|
||||
);
|
||||
},
|
||||
home: StreamChannel(
|
||||
channel: channel,
|
||||
child: ChannelPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
home: StreamChannel(
|
||||
channel: channel,
|
||||
child: const ChannelPage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// A list of messages sent in the current channel.
|
||||
///
|
||||
/// This is implemented using [MessageListView], a widget that provides query functionalities
|
||||
/// fetching the messages from the api and showing them in a listView
|
||||
/// This is implemented using [MessageListView], a widget that provides query
|
||||
/// functionalities fetching the messages from the api and showing them in a
|
||||
/// listView.
|
||||
class ChannelPage extends StatelessWidget {
|
||||
/// Creates the page that shows the list of messages
|
||||
const ChannelPage({
|
||||
@@ -119,17 +131,15 @@ class ChannelPage extends StatelessWidget {
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: ChannelHeader(),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: MessageListView(),
|
||||
),
|
||||
MessageInput(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: const ChannelHeader(),
|
||||
body: Column(
|
||||
children: const <Widget>[
|
||||
Expanded(
|
||||
child: MessageListView(),
|
||||
),
|
||||
MessageInput(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user