opt gesture

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-02-15 17:16:24 +08:00
parent 85292a3df2
commit 2c0597175d
3 changed files with 54 additions and 39 deletions

View File

@@ -117,7 +117,7 @@ class _GalleryViewerState extends State<GalleryViewer>
final gestureSettings = MediaQuery.maybeGestureSettingsOf(Get.context!);
_tapGestureRecognizer = ImageTapGestureRecognizer()
..onTap = _onTap
// ..onTap = _onTap
..gestureSettings = gestureSettings;
if (PlatformUtils.isDesktop) {
_tapGestureRecognizer.onSecondaryTapUp = _showDesktopMenu;
@@ -127,6 +127,12 @@ class _GalleryViewerState extends State<GalleryViewer>
..onLongPress = _onLongPress
..gestureSettings = gestureSettings;
Future.delayed(const Duration(milliseconds: 410), () {
if (mounted) {
_tapGestureRecognizer.onTap = _onTap;
}
});
_animateController = AnimationController(
duration: const Duration(milliseconds: 300),
vsync: this,
@@ -244,6 +250,8 @@ class _GalleryViewerState extends State<GalleryViewer>
child: DecoratedBoxTransition(
decoration: _opacityAnimation,
child: Stack(
fit: .expand,
alignment: .center,
clipBehavior: .none,
children: [
LayoutBuilder(
@@ -566,28 +574,25 @@ class _GalleryViewerState extends State<GalleryViewer>
Widget child,
ImageChunkEvent? loadingProgress,
) {
if (loadingProgress != null) {
if (loadingProgress.cumulativeBytesLoaded !=
loadingProgress.expectedTotalBytes &&
loadingProgress.expectedTotalBytes != null) {
return Stack(
fit: .expand,
alignment: .center,
clipBehavior: .none,
children: [
child,
Center(
child: LoadingIndicator(
size: 39.4,
progress:
loadingProgress.cumulativeBytesLoaded /
loadingProgress.expectedTotalBytes!,
),
return Stack(
fit: .expand,
alignment: .center,
clipBehavior: .none,
children: [
child,
if (loadingProgress != null &&
loadingProgress.expectedTotalBytes != null &&
loadingProgress.cumulativeBytesLoaded !=
loadingProgress.expectedTotalBytes)
Center(
child: LoadingIndicator(
size: 39.4,
progress:
loadingProgress.cumulativeBytesLoaded /
loadingProgress.expectedTotalBytes!,
),
],
);
}
}
return child;
),
],
);
}
}