1
0
Fork 0
forked from Nexus/nexus

improved expandable image widget

This commit is contained in:
Henry Hiles 2026-06-13 18:31:14 -04:00
commit 18657eb980
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -1,7 +1,7 @@
import "dart:math";
import "package:cross_cache/cross_cache.dart";
import "package:flutter/material.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:m3e_buttons/m3e_buttons.dart";
import "package:nexus/controllers/cross_cache_controller.dart";
import "package:nexus/helpers/extensions/get_headers.dart";
import "package:nexus/widgets/error_dialog.dart";
@ -17,16 +17,21 @@ class ExpandableImage extends ConsumerWidget {
? null
: () => showDialog(
context: context,
builder: (_) => LayoutBuilder(
builder: (context, constraints) => Dialog(
backgroundColor: Colors.transparent,
insetPadding: .all(constraints.maxWidth / 100),
child: InteractiveViewer(
maxScale: 5,
child: ConstrainedBox(
constraints: .new(
minWidth: min(constraints.maxWidth, 1000),
builder: (_) => Stack(
children: [
Align(
alignment: .topRight,
child: Padding(
padding: .all(32),
child: M3EButton(
onPressed: Navigator.of(context).pop,
child: Icon(Icons.close),
),
),
),
Center(
child: InteractiveViewer(
maxScale: 10,
child: Image(
fit: .contain,
errorBuilder: (_, error, stackTrace) => ErrorDialog(
@ -41,7 +46,7 @@ class ExpandableImage extends ConsumerWidget {
),
),
),
),
],
),
),
child: child,