feat: long press no grid do mural abre o viewer de imagem em tela cheia
Toque simples segue abrindo o showModalBottomSheet com o post; long press abre o mesmo ImageViewer das imagens de sala, com pin-to-zoom e deslize entre as midias do mural.
This commit is contained in:
@@ -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<MuralChatView> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 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<void>(
|
||||
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<MuralChatView> {
|
||||
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(
|
||||
|
||||
Reference in New Issue
Block a user