forked from Nexus/nexus
Compare commits
No commits in common. "2d0f41000ed81194468a41b44e5970eb9fcd487f" and "b4b157c39f5a95acc090a6ef529ebe70ece0cb75" have entirely different histories.
2d0f41000e
...
b4b157c39f
1 changed files with 21 additions and 30 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,39 +17,30 @@ class ExpandableImage extends ConsumerWidget {
|
|||
? null
|
||||
: () => showDialog(
|
||||
context: context,
|
||||
builder: (_) => SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: Navigator.of(context).pop,
|
||||
child: InteractiveViewer(
|
||||
maxScale: 10,
|
||||
child: Image(
|
||||
errorBuilder: (_, error, stackTrace) => ErrorDialog(
|
||||
"Loading failed for $source\nError: $error",
|
||||
stackTrace,
|
||||
),
|
||||
image: CachedNetworkImage(
|
||||
source!,
|
||||
ref.watch(CrossCacheController.provider),
|
||||
headers: ref.headers,
|
||||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
child: Image(
|
||||
fit: .contain,
|
||||
errorBuilder: (_, error, stackTrace) => ErrorDialog(
|
||||
"Loading failed for $source\nError: $error",
|
||||
stackTrace,
|
||||
),
|
||||
image: CachedNetworkImage(
|
||||
source!,
|
||||
ref.watch(CrossCacheController.provider),
|
||||
headers: ref.headers,
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: .topRight,
|
||||
child: Padding(
|
||||
padding: .all(32),
|
||||
child: M3EButton(
|
||||
onPressed: Navigator.of(context).pop,
|
||||
child: Icon(Icons.close),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue