From 838dcb413e2d66ce56966e490bb2d5e612cf9617 Mon Sep 17 00:00:00 2001 From: krille-chan Date: Sun, 22 Sep 2024 09:38:57 +0200 Subject: [PATCH] chore: Make imageviewer full window --- lib/pages/chat/events/image_bubble.dart | 1 - lib/pages/image_viewer/image_viewer_view.dart | 33 ++++++++++++++----- lib/widgets/mxc_image.dart | 3 +- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/pages/chat/events/image_bubble.dart b/lib/pages/chat/events/image_bubble.dart index 3ee745eeb..9dbdceb04 100644 --- a/lib/pages/chat/events/image_bubble.dart +++ b/lib/pages/chat/events/image_bubble.dart @@ -60,7 +60,6 @@ class ImageBubble extends StatelessWidget { if (!tapToView) return; showDialog( context: context, - useRootNavigator: false, builder: (_) => ImageViewer(event), ); } diff --git a/lib/pages/image_viewer/image_viewer_view.dart b/lib/pages/image_viewer/image_viewer_view.dart index e4352864f..fd04183e4 100644 --- a/lib/pages/image_viewer/image_viewer_view.dart +++ b/lib/pages/image_viewer/image_viewer_view.dart @@ -14,38 +14,55 @@ class ImageViewerView extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.black, + backgroundColor: Colors.black.withOpacity(0.5), extendBodyBehindAppBar: true, appBar: AppBar( elevation: 0, leading: IconButton( + style: IconButton.styleFrom( + backgroundColor: Colors.black.withOpacity(0.5), + ), icon: const Icon(Icons.close), onPressed: Navigator.of(context).pop, color: Colors.white, tooltip: L10n.of(context)!.close, ), - backgroundColor: const Color(0x44000000), + backgroundColor: Colors.transparent, actions: [ IconButton( + style: IconButton.styleFrom( + backgroundColor: Colors.black.withOpacity(0.5), + ), icon: const Icon(Icons.reply_outlined), onPressed: controller.forwardAction, color: Colors.white, tooltip: L10n.of(context)!.share, ), + const SizedBox(width: 8), IconButton( + style: IconButton.styleFrom( + backgroundColor: Colors.black.withOpacity(0.5), + ), icon: const Icon(Icons.download_outlined), onPressed: () => controller.saveFileAction(context), color: Colors.white, tooltip: L10n.of(context)!.downloadFile, ), + const SizedBox(width: 8), if (PlatformInfos.isMobile) // Use builder context to correctly position the share dialog on iPad - Builder( - builder: (context) => IconButton( - onPressed: () => controller.shareFileAction(context), - tooltip: L10n.of(context)!.share, - color: Colors.white, - icon: Icon(Icons.adaptive.share_outlined), + Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Builder( + builder: (context) => IconButton( + style: IconButton.styleFrom( + backgroundColor: Colors.black.withOpacity(0.5), + ), + onPressed: () => controller.shareFileAction(context), + tooltip: L10n.of(context)!.share, + color: Colors.white, + icon: Icon(Icons.adaptive.share_outlined), + ), ), ), ], diff --git a/lib/widgets/mxc_image.dart b/lib/widgets/mxc_image.dart index d776cfc82..bf007f530 100644 --- a/lib/widgets/mxc_image.dart +++ b/lib/widgets/mxc_image.dart @@ -64,7 +64,8 @@ class _MxcImageState extends State { } Future _load() async { - final client = widget.client ?? Matrix.of(context).client; + final client = + widget.client ?? widget.event?.room.client ?? Matrix.of(context).client; final uri = widget.uri; final event = widget.event;