chore: Make imageviewer full window

pull/1323/merge
krille-chan 5 months ago
parent 9855edabcd
commit 838dcb413e
No known key found for this signature in database

@ -60,7 +60,6 @@ class ImageBubble extends StatelessWidget {
if (!tapToView) return; if (!tapToView) return;
showDialog( showDialog(
context: context, context: context,
useRootNavigator: false,
builder: (_) => ImageViewer(event), builder: (_) => ImageViewer(event),
); );
} }

@ -14,38 +14,55 @@ class ImageViewerView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: Colors.black, backgroundColor: Colors.black.withOpacity(0.5),
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: AppBar( appBar: AppBar(
elevation: 0, elevation: 0,
leading: IconButton( leading: IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
),
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: Navigator.of(context).pop, onPressed: Navigator.of(context).pop,
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.close, tooltip: L10n.of(context)!.close,
), ),
backgroundColor: const Color(0x44000000), backgroundColor: Colors.transparent,
actions: [ actions: [
IconButton( IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
),
icon: const Icon(Icons.reply_outlined), icon: const Icon(Icons.reply_outlined),
onPressed: controller.forwardAction, onPressed: controller.forwardAction,
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.share, tooltip: L10n.of(context)!.share,
), ),
const SizedBox(width: 8),
IconButton( IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.black.withOpacity(0.5),
),
icon: const Icon(Icons.download_outlined), icon: const Icon(Icons.download_outlined),
onPressed: () => controller.saveFileAction(context), onPressed: () => controller.saveFileAction(context),
color: Colors.white, color: Colors.white,
tooltip: L10n.of(context)!.downloadFile, tooltip: L10n.of(context)!.downloadFile,
), ),
const SizedBox(width: 8),
if (PlatformInfos.isMobile) if (PlatformInfos.isMobile)
// Use builder context to correctly position the share dialog on iPad // Use builder context to correctly position the share dialog on iPad
Builder( Padding(
builder: (context) => IconButton( padding: const EdgeInsets.only(right: 8.0),
onPressed: () => controller.shareFileAction(context), child: Builder(
tooltip: L10n.of(context)!.share, builder: (context) => IconButton(
color: Colors.white, style: IconButton.styleFrom(
icon: Icon(Icons.adaptive.share_outlined), backgroundColor: Colors.black.withOpacity(0.5),
),
onPressed: () => controller.shareFileAction(context),
tooltip: L10n.of(context)!.share,
color: Colors.white,
icon: Icon(Icons.adaptive.share_outlined),
),
), ),
), ),
], ],

@ -64,7 +64,8 @@ class _MxcImageState extends State<MxcImage> {
} }
Future<void> _load() async { Future<void> _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 uri = widget.uri;
final event = widget.event; final event = widget.event;

Loading…
Cancel
Save