diff --git a/lib/pages/mural/mural_chat_page.dart b/lib/pages/mural/mural_chat_page.dart index e2599ea..6044e52 100644 --- a/lib/pages/mural/mural_chat_page.dart +++ b/lib/pages/mural/mural_chat_page.dart @@ -14,6 +14,7 @@ import 'package:tatchat/config/themes.dart'; import 'package:tatchat/l10n/l10n.dart'; import 'package:tatchat/pages/chat/send_file_dialog.dart'; import 'package:tatchat/pages/chat/sticker_picker_dialog.dart'; +import 'package:tatchat/pages/image_viewer/image_viewer.dart'; import 'package:tatchat/pages/image_viewer/video_player.dart'; import 'package:tatchat/utils/adaptive_bottom_sheet.dart'; import 'package:tatchat/utils/matrix_sdk_extensions/matrix_locals.dart'; @@ -306,6 +307,19 @@ class _MuralChatViewState extends State { ); } + /// Long press on a grid cell: open the same fullscreen viewer a room image + /// uses, instead of the bottom sheet, so pinch-to-zoom and swiping between + /// the media of the mural are available there too. + void _openMediaFullscreen(Event event) { + final timeline = this.timeline; + if (timeline == null) return; + showDialog( + context: context, + builder: (_) => + ImageViewer(event, timeline: timeline, outerContext: context), + ); + } + @override Widget build(BuildContext context) { final theme = Theme.of(context); @@ -395,6 +409,7 @@ class _MuralChatViewState extends State { client: room.client, cellSize: gridCellSize, onTap: () => _openMedia(event), + onLongPress: () => _openMediaFullscreen(event), ); }, ), @@ -656,12 +671,14 @@ class _MediaCell extends StatelessWidget { final Client client; final double cellSize; final VoidCallback onTap; + final VoidCallback onLongPress; const _MediaCell({ required this.event, required this.client, required this.cellSize, required this.onTap, + required this.onLongPress, }); @override @@ -678,6 +695,7 @@ class _MediaCell extends StatelessWidget { : null; return GestureDetector( onTap: onTap, + onLongPress: onLongPress, child: ColoredBox( color: theme.colorScheme.surfaceContainerHighest, child: Stack(