forked from Nexus/nexus
improved expandable image widget
This commit is contained in:
parent
b4b157c39f
commit
18657eb980
1 changed files with 16 additions and 11 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue