This commit is contained in:
otsmr 2025-05-20 18:50:42 +02:00
parent a7298b74cf
commit 95ad761898
2 changed files with 8 additions and 2 deletions

View file

@ -230,7 +230,7 @@ class ChatListEntry extends StatelessWidget {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) { MaterialPageRoute(builder: (context) {
return MediaViewerView(contact); return MediaViewerView(contact, initialMessage: message);
}), }),
); );
} else if (message.downloadState == DownloadState.pending) { } else if (message.downloadState == DownloadState.pending) {

View file

@ -27,7 +27,9 @@ final _noScreenshot = NoScreenshot.instance;
class MediaViewerView extends StatefulWidget { class MediaViewerView extends StatefulWidget {
final Contact contact; final Contact contact;
const MediaViewerView(this.contact, {super.key}); const MediaViewerView(this.contact, {super.key, this.initialMessage});
final Message? initialMessage;
@override @override
State<MediaViewerView> createState() => _MediaViewerViewState(); State<MediaViewerView> createState() => _MediaViewerViewState();
@ -66,6 +68,10 @@ class _MediaViewerViewState extends State<MediaViewerView> {
void initState() { void initState() {
super.initState(); super.initState();
if (widget.initialMessage != null) {
allMediaFiles = [widget.initialMessage!];
}
asyncLoadNextMedia(true); asyncLoadNextMedia(true);
} }