diff --git a/README.md b/README.md index 4fe4a1e..2472b01 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,18 @@ With Stream's chat components, developers quickly add chat to their app for a va ## Repo Overview 😎 This repo contains projects and samples developed by the team and Stream community. Projects are broke up into directories under the `packages` folder. + Each project contains a README with build and execution instructions. -## **Projects 🚀** - +## **Maintained Projects 🚀** - [Stream Chat v1](https://github.com/GetStream/flutter-samples/tree/main/packages/stream_chat_v1): a sample app implemented using Stream Chat and Flutter. It is a fully fledged messaging app built using a combination of our pre-made widgets and custom Flutter widgets. - -- [Stream Chatty](https://github.com/GetStream/flutter-samples/tree/main/packages/chatty) Stream Chatty is a sample chat app made in Flutter using Stream Chat, Firebase, and flutter_bloc. It has full light and dark mode support, real-time chat, and full authentication using Firebase auth. - +- [Chatter YouTube Series](https://github.com/HayesGordon/chatter): an ongoing, beginner friendly, YouTube video series showing how to use Stream's Flutter packages. - [iMessage clone](https://github.com/GetStream/flutter-samples/tree/main/packages/imessage): an iMessage clone implemented using Flutter and the `stream_chat_flutter_core` package. +## **Historic Projects 📕** +*These projects are not actively maintained. They were developed using older versions of our packages and Flutter.* +- [Stream Chatty](https://github.com/GetStream/flutter-samples/tree/main/packages/chatty) Stream Chatty is a sample chat app made in Flutter using Stream Chat, Firebase, and flutter_bloc. It has full light and dark mode support, real-time chat, and full authentication using Firebase auth. + ## Requirements 🛠 Before running this project please ensure Flutter is installed and configured on your machine. If you're new to Flutter, please checkout the [official guide](https://flutter.dev/docs/get-started/install) with installation instructions for your OS. diff --git a/packages/chatty/README.md b/packages/chatty/README.md index 0c17de7..03990f0 100644 --- a/packages/chatty/README.md +++ b/packages/chatty/README.md @@ -1,5 +1,9 @@ # Stream Chatty +⚠️ **Attention**: This example is no longer maintained. It uses older versions of our packages and was tested on an older version of Flutter. + +--- + Stream Chatty is a sample chat app made in Flutter using [Stream Chat](https://getstream.io/chat/sdk/flutter/), [Firebase](https://firebase.google.com/), and [flutter_bloc](https://bloclibrary.dev/#/). It has full light and dark mode support, real-time chat, and full authentication using Firebase auth. Stream Chatty was created by [Diego Velasquez](http://www.twitter.com/diegoveloper) as part of a Youtube series. A step by step guide to building Stream Chatty from scratch can be found here: diff --git a/packages/chatty/lib/data/local/image_picker_impl.dart b/packages/chatty/lib/data/local/image_picker_impl.dart index 2bd82dd..14a1ca3 100644 --- a/packages/chatty/lib/data/local/image_picker_impl.dart +++ b/packages/chatty/lib/data/local/image_picker_impl.dart @@ -6,7 +6,7 @@ class ImagePickerImpl extends ImagePickerRepository { @override Future pickImage() async { final picker = ImagePicker(); - final pickedFile = await picker.getImage( + final pickedFile = await picker.pickImage( source: ImageSource.gallery, maxWidth: 400, ); diff --git a/packages/chatty/lib/data/local/stream_api_local_impl.dart b/packages/chatty/lib/data/local/stream_api_local_impl.dart index 4a84e35..519db0a 100644 --- a/packages/chatty/lib/data/local/stream_api_local_impl.dart +++ b/packages/chatty/lib/data/local/stream_api_local_impl.dart @@ -8,7 +8,7 @@ class StreamApiLocalImpl extends StreamApiRepository { final StreamChatClient _client; @override - Future connectUser(ChatUser user, String? token) async { + Future connectUser(ChatUser user, String token) async { Map extraData = {}; if (user.image != null) { extraData['image'] = user.image; @@ -16,7 +16,7 @@ class StreamApiLocalImpl extends StreamApiRepository { if (user.name != null) { extraData['name'] = user.name; } - await _client.disconnect(); + await _client.disconnectUser(); await _client.connectUser( User(id: user.id!, extraData: extraData as Map), token, @@ -28,7 +28,7 @@ class StreamApiLocalImpl extends StreamApiRepository { Future> getChatUsers() async { final result = await _client.queryUsers(); final chatUsers = result.users - .where((element) => element.id != _client.state.user!.id) + .where((element) => element.id != _client.state.currentUser!.id) .map( (e) => ChatUser( id: e.id, @@ -42,7 +42,7 @@ class StreamApiLocalImpl extends StreamApiRepository { @override Future getToken(String userId) async { - return _client.devToken(userId); + return _client.devToken(userId).rawValue; } @override @@ -52,7 +52,7 @@ class StreamApiLocalImpl extends StreamApiRepository { final channel = _client.channel('messaging', id: channelId, extraData: { 'name': name!, 'image': image!, - 'members': [_client.state.user!.id, ...members!], + 'members': [_client.state.currentUser!.id, ...members!], }); await channel.watch(); return channel; @@ -61,11 +61,11 @@ class StreamApiLocalImpl extends StreamApiRepository { @override Future createSimpleChat(String? friendId) async { final channel = _client.channel('messaging', - id: '${_client.state.user!.id.hashCode}${friendId.hashCode}', + id: '${_client.state.currentUser!.id.hashCode}${friendId.hashCode}', extraData: { 'members': [ friendId, - _client.state.user!.id, + _client.state.currentUser!.id, ], }); await channel.watch(); @@ -74,7 +74,7 @@ class StreamApiLocalImpl extends StreamApiRepository { @override Future logout() { - return _client.disconnect(); + return _client.disconnectUser(); } @override @@ -84,6 +84,6 @@ class StreamApiLocalImpl extends StreamApiRepository { User(id: userId), token, ); - return _client.state.user!.name != userId; + return _client.state.currentUser!.name != userId; } } diff --git a/packages/chatty/lib/data/prod/stream_api_impl.dart b/packages/chatty/lib/data/prod/stream_api_impl.dart index fa65e76..20b8ad7 100644 --- a/packages/chatty/lib/data/prod/stream_api_impl.dart +++ b/packages/chatty/lib/data/prod/stream_api_impl.dart @@ -11,7 +11,7 @@ class StreamApiImpl extends StreamApiRepository { final StreamChatClient _client; @override - Future connectUser(ChatUser user, String? token) async { + Future connectUser(ChatUser user, String token) async { Map extraData = {}; if (user.image != null) { extraData['image'] = user.image; @@ -19,7 +19,7 @@ class StreamApiImpl extends StreamApiRepository { if (user.name != null) { extraData['name'] = user.name; } - await _client.disconnect(); + await _client.disconnectUser(); await _client.connectUser( User(id: user.id!, extraData: extraData as Map), token, @@ -31,7 +31,7 @@ class StreamApiImpl extends StreamApiRepository { Future> getChatUsers() async { final result = await _client.queryUsers(); final chatUsers = result.users - .where((element) => element.id != _client.state.user!.id) + .where((element) => element.id != _client.state.currentUser!.id) .map( (e) => ChatUser( id: e.id, @@ -44,7 +44,7 @@ class StreamApiImpl extends StreamApiRepository { } @override - Future getToken(String userId) async { + Future getToken(String userId) async { //TODO: use your own implementation in Production final response = await http.post( Uri.parse('your_backend_url'), @@ -62,12 +62,13 @@ class StreamApiImpl extends StreamApiRepository { } @override - Future createGroupChat(String id, String? name, List? members, + Future createGroupChat( + String id, String? name, List? members, {String? image}) async { final channel = _client.channel('messaging', id: id, extraData: { 'name': name!, 'image': image!, - 'members': [_client.state.user!.id, ...members!], + 'members': [_client.state.currentUser!.id, ...members!], }); await channel.watch(); return channel; @@ -76,11 +77,11 @@ class StreamApiImpl extends StreamApiRepository { @override Future createSimpleChat(String? friendId) async { final channel = _client.channel('messaging', - id: '${_client.state.user!.id.hashCode}${friendId.hashCode}', + id: '${_client.state.currentUser!.id.hashCode}${friendId.hashCode}', extraData: { 'members': [ friendId, - _client.state.user!.id, + _client.state.currentUser!.id, ], }); await channel.watch(); @@ -89,7 +90,7 @@ class StreamApiImpl extends StreamApiRepository { @override Future logout() async { - return _client.disconnect(); + return _client.disconnectUser(); } @override @@ -99,6 +100,6 @@ class StreamApiImpl extends StreamApiRepository { User(id: userId), token, ); - return _client.state.user!.name != userId; + return _client.state.currentUser!.name != userId; } } diff --git a/packages/chatty/lib/data/stream_api_repository.dart b/packages/chatty/lib/data/stream_api_repository.dart index b722932..1e0e881 100644 --- a/packages/chatty/lib/data/stream_api_repository.dart +++ b/packages/chatty/lib/data/stream_api_repository.dart @@ -3,12 +3,21 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; abstract class StreamApiRepository { Future> getChatUsers(); - Future getToken(String userId); + + Future getToken(String userId); + Future connectIfExist(String userId); - Future connectUser(ChatUser user, String? token); + + Future connectUser(ChatUser user, String token); + Future createGroupChat( - String channelId, String? name, List? members, - {String? image}); + String channelId, + String? name, + List? members, { + String? image, + }); + Future createSimpleChat(String? friendId); + Future logout(); } diff --git a/packages/chatty/lib/domain/usecases/profile_sign_in_usecase.dart b/packages/chatty/lib/domain/usecases/profile_sign_in_usecase.dart index 19969d6..330d123 100644 --- a/packages/chatty/lib/domain/usecases/profile_sign_in_usecase.dart +++ b/packages/chatty/lib/domain/usecases/profile_sign_in_usecase.dart @@ -9,6 +9,7 @@ import '../exceptions/auth_exception.dart'; class ProfileInput { ProfileInput({this.imageFile, this.name}); + final File? imageFile; final String? name; } @@ -36,11 +37,12 @@ class ProfileSignInUseCase { input.imageFile, 'users/${auth.id}'); } await _streamApiRepository.connectUser( - ChatUser( - name: input.name, - id: auth.id, - image: image, - ), - token); + ChatUser( + name: input.name, + id: auth.id, + image: image, + ), + token, + ); } } diff --git a/packages/chatty/lib/main.dart b/packages/chatty/lib/main.dart index 817010d..dc85cb1 100644 --- a/packages/chatty/lib/main.dart +++ b/packages/chatty/lib/main.dart @@ -19,7 +19,10 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); + SystemChrome.setEnabledSystemUIMode( + SystemUiMode.manual, + overlays: [SystemUiOverlay.bottom], + ); return MultiRepositoryProvider( providers: buildRepositories(_streamChatClient), @@ -36,9 +39,10 @@ class MyApp extends StatelessWidget { client: _streamChatClient, streamChatThemeData: StreamChatThemeData.fromTheme(Theme.of(context)).copyWith( - ownMessageTheme: MessageTheme( - messageBackgroundColor: Theme.of(context).accentColor, - messageText: TextStyle(color: Colors.white), + ownMessageTheme: MessageThemeData( + messageBackgroundColor: + Theme.of(context).colorScheme.secondary, + messageTextStyle: TextStyle(color: Colors.white), ), ), ); diff --git a/packages/chatty/lib/ui/common/my_channel_preview.dart b/packages/chatty/lib/ui/common/my_channel_preview.dart index 2e168b5..9156d83 100644 --- a/packages/chatty/lib/ui/common/my_channel_preview.dart +++ b/packages/chatty/lib/ui/common/my_channel_preview.dart @@ -80,7 +80,7 @@ class MyChannelPreview extends StatelessWidget { tag: heroTag!, child: StreamChannel( channel: channel, - child: ChannelImage( + child: ChannelAvatar( onTap: onImageTap, ), ), @@ -91,8 +91,9 @@ class MyChannelPreview extends StatelessWidget { children: [ Flexible( child: ChannelName( - textStyle: - StreamChatTheme.of(context).channelPreviewTheme.title, + textStyle: StreamChatTheme.of(context) + .channelPreviewTheme + .titleStyle, ), ), StreamBuilder>( @@ -102,7 +103,8 @@ class MyChannelPreview extends StatelessWidget { if (!snapshot.hasData || snapshot.data!.isEmpty || !snapshot.data!.any((Member e) => - e.user!.id == channel.client.state.user!.id)) { + e.user!.id == + channel.client.state.currentUser!.id)) { return SizedBox(); } return ChannelUnreadIndicator( @@ -122,7 +124,7 @@ class MyChannelPreview extends StatelessWidget { (m) => !m.isDeleted && m.shadowed != true, ); if (lastMessage?.user?.id == - StreamChat.of(context).user!.id) { + StreamChat.of(context).currentUser!.id) { return Padding( padding: const EdgeInsets.only(right: 4.0), child: SendingIndicator( @@ -131,9 +133,9 @@ class MyChannelPreview extends StatelessWidget { .channelPreviewTheme .indicatorIconSize, isMessageRead: channel.state!.read - ?.where((element) => + .where((element) => element.user.id != - channel.client.state.user!.id) + channel.client.state.currentUser!.id) .where((element) => element.lastRead .isAfter(lastMessage.createdAt)) .isNotEmpty == @@ -181,7 +183,9 @@ class MyChannelPreview extends StatelessWidget { return Text( stringDate, - style: StreamChatTheme.of(context).channelPreviewTheme.lastMessageAt, + style: StreamChatTheme.of(context) + .channelPreviewTheme + .lastMessageAtStyle, ); }, ); @@ -199,11 +203,11 @@ class MyChannelPreview extends StatelessWidget { ' Channel is muted', style: StreamChatTheme.of(context) .channelPreviewTheme - .subtitle! + .subtitleStyle! .copyWith( color: StreamChatTheme.of(context) .channelPreviewTheme - .subtitle! + .subtitleStyle! .color, ), ), @@ -213,9 +217,14 @@ class MyChannelPreview extends StatelessWidget { return TypingIndicator( channel: channel, alternativeWidget: _buildLastMessage(context), - style: StreamChatTheme.of(context).channelPreviewTheme.subtitle!.copyWith( - color: - StreamChatTheme.of(context).channelPreviewTheme.subtitle!.color, + style: StreamChatTheme.of(context) + .channelPreviewTheme + .subtitleStyle! + .copyWith( + color: StreamChatTheme.of(context) + .channelPreviewTheme + .subtitleStyle! + .color, ), ); } @@ -255,23 +264,31 @@ class MyChannelPreview extends StatelessWidget { text, lastMessage.mentionedUsers, lastMessage.attachments, - StreamChatTheme.of(context).channelPreviewTheme.subtitle!.copyWith( - color: StreamChatTheme.of(context) - .channelPreviewTheme - .subtitle! - .color, - fontStyle: (lastMessage.isSystem || lastMessage.isDeleted) - ? FontStyle.italic - : FontStyle.normal), - StreamChatTheme.of(context).channelPreviewTheme.subtitle!.copyWith( - color: StreamChatTheme.of(context) - .channelPreviewTheme - .subtitle! - .color, - fontStyle: (lastMessage.isSystem || lastMessage.isDeleted) - ? FontStyle.italic - : FontStyle.normal, - fontWeight: FontWeight.bold), + StreamChatTheme.of(context) + .channelPreviewTheme + .subtitleStyle! + .copyWith( + color: + StreamChatTheme.of(context) + .channelPreviewTheme + .subtitleStyle! + .color, + fontStyle: (lastMessage.isSystem || lastMessage.isDeleted) + ? FontStyle.italic + : FontStyle.normal), + StreamChatTheme.of(context) + .channelPreviewTheme + .subtitleStyle! + .copyWith( + color: + StreamChatTheme.of(context) + .channelPreviewTheme + .subtitleStyle! + .color, + fontStyle: (lastMessage.isSystem || lastMessage.isDeleted) + ? FontStyle.italic + : FontStyle.normal, + fontWeight: FontWeight.bold), ), maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/packages/chatty/lib/ui/home/chat/chat_view.dart b/packages/chatty/lib/ui/home/chat/chat_view.dart index 0bed83a..b0a2099 100644 --- a/packages/chatty/lib/ui/home/chat/chat_view.dart +++ b/packages/chatty/lib/ui/home/chat/chat_view.dart @@ -5,7 +5,7 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class ChatView extends StatelessWidget { @override Widget build(BuildContext context) { - final textColor = Theme.of(context).appBarTheme.color; + final textColor = Theme.of(context).appBarTheme.backgroundColor; return Scaffold( backgroundColor: Theme.of(context).canvasColor, appBar: AppBar( @@ -25,7 +25,7 @@ class ChatView extends StatelessWidget { child: ChannelListView( filter: Filter.in_( 'members', - [StreamChat.of(context).user!.id], + [StreamChat.of(context).currentUser!.id], ), sort: [SortOption('last_message_at')], channelPreviewBuilder: (context, channel) { @@ -37,10 +37,11 @@ class ChatView extends StatelessWidget { onImageTap: () { String? name; String? image; - final currentUser = StreamChat.of(context).client.state.user; + final currentUser = + StreamChat.of(context).client.state.currentUser; if (channel.isGroup) { - name = channel.extraData['name']; - image = channel.extraData['image']; + name = channel.extraData['name'] as String?; + image = channel.extraData['image'] as String?; } else { final friend = channel.state!.members .where((element) => element.userId != currentUser!.id) diff --git a/packages/chatty/lib/ui/home/chat/selection/friends_selection_view.dart b/packages/chatty/lib/ui/home/chat/selection/friends_selection_view.dart index 3fdb50b..76f0088 100644 --- a/packages/chatty/lib/ui/home/chat/selection/friends_selection_view.dart +++ b/packages/chatty/lib/ui/home/chat/selection/friends_selection_view.dart @@ -25,8 +25,8 @@ class FriendsSelectionView extends StatelessWidget { @override Widget build(BuildContext context) { - final textColor = Theme.of(context).appBarTheme.color; - final accentColor = Theme.of(context).accentColor; + final textColor = Theme.of(context).appBarTheme.backgroundColor; + final accentColor = Theme.of(context).colorScheme.secondary; return MultiBlocProvider( providers: [ BlocProvider( diff --git a/packages/chatty/lib/ui/home/chat/selection/group_selection_view.dart b/packages/chatty/lib/ui/home/chat/selection/group_selection_view.dart index 42f65e5..3c9bc34 100644 --- a/packages/chatty/lib/ui/home/chat/selection/group_selection_view.dart +++ b/packages/chatty/lib/ui/home/chat/selection/group_selection_view.dart @@ -48,7 +48,7 @@ class GroupSelectionView extends StatelessWidget { 'New Group', style: TextStyle( fontSize: 24, - color: Theme.of(context).appBarTheme.color, + color: Theme.of(context).appBarTheme.backgroundColor, fontWeight: FontWeight.w800, ), ), diff --git a/packages/chatty/lib/ui/home/settings/settings_view.dart b/packages/chatty/lib/ui/home/settings/settings_view.dart index 4347749..f62067b 100644 --- a/packages/chatty/lib/ui/home/settings/settings_view.dart +++ b/packages/chatty/lib/ui/home/settings/settings_view.dart @@ -10,9 +10,9 @@ import 'package:stream_chat_flutter/stream_chat_flutter.dart'; class SettingsView extends StatelessWidget { @override Widget build(BuildContext context) { - final user = StreamChat.of(context).client.state.user!; + final user = StreamChat.of(context).client.state.currentUser!; final image = user.extraData['image']; - final textColor = Theme.of(context).appBarTheme.color; + final textColor = Theme.of(context).appBarTheme.backgroundColor; return MultiBlocProvider( providers: [ BlocProvider( @@ -44,7 +44,6 @@ class SettingsView extends StatelessWidget { child: Column( children: [ AvatarImageView( - //TODO: implement change avatar onTap: () => null, child: image != null ? Image.network( diff --git a/packages/chatty/lib/ui/profile_verify/profile_verify_view.dart b/packages/chatty/lib/ui/profile_verify/profile_verify_view.dart index 6b6c2bd..aedc2ba 100644 --- a/packages/chatty/lib/ui/profile_verify/profile_verify_view.dart +++ b/packages/chatty/lib/ui/profile_verify/profile_verify_view.dart @@ -82,7 +82,7 @@ class ProfileVerifyView extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), - color: Theme.of(context).accentColor, + color: Theme.of(context).colorScheme.secondary, child: InkWell( onTap: () { context.read().startChatting(); diff --git a/packages/chatty/lib/ui/themes.dart b/packages/chatty/lib/ui/themes.dart index ef9412b..ab1bb45 100644 --- a/packages/chatty/lib/ui/themes.dart +++ b/packages/chatty/lib/ui/themes.dart @@ -10,7 +10,8 @@ class Themes { static final themeLight = ThemeData.light().copyWith( backgroundColor: backgroundLightColor, // selected color - accentColor: primaryColor, + colorScheme: + ThemeData.light().colorScheme.copyWith(secondary: primaryColor), // floating action button floatingActionButtonTheme: FloatingActionButtonThemeData( backgroundColor: primaryColor, @@ -32,7 +33,8 @@ class Themes { static final themeDark = ThemeData.dark().copyWith( backgroundColor: backgroundDarkColor, // selected color - accentColor: primaryColor, + colorScheme: + ThemeData.dark().colorScheme.copyWith(secondary: primaryColor), // floating action button floatingActionButtonTheme: FloatingActionButtonThemeData( backgroundColor: primaryColor, diff --git a/packages/chatty/pubspec.yaml b/packages/chatty/pubspec.yaml index c0f4552..50682b9 100644 --- a/packages/chatty/pubspec.yaml +++ b/packages/chatty/pubspec.yaml @@ -10,9 +10,9 @@ dependencies: flutter: sdk: flutter - flutter_bloc: ^7.0.0 - stream_chat_flutter: ^2.0.0-nullsafety.3 - uuid: ^3.0.4 + flutter_bloc: ^7.1.0 + stream_chat_flutter: ^2.0.0 + uuid: ^3.0.5 firebase_core: ^1.2.0 google_sign_in: ^5.0.3 @@ -20,7 +20,7 @@ dependencies: firebase_storage: ^8.1.0 shared_preferences: ^2.0.5 http: any - collection: ^1.15.0-nullsafety.4 + collection: ^1.15.0 dev_dependencies: flutter_test: diff --git a/packages/imessage/README.md b/packages/imessage/README.md index e6d0f7c..cae13e2 100644 --- a/packages/imessage/README.md +++ b/packages/imessage/README.md @@ -2,14 +2,14 @@ ![](https://raw.githubusercontent.com/GetStream/flutter-samples/master/images/imessage_clone_hero_v1.png) -iMessage Clone is a sample app implemented using Stream Chat and Flutter. It is a fully fledged messaging app built using core packages. +iMessage Clone is a sample app implemented using Stream Chat and Flutter. It's a fully fledged messaging app built using the core Stream packages. + +See our [blog post](https://getstream.io/blog/build-an-imessage-clone-with-streams-flutter-chat-sdk/) for a step-by-step guide on how to build this application. ## Getting Started Before running this project please ensure Flutter is installed and configured on your machine. If you're new to Flutter, please checkout the [official guide](https://flutter.dev/docs/get-started/install) with installation instructions for your OS. - - This project is only configured to support the following platforms: - Android diff --git a/packages/imessage/lib/main.dart b/packages/imessage/lib/main.dart index ec5a59a..7763692 100644 --- a/packages/imessage/lib/main.dart +++ b/packages/imessage/lib/main.dart @@ -26,7 +26,9 @@ Future main() async { class IMessage extends StatelessWidget { final StreamChatClient client; + IMessage({required this.client}); + @override Widget build(BuildContext context) { initializeDateFormatting('en_US', null); @@ -58,9 +60,7 @@ class ChatLoader extends StatelessWidget { Filter.equal('type', 'messaging'), ]), sort: [SortOption('last_message_at')], - pagination: PaginationParams( - limit: 20, - ), + limit: 20, emptyBuilder: (BuildContext context) { return Center( child: Text('Looks like you are not in any channels'), diff --git a/packages/imessage/pubspec.yaml b/packages/imessage/pubspec.yaml index 4af86c3..c2605f6 100644 --- a/packages/imessage/pubspec.yaml +++ b/packages/imessage/pubspec.yaml @@ -24,20 +24,20 @@ dependencies: flutter: sdk: flutter intl: ^0.17.0 - stream_chat_flutter: ^2.2.0 - animations: ^2.0.0 + stream_chat_flutter: ^3.0.0 + animations: ^2.0.1 collection: ^1.15.0 - cached_network_image: ^3.0.0 + cached_network_image: ^3.1.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.0 + cupertino_icons: ^1.0.3 dev_dependencies: flutter_test: sdk: flutter - pedantic: ^1.9.0 + pedantic: ^1.11.1 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/packages/stream_chat_v1/ios/Runner.xcodeproj/project.pbxproj b/packages/stream_chat_v1/ios/Runner.xcodeproj/project.pbxproj index cc4fc1c..661acd0 100644 --- a/packages/stream_chat_v1/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/stream_chat_v1/ios/Runner.xcodeproj/project.pbxproj @@ -251,7 +251,6 @@ "${BUILT_PRODUCTS_DIR}/connectivity_plus/connectivity_plus.framework", "${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework", "${BUILT_PRODUCTS_DIR}/flutter_app_badger/flutter_app_badger.framework", - "${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework", "${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework", "${BUILT_PRODUCTS_DIR}/flutter_secure_storage/flutter_secure_storage.framework", "${BUILT_PRODUCTS_DIR}/image_gallery_saver/image_gallery_saver.framework", @@ -281,7 +280,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity_plus.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_app_badger.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_secure_storage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_gallery_saver.framework", diff --git a/packages/stream_chat_v1/lib/advanced_options_page.dart b/packages/stream_chat_v1/lib/advanced_options_page.dart index f6f6f9f..a42f200 100644 --- a/packages/stream_chat_v1/lib/advanced_options_page.dart +++ b/packages/stream_chat_v1/lib/advanced_options_page.dart @@ -39,7 +39,6 @@ class _AdvancedOptionsPageState extends State { backgroundColor: StreamChatTheme.of(context).colorTheme.barsBg, elevation: 1, centerTitle: true, - brightness: Theme.of(context).brightness, title: Text( AppLocalizations.of(context).advancedOptions, style: StreamChatTheme.of(context).textTheme.headlineBold.copyWith( diff --git a/packages/stream_chat_v1/lib/channel_file_display_screen.dart b/packages/stream_chat_v1/lib/channel_file_display_screen.dart index 33394cf..4f4a806 100644 --- a/packages/stream_chat_v1/lib/channel_file_display_screen.dart +++ b/packages/stream_chat_v1/lib/channel_file_display_screen.dart @@ -13,14 +13,14 @@ class ChannelFileDisplayScreen extends StatefulWidget { /// limit: the number of users to return (max is 30) /// offset: the offset (max is 1000) /// message_limit: how many messages should be included to each channel - final PaginationParams? paginationParams; + final PaginationParams paginationParams; /// The builder used when the file list is empty. final WidgetBuilder? emptyBuilder; const ChannelFileDisplayScreen({ this.sortOptions, - this.paginationParams, + this.paginationParams = const PaginationParams(limit: 20), this.emptyBuilder, }); @@ -53,7 +53,6 @@ class _ChannelFileDisplayScreenState extends State { return Scaffold( backgroundColor: StreamChatTheme.of(context).colorTheme.barsBg, appBar: AppBar( - brightness: Theme.of(context).brightness, elevation: 1, centerTitle: true, title: Text( @@ -151,7 +150,7 @@ class _ChannelFileDisplayScreenState extends State { ['file'], ), sort: widget.sortOptions, - pagination: widget.paginationParams!.copyWith( + pagination: widget.paginationParams.copyWith( offset: messageSearchBloc.messageResponses?.length ?? 0, ), ), diff --git a/packages/stream_chat_v1/lib/channel_list.dart b/packages/stream_chat_v1/lib/channel_list.dart index 0586b92..d675fba 100644 --- a/packages/stream_chat_v1/lib/channel_list.dart +++ b/packages/stream_chat_v1/lib/channel_list.dart @@ -90,7 +90,7 @@ class _ChannelList extends State { ), ], pullToRefresh: false, - paginationParams: PaginationParams(limit: 20), + limit: 20, emptyBuilder: (_) { return LayoutBuilder( builder: (context, viewportConstraints) { @@ -160,9 +160,7 @@ class _ChannelList extends State { swipeToAction: true, filter: Filter.in_('members', [user!.id]), presence: true, - pagination: PaginationParams( - limit: 20, - ), + limit: 20, onViewInfoTap: (channel) { Navigator.pop(context); if (channel.memberCount == 2 && channel.isDistinct) { diff --git a/packages/stream_chat_v1/lib/channel_media_display_screen.dart b/packages/stream_chat_v1/lib/channel_media_display_screen.dart index 9435718..ee23293 100644 --- a/packages/stream_chat_v1/lib/channel_media_display_screen.dart +++ b/packages/stream_chat_v1/lib/channel_media_display_screen.dart @@ -14,7 +14,7 @@ class ChannelMediaDisplayScreen extends StatefulWidget { /// limit: the number of users to return (max is 30) /// offset: the offset (max is 1000) /// message_limit: how many messages should be included to each channel - final PaginationParams? paginationParams; + final PaginationParams paginationParams; /// The builder used when the file list is empty. final WidgetBuilder? emptyBuilder; @@ -26,7 +26,7 @@ class ChannelMediaDisplayScreen extends StatefulWidget { const ChannelMediaDisplayScreen({ required this.messageTheme, this.sortOptions, - this.paginationParams, + this.paginationParams = const PaginationParams(limit: 20), this.emptyBuilder, this.onShowMessage, }); @@ -62,7 +62,6 @@ class _ChannelMediaDisplayScreenState extends State { return Scaffold( backgroundColor: StreamChatTheme.of(context).colorTheme.barsBg, appBar: AppBar( - brightness: Theme.of(context).brightness, elevation: 1, centerTitle: true, title: Text( @@ -163,7 +162,7 @@ class _ChannelMediaDisplayScreenState extends State { ['image', 'video'], ), sort: widget.sortOptions, - pagination: widget.paginationParams!.copyWith( + pagination: widget.paginationParams.copyWith( offset: messageSearchBloc.messageResponses?.length ?? 0, ), ), diff --git a/packages/stream_chat_v1/lib/chat_info_screen.dart b/packages/stream_chat_v1/lib/chat_info_screen.dart index 9190479..2ba0789 100644 --- a/packages/stream_chat_v1/lib/chat_info_screen.dart +++ b/packages/stream_chat_v1/lib/chat_info_screen.dart @@ -235,7 +235,6 @@ class _ChatInfoScreenState extends State { direction: SortOption.ASC, ), ], - paginationParams: PaginationParams(limit: 20), onShowMessage: (m, c) async { final client = StreamChat.of(context).client; final message = m; @@ -296,7 +295,6 @@ class _ChatInfoScreenState extends State { direction: SortOption.ASC, ), ], - paginationParams: PaginationParams(limit: 20), onShowMessage: (m, c) async { final client = StreamChat.of(context).client; final message = m; @@ -356,7 +354,6 @@ class _ChatInfoScreenState extends State { direction: SortOption.ASC, ), ], - paginationParams: PaginationParams(limit: 20), ), ), ), @@ -508,7 +505,6 @@ class __SharedGroupsScreenState extends State<_SharedGroupsScreen> { return Scaffold( backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, appBar: AppBar( - brightness: Theme.of(context).brightness, elevation: 1, centerTitle: true, title: Text( diff --git a/packages/stream_chat_v1/lib/group_chat_details_screen.dart b/packages/stream_chat_v1/lib/group_chat_details_screen.dart index 6b89937..df40cc5 100644 --- a/packages/stream_chat_v1/lib/group_chat_details_screen.dart +++ b/packages/stream_chat_v1/lib/group_chat_details_screen.dart @@ -62,7 +62,6 @@ class _GroupChatDetailsScreenState extends State { child: Scaffold( backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, appBar: AppBar( - brightness: Theme.of(context).brightness, elevation: 1, backgroundColor: StreamChatTheme.of(context).colorTheme.barsBg, leading: const StreamBackButton(), diff --git a/packages/stream_chat_v1/lib/group_info_screen.dart b/packages/stream_chat_v1/lib/group_info_screen.dart index 9b1c881..6a06e1e 100644 --- a/packages/stream_chat_v1/lib/group_info_screen.dart +++ b/packages/stream_chat_v1/lib/group_info_screen.dart @@ -93,7 +93,6 @@ class _GroupInfoScreenState extends State { return Scaffold( backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, appBar: AppBar( - brightness: Theme.of(context).brightness, elevation: 1.0, toolbarHeight: 56.0, backgroundColor: StreamChatTheme.of(context).colorTheme.barsBg, @@ -525,7 +524,6 @@ class _GroupInfoScreenState extends State { direction: SortOption.ASC, ), ], - paginationParams: PaginationParams(limit: 20), onShowMessage: (m, c) async { final client = StreamChat.of(context).client; final message = m; @@ -737,9 +735,7 @@ class _GroupInfoScreenState extends State { setState(() {}); }, crossAxisCount: 4, - pagination: PaginationParams( - limit: 25, - ), + limit: 25, filter: Filter.and( [ if (_searchController!.text.isNotEmpty) diff --git a/packages/stream_chat_v1/lib/new_chat_screen.dart b/packages/stream_chat_v1/lib/new_chat_screen.dart index c0829d0..eb247c3 100644 --- a/packages/stream_chat_v1/lib/new_chat_screen.dart +++ b/packages/stream_chat_v1/lib/new_chat_screen.dart @@ -120,7 +120,6 @@ class _NewChatScreenState extends State { return Scaffold( backgroundColor: StreamChatTheme.of(context).colorTheme.appBg, appBar: AppBar( - brightness: Theme.of(context).brightness, elevation: 0, backgroundColor: StreamChatTheme.of(context).colorTheme.barsBg, leading: const StreamBackButton(), @@ -303,9 +302,7 @@ class _NewChatScreenState extends State { _chipInputTextFieldState!.removeItem(user); } }, - pagination: PaginationParams( - limit: 25, - ), + limit: 25, filter: Filter.and([ if (_userNameQuery.isNotEmpty) Filter.autoComplete('name', _userNameQuery), diff --git a/packages/stream_chat_v1/lib/new_group_chat_screen.dart b/packages/stream_chat_v1/lib/new_group_chat_screen.dart index c9c7c08..2d0842a 100644 --- a/packages/stream_chat_v1/lib/new_group_chat_screen.dart +++ b/packages/stream_chat_v1/lib/new_group_chat_screen.dart @@ -244,9 +244,7 @@ class _NewGroupChatScreenState extends State { }); } }, - pagination: PaginationParams( - limit: 25, - ), + limit: 25, filter: Filter.and([ if (_userNameQuery.isNotEmpty) Filter.autoComplete('name', _userNameQuery), diff --git a/packages/stream_chat_v1/lib/notifications_service.dart b/packages/stream_chat_v1/lib/notifications_service.dart index 86d6268..7e32197 100644 --- a/packages/stream_chat_v1/lib/notifications_service.dart +++ b/packages/stream_chat_v1/lib/notifications_service.dart @@ -63,7 +63,8 @@ void showLocalNotification( android: AndroidNotificationDetails( 'message channel', AppLocalizations.of(context).messageChannelName, - AppLocalizations.of(context).messageChannelDescription, + channelDescription: + AppLocalizations.of(context).messageChannelDescription, priority: Priority.high, importance: Importance.high, ), diff --git a/packages/stream_chat_v1/lib/pinned_messages_screen.dart b/packages/stream_chat_v1/lib/pinned_messages_screen.dart index bfbb2f6..a3470bd 100644 --- a/packages/stream_chat_v1/lib/pinned_messages_screen.dart +++ b/packages/stream_chat_v1/lib/pinned_messages_screen.dart @@ -14,7 +14,7 @@ class PinnedMessagesScreen extends StatefulWidget { /// limit: the number of users to return (max is 30) /// offset: the offset (max is 1000) /// message_limit: how many messages should be included to each channel - final PaginationParams? paginationParams; + final PaginationParams paginationParams; /// The builder used when the file list is empty. final WidgetBuilder? emptyBuilder; @@ -26,7 +26,7 @@ class PinnedMessagesScreen extends StatefulWidget { const PinnedMessagesScreen({ required this.messageTheme, this.sortOptions, - this.paginationParams, + this.paginationParams = const PaginationParams(limit: 20), this.emptyBuilder, this.onShowMessage, }); @@ -61,7 +61,6 @@ class _PinnedMessagesScreenState extends State { return Scaffold( backgroundColor: StreamChatTheme.of(context).colorTheme.barsBg, appBar: AppBar( - brightness: Theme.of(context).brightness, elevation: 1, centerTitle: true, title: Text( @@ -156,7 +155,7 @@ class _PinnedMessagesScreenState extends State { true, ), sort: widget.sortOptions, - pagination: widget.paginationParams!.copyWith( + pagination: widget.paginationParams.copyWith( offset: messageSearchBloc.messageResponses?.length ?? 0, ), ), diff --git a/packages/stream_chat_v1/lib/user_mentions_page.dart b/packages/stream_chat_v1/lib/user_mentions_page.dart index b10df76..fa2d834 100644 --- a/packages/stream_chat_v1/lib/user_mentions_page.dart +++ b/packages/stream_chat_v1/lib/user_mentions_page.dart @@ -23,7 +23,7 @@ class UserMentionsPage extends StatelessWidget { direction: SortOption.ASC, ), ], - paginationParams: PaginationParams(limit: 20), + limit: 20, showResultCount: false, emptyBuilder: (_) { return LayoutBuilder( diff --git a/packages/stream_chat_v1/pubspec.yaml b/packages/stream_chat_v1/pubspec.yaml index a42a7bc..b30685d 100644 --- a/packages/stream_chat_v1/pubspec.yaml +++ b/packages/stream_chat_v1/pubspec.yaml @@ -7,25 +7,54 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - flutter_app_badger: ^1.2.0 + flutter_app_badger: ^1.3.0 flutter: sdk: flutter - stream_chat_flutter: ^2.2.0 - stream_chat_persistence: ^2.2.0 - stream_chat_localizations: ^1.1.0 - flutter_local_notifications: ^5.0.0+4 + stream_chat_flutter: + git: + url: https://github.com/GetStream/stream-chat-flutter.git + ref: develop + path: packages/stream_chat_flutter + stream_chat_persistence: + git: + url: https://github.com/GetStream/stream-chat-flutter.git + ref: develop + path: packages/stream_chat_persistence + stream_chat_localizations: + git: + url: https://github.com/GetStream/stream-chat-flutter.git + ref: develop + path: packages/stream_chat_localizations + flutter_local_notifications: ^9.0.0 flutter_svg: ^0.22.0 - flutter_secure_storage: ^4.2.0 + flutter_secure_storage: ^4.2.1 yaml: ^3.1.0 - uuid: ^3.0.4 + uuid: ^3.0.5 streaming_shared_preferences: ^2.0.0 - lottie: ^1.0.1 - collection: ^1.15.0-nullsafety.4 + lottie: ^1.2.1 + collection: ^1.15.0 dev_dependencies: - flutter_launcher_icons: ^0.9.0 + flutter_launcher_icons: ^0.9.2 test: any +dependency_overrides: + stream_chat: + git: + url: https://github.com/GetStream/stream-chat-flutter.git + ref: develop + path: packages/stream_chat + stream_chat_flutter_core: + git: + url: https://github.com/GetStream/stream-chat-flutter.git + ref: develop + path: packages/stream_chat_flutter_core + stream_chat_flutter: + git: + url: https://github.com/GetStream/stream-chat-flutter.git + ref: develop + path: packages/stream_chat_flutter + flutter: assets: - assets/