diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 6e34cefa..9b203d35 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,5 +1,37 @@ PODS: + - DKImagePickerController/Core (4.2.2): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.2.2) + - DKImagePickerController/PhotoGallery (4.2.2): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.2.2) + - DKPhotoGallery (0.0.14): + - DKPhotoGallery/Core (= 0.0.14) + - DKPhotoGallery/Model (= 0.0.14) + - DKPhotoGallery/Preview (= 0.0.14) + - DKPhotoGallery/Resource (= 0.0.14) + - SDWebImage + - SDWebImageFLPlugin + - DKPhotoGallery/Core (0.0.14): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SDWebImageFLPlugin + - DKPhotoGallery/Model (0.0.14): + - SDWebImage + - SDWebImageFLPlugin + - DKPhotoGallery/Preview (0.0.14): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SDWebImageFLPlugin + - DKPhotoGallery/Resource (0.0.14): + - SDWebImage + - SDWebImageFLPlugin - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery - Flutter - Firebase/Core (6.20.0): - Firebase/CoreOnly @@ -53,6 +85,7 @@ PODS: - GoogleUtilities/Reachability (~> 6.5) - GoogleUtilities/UserDefaults (~> 6.5) - Protobuf (>= 3.9.2, ~> 3.9) + - FLAnimatedImage (1.0.12) - Flutter (1.0.0) - flutter_apns (0.0.1): - Flutter @@ -110,6 +143,12 @@ PODS: - PromisesObjC (1.2.8) - Protobuf (3.11.4) - ReachabilitySwift (4.3.1) + - SDWebImage (5.8.0): + - SDWebImage/Core (= 5.8.0) + - SDWebImage/Core (5.8.0) + - SDWebImageFLPlugin (0.4.0): + - FLAnimatedImage (>= 1.0.11) + - SDWebImage/Core (~> 5.6) - shared_preferences (0.0.1): - Flutter - shared_preferences_macos (0.0.1): @@ -163,6 +202,8 @@ DEPENDENCIES: SPEC REPOS: trunk: + - DKImagePickerController + - DKPhotoGallery - Firebase - FirebaseAnalytics - FirebaseAnalyticsInterop @@ -172,6 +213,7 @@ SPEC REPOS: - FirebaseInstallations - FirebaseInstanceID - FirebaseMessaging + - FLAnimatedImage - FMDB - GoogleAppMeasurement - GoogleDataTransport @@ -182,6 +224,8 @@ SPEC REPOS: - PromisesObjC - Protobuf - ReachabilitySwift + - SDWebImage + - SDWebImageFLPlugin - Starscream EXTERNAL SOURCES: @@ -237,9 +281,11 @@ CHECKOUT OPTIONS: :git: https://github.com/GetStream/stream-chat-swift.git SPEC CHECKSUMS: - file_picker: 408623be2125b79a4539cf703be3d4b3abe5e245 + DKImagePickerController: 4a3e7948a848c4348e600b3fe5ce41478835fa10 + DKPhotoGallery: 0290d32343574f06eaa4c26f8f2f8a1035e916be + file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 Firebase: fe7f74012742ab403451dd283e6909b8f1fb348a - firebase_messaging: cffb57ce40958c6204f03fb0c81713e4cd1e240c + firebase_messaging: 1069878b13fd61e296607e83897aee0ca0fc1f2e FirebaseAnalytics: 572e467f3d977825266e8ccd52674aa3e6f47eac FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae FirebaseCore: ed0a24c758a57c2b88c5efa8e6a8195e868af589 @@ -248,35 +294,38 @@ SPEC CHECKSUMS: FirebaseInstallations: 575cd32f2aec0feeb0e44f5d0110a09e5e60b47b FirebaseInstanceID: 7ee0d6777013bb952f377b41965bf132b6a075be FirebaseMessaging: 4ec33842d36b3319e062e51fb8b35a74f726950d + FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31 Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_apns: f516b118e423fe7c0a38771180549c4d6cb67c2f flutter_keyboard_visibility: 6195387fb6d8f46e5cd6dda4a4154e41f800f545 flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 - flutter_plugin_android_lifecycle: 47de533a02850f070f5696a623995e93eddcdb9b + flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a GoogleAppMeasurement: c29d405ff76e18551b5d158eaba6753fda8c7542 GoogleDataTransport: a857c6a002d201b524dd4bc2ed7e7355ed07e785 GoogleDataTransportCCTSupport: 32f75fbe904c82772fcbb6b6bd4525bfb6f2a862 GoogleUtilities: ad0f3b691c67909d03a3327cc205222ab8f42e0e GzipSwift: 5592f4d62b641e04d06443ba471f8ed76b1363e4 - image_picker: e3eacd46b94694dde7cf2705955cece853aa1a8f + image_picker: 66aa71bc96850a90590a35d4c4a2907b0d823109 moor_ffi: d66c9470c18e9cb333423bbcb493c105c6c774c6 nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd - path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d + path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 PromisesObjC: c119f3cd559f50b7ae681fa59dc1acd19173b7e6 Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7 ReachabilitySwift: 4032e2f59586e11e3b0ebe15b167abdd587a388b + SDWebImage: 84000f962cbfa70c07f19d2234cbfcf5d779b5dc + SDWebImageFLPlugin: 6c2295fb1242d44467c6c87dc5db6b0a13228fd8 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0 Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0 StreamChatClient: a5b5a85b0bcccf3ccb26a6847f110912a8c05e92 - url_launcher: a1c0cc845906122c4784c542523d8cacbded5626 + url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c - video_player: 69c5f029fac4ffe4fc8a85ea7f7b793709661549 + video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e video_player_web: da8cadb8274ed4f8dbee8d7171b420dedd437ce7 wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 141e283a..6083a722 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -11,12 +11,8 @@ 0BC14C54242B5A7A0028DE94 /* Notifications.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 0BC14C4D242B5A7A0028DE94 /* Notifications.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 7DEC2743BD66C91B700A3B97 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BB2E5E4E236267EDF0D8817 /* Pods_Runner.framework */; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -50,8 +46,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -68,7 +62,6 @@ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 2452A9E77396497EB4CF3072 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 68F846A6DB42D92393F5F7E0 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -77,7 +70,6 @@ 8BB2E5E4E236267EDF0D8817 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -97,8 +89,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 7DEC2743BD66C91B700A3B97 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -119,9 +109,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -312,7 +300,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 5702861DACEDB848A3E454E8 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/example/lib/custom_message.dart b/example/lib/custom_message.dart index 4f1aa2ca..e545a168 100644 --- a/example/lib/custom_message.dart +++ b/example/lib/custom_message.dart @@ -36,12 +36,11 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - home: Container( - child: StreamChat( - client: client, - child: ChannelListPage(), - ), + builder: (context, child) => StreamChat( + child: child, + client: client, ), + home: ChannelListPage(), ); } } diff --git a/example/lib/custom_theme.dart b/example/lib/custom_theme.dart index afd32ccb..27b09350 100644 --- a/example/lib/custom_theme.dart +++ b/example/lib/custom_theme.dart @@ -45,23 +45,22 @@ class MyApp extends StatelessWidget { return MaterialApp( theme: theme, - home: Container( - child: StreamChat( - streamChatThemeData: StreamChatThemeData.fromTheme(theme).copyWith( - ownMessageTheme: MessageTheme( - messageBackgroundColor: Colors.black, - messageText: TextStyle( - color: Colors.white, - ), - avatarTheme: AvatarTheme( - borderRadius: BorderRadius.circular(8), - ), + builder: (context, child) => StreamChat( + child: child, + client: client, + streamChatThemeData: StreamChatThemeData.fromTheme(theme).copyWith( + ownMessageTheme: MessageTheme( + messageBackgroundColor: Colors.black, + messageText: TextStyle( + color: Colors.white, + ), + avatarTheme: AvatarTheme( + borderRadius: BorderRadius.circular(8), ), ), - client: client, - child: ChannelListPage(), ), ), + home: ChannelListPage(), ); } } diff --git a/example/lib/customize_channel_preview.dart b/example/lib/customize_channel_preview.dart index 6fcb5765..c7a34a48 100644 --- a/example/lib/customize_channel_preview.dart +++ b/example/lib/customize_channel_preview.dart @@ -41,12 +41,11 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - home: Container( - child: StreamChat( - client: client, - child: ChannelListPage(), - ), + builder: (context, child) => StreamChat( + child: child, + client: client, ), + home: ChannelListPage(), ); } } diff --git a/example/lib/customize_message_widget.dart b/example/lib/customize_message_widget.dart index fa10cf10..58b4149a 100644 --- a/example/lib/customize_message_widget.dart +++ b/example/lib/customize_message_widget.dart @@ -36,11 +36,12 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( + builder: (context, child) => StreamChat( + child: child, + client: client, + ), home: Container( - child: StreamChat( - client: client, - child: ChannelListPage(), - ), + child: ChannelListPage(), ), ); } diff --git a/example/lib/main.dart b/example/lib/main.dart index e170c5d6..f2ae3128 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -95,12 +95,13 @@ class MyApp extends StatelessWidget { theme: ThemeData.light(), darkTheme: ThemeData.dark(), themeMode: ThemeMode.system, - home: Container( - child: StreamChat( + builder: (context, widget) { + return StreamChat( + child: widget, client: client, - child: ChannelListPage(), - ), - ), + ); + }, + home: ChannelListPage(), ); } } diff --git a/example/lib/multiple_conversation.dart b/example/lib/multiple_conversation.dart index 8bffa449..0a6b9131 100644 --- a/example/lib/multiple_conversation.dart +++ b/example/lib/multiple_conversation.dart @@ -40,11 +40,12 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( + builder: (context, child) => StreamChat( + client: client, + child: child, + ), home: Container( - child: StreamChat( - client: client, - child: ChannelListPage(), - ), + child: ChannelListPage(), ), ); } diff --git a/example/lib/threads.dart b/example/lib/threads.dart index 90e605f6..660842db 100644 --- a/example/lib/threads.dart +++ b/example/lib/threads.dart @@ -31,11 +31,12 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( + builder: (context, child) => StreamChat( + child: child, + client: client, + ), home: Container( - child: StreamChat( - client: client, - child: ChannelListPage(), - ), + child: ChannelListPage(), ), ); } diff --git a/lib/src/attachment_title.dart b/lib/src/attachment_title.dart index efa34765..ab9cd2da 100644 --- a/lib/src/attachment_title.dart +++ b/lib/src/attachment_title.dart @@ -46,7 +46,7 @@ class AttachmentTitle extends StatelessWidget { .toList() .reversed .join('.'), - style: messageTheme.createdAt, + style: messageTheme.messageText, ), ], ), diff --git a/lib/src/full_screen_video.dart b/lib/src/full_screen_video.dart index 000f13c1..c30bcfd1 100644 --- a/lib/src/full_screen_video.dart +++ b/lib/src/full_screen_video.dart @@ -21,11 +21,13 @@ class _FullScreenVideoState extends State { ChewieController _chewieController; VideoPlayerController _videoPlayerController; bool initialized = false; + GlobalKey _scaffoldKey = GlobalKey(); @override Widget build(BuildContext context) { return Scaffold( body: Builder( + key: _scaffoldKey, builder: (context) { if (!initialized) { return Center( @@ -60,7 +62,7 @@ class _FullScreenVideoState extends State { errorListener = () { if (_videoPlayerController.value.hasError) { Navigator.pop(context); - launchURL(context, widget.attachment.titleLink); + launchURL(_scaffoldKey.currentContext, widget.attachment.titleLink); } _videoPlayerController.removeListener(errorListener); }; @@ -70,6 +72,7 @@ class _FullScreenVideoState extends State { @override void dispose() { _videoPlayerController.dispose(); + _chewieController.dispose(); super.dispose(); } } diff --git a/lib/src/giphy_attachment.dart b/lib/src/giphy_attachment.dart index 994d2e6e..11e2ea5b 100644 --- a/lib/src/giphy_attachment.dart +++ b/lib/src/giphy_attachment.dart @@ -47,26 +47,31 @@ class GiphyAttachment extends StatelessWidget { ); })); }, - child: CachedNetworkImage( - height: size?.height, - width: size?.width, - placeholder: (_, __) { - return Container( - width: size?.width, - height: size?.height, - child: Center( - child: CircularProgressIndicator(), - ), - ); - }, - imageUrl: attachment.thumbUrl ?? - attachment.imageUrl ?? - attachment.assetUrl, - errorWidget: (context, url, error) => AttachmentError( - attachment: attachment, - size: size, + child: Hero( + tag: attachment.imageUrl ?? + attachment.assetUrl ?? + attachment.thumbUrl, + child: CachedNetworkImage( + height: size?.height, + width: size?.width, + placeholder: (_, __) { + return Container( + width: size?.width, + height: size?.height, + child: Center( + child: CircularProgressIndicator(), + ), + ); + }, + imageUrl: attachment.thumbUrl ?? + attachment.imageUrl ?? + attachment.assetUrl, + errorWidget: (context, url, error) => AttachmentError( + attachment: attachment, + size: size, + ), + fit: BoxFit.cover, ), - fit: BoxFit.cover, ), ), ], @@ -75,6 +80,7 @@ class GiphyAttachment extends StatelessWidget { Container( alignment: Alignment.bottomCenter, child: Material( + color: messageTheme.messageBackgroundColor, child: AttachmentTitle( messageTheme: messageTheme, attachment: attachment, diff --git a/lib/src/image_attachment.dart b/lib/src/image_attachment.dart index d39a8948..f7352564 100644 --- a/lib/src/image_attachment.dart +++ b/lib/src/image_attachment.dart @@ -75,6 +75,7 @@ class ImageAttachment extends StatelessWidget { ), if (attachment.title != null) Material( + color: messageTheme.messageBackgroundColor, child: AttachmentTitle( messageTheme: messageTheme, attachment: attachment, diff --git a/lib/src/message_input.dart b/lib/src/message_input.dart index 1c48070a..09c890a7 100644 --- a/lib/src/message_input.dart +++ b/lib/src/message_input.dart @@ -913,8 +913,6 @@ class MessageInputState extends State { void initState() { super.initState(); - StreamChannel.of(context).queryMembersAndWatchers(); - _keyboardListener = KeyboardVisibility.onChange.listen((visible) { if (visible) { if (_commandsOverlay != null) { diff --git a/lib/src/stream_channel.dart b/lib/src/stream_channel.dart index eb7f4aea..b5ddcd33 100644 --- a/lib/src/stream_channel.dart +++ b/lib/src/stream_channel.dart @@ -50,8 +50,14 @@ class StreamChannelState extends State { /// The stream notifying the state of queryMessage call Stream get queryMessage => _queryMessageController.stream; + bool _paginationEnded = false; + /// Calls [channel.query] updating [queryMessage] stream void queryMessages() { + if (_paginationEnded) { + return; + } + _queryMessageController.add(true); String firstId; @@ -67,6 +73,10 @@ class StreamChannelState extends State { ), ) .then((res) { + print('res.messages.length: ${res.messages.length}'); + if (res.messages.isEmpty) { + _paginationEnded = true; + } _queryMessageController.add(false); }).catchError((e, stack) { _queryMessageController.addError(e, stack); @@ -75,6 +85,10 @@ class StreamChannelState extends State { /// Calls [channel.getReplies] updating [queryMessage] stream Future getReplies(String parentId) async { + if (_paginationEnded) { + return; + } + _queryMessageController.add(true); String firstId; @@ -95,6 +109,9 @@ class StreamChannelState extends State { ), ) .then((res) { + if (res.messages.isEmpty) { + _paginationEnded = true; + } _queryMessageController.add(false); }).catchError((e, stack) { _queryMessageController.addError(e, stack); diff --git a/lib/src/stream_chat.dart b/lib/src/stream_chat.dart index a69b44e0..92394ff0 100644 --- a/lib/src/stream_chat.dart +++ b/lib/src/stream_chat.dart @@ -61,7 +61,6 @@ class StreamChat extends StatefulWidget { /// The current state of the StreamChat widget class StreamChatState extends State with WidgetsBindingObserver { Client get client => widget.client; - final GlobalKey _navigatorKey = GlobalKey(); Timer _disconnectTimer; @override @@ -79,26 +78,7 @@ class StreamChatState extends State with WidgetsBindingObserver { accentColor: streamTheme.accentColor, scaffoldBackgroundColor: streamTheme.backgroundColor, ), - child: WillPopScope( - onWillPop: () async { - if (_navigatorKey.currentState.canPop()) { - _navigatorKey.currentState.pop(); - return false; - } else { - return true; - } - }, - child: Navigator( - initialRoute: '/', - key: _navigatorKey, - onGenerateRoute: (settings) { - return MaterialPageRoute( - settings: settings, - builder: (_) => widget.child, - ); - }, - ), - ), + child: widget.child, ); }, ), diff --git a/lib/src/video_attachment.dart b/lib/src/video_attachment.dart index e81ea220..4f8cb712 100644 --- a/lib/src/video_attachment.dart +++ b/lib/src/video_attachment.dart @@ -149,6 +149,7 @@ class _VideoAttachmentState extends State { @override void dispose() { _videoPlayerController.dispose(); + _chewieController.dispose(); super.dispose(); } }