diff --git a/lib/features/chat/presentation/pages/photo_view_screen.dart b/lib/features/chat/presentation/pages/photo_view_screen.dart index 260c051d..886b815a 100644 --- a/lib/features/chat/presentation/pages/photo_view_screen.dart +++ b/lib/features/chat/presentation/pages/photo_view_screen.dart @@ -11,7 +11,7 @@ import 'package:photo_view/photo_view_gallery.dart'; import 'package:url_launcher/url_launcher.dart'; class PhotoViewScreen extends StatefulWidget { - final List imageUrls; + final List imageUrls; final int index; final bool isLocal; @@ -50,14 +50,12 @@ class _PhotoViewScreenState extends State { ), scrollPhysics: const BouncingScrollPhysics(), builder: (BuildContext context, int index) { + final imageProvider = widget.isLocal + ? FileImage(widget.imageUrls[index]) as ImageProvider + : CachedNetworkImageProvider(widget.imageUrls[index]) as ImageProvider; + return PhotoViewGalleryPageOptions( - imageProvider: widget.isLocal - ? FileImage( - File(widget.imageUrls[index]), - ) as ImageProvider - : CachedNetworkImageProvider( - widget.imageUrls[index], - ), + imageProvider: imageProvider, initialScale: PhotoViewComputedScale.contained, minScale: PhotoViewComputedScale.contained, heroAttributes: PhotoViewHeroAttributes( diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index d2f5f1bd..60a31c44 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -110,7 +110,7 @@ class ChatBubbleWidget extends StatelessWidget { onTap: () { context.pushTransparentRoute( PhotoViewScreen( - imageUrls: mediaData.map((e) => '$e').toList(), + imageUrls: mediaData, index: index, isLocal: mediaData[index] is File ? true : false, ),