refa image preview

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-02-14 10:16:48 +08:00
parent 8e726f49b2
commit beb7eb1aea
14 changed files with 1935 additions and 2066 deletions

View File

@@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
/// https://github.com/qq326646683/interactiveviewer_gallery
/// A [PageRoute] with a semi transparent background.
///
/// Similar to calling [showDialog] except it can be used with a [Navigator] to
/// show a [Hero] animation.
class HeroDialogRoute<T> extends PageRoute<T> {
HeroDialogRoute({
required this.pageBuilder,
});
final RoutePageBuilder pageBuilder;
@override
bool get opaque => false;
@override
bool get barrierDismissible => true;
@override
String? get barrierLabel => null;
@override
Duration get transitionDuration => const Duration(milliseconds: 300);
@override
bool get maintainState => true;
@override
Color? get barrierColor => null;
@override
Widget buildTransitions(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) {
return FadeTransition(
opacity: animation.drive(CurveTween(curve: Curves.easeOut)),
child: child,
);
}
@override
Widget buildPage(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return Semantics(
scopesRoute: true,
explicitChildNodes: true,
child: pageBuilder(context, animation, secondaryAnimation),
);
}
}