mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: image preview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:PiliPalaX/pages/preview/view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_navigation/src/dialog/dialog_route.dart';
|
||||
|
||||
extension ImageExtension on num {
|
||||
int cacheSize(BuildContext context) {
|
||||
@@ -61,4 +63,29 @@ extension BuildContextExt on BuildContext {
|
||||
? const Color(0xFFFF6699)
|
||||
: const Color(0xFFD44E7D);
|
||||
}
|
||||
|
||||
void imageView({
|
||||
int? initialPage,
|
||||
required List<String> imgList,
|
||||
}) {
|
||||
Navigator.of(this).push(
|
||||
GetDialogRoute(
|
||||
pageBuilder: (buildContext, animation, secondaryAnimation) {
|
||||
return ImagePreview(
|
||||
initialPage: initialPage ?? 0,
|
||||
imgList: imgList,
|
||||
);
|
||||
},
|
||||
transitionDuration: const Duration(milliseconds: 300),
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
var tween = Tween(begin: 0.0, end: 1.0)
|
||||
.chain(CurveTween(curve: Curves.linear));
|
||||
return FadeTransition(
|
||||
opacity: animation.drive(tween),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user