mirror of
https://github.com/venera-app/venera.git
synced 2025-12-15 06:41:14 +00:00
Fix some gesture conflicts
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:math';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:venera/foundation/app.dart';
|
||||
|
||||
const double _kBackGestureWidth = 20.0;
|
||||
@@ -287,7 +288,11 @@ class _IOSBackGestureDetectorState extends State<IOSBackGestureDetector> {
|
||||
}
|
||||
|
||||
void _handlePointerDown(PointerDownEvent event) {
|
||||
if (widget.enabledCallback()) _recognizer.addPointer(event);
|
||||
if (!widget.enabledCallback()) return;
|
||||
if (widget.fullScreen && _isPointerOverHorizontalScrollable(event)) {
|
||||
return;
|
||||
}
|
||||
_recognizer.addPointer(event);
|
||||
}
|
||||
|
||||
void _handleDragCancel() {
|
||||
@@ -325,6 +330,28 @@ class _IOSBackGestureDetectorState extends State<IOSBackGestureDetector> {
|
||||
_backGestureController!.dragUpdate(
|
||||
_convertToLogical(details.primaryDelta! / context.size!.width));
|
||||
}
|
||||
|
||||
bool _isPointerOverHorizontalScrollable(PointerDownEvent event) {
|
||||
final HitTestResult result = HitTestResult();
|
||||
WidgetsBinding.instance.hitTest(result, event.position);
|
||||
for (final entry in result.path) {
|
||||
final target = entry.target;
|
||||
if (target is RenderViewport) {
|
||||
if (_isAxisHorizontal(target.axisDirection)) {
|
||||
return true;
|
||||
}
|
||||
} else if (target is RenderSliver) {
|
||||
if (_isAxisHorizontal(target.constraints.axisDirection)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool _isAxisHorizontal(AxisDirection direction) {
|
||||
return direction == AxisDirection.left || direction == AxisDirection.right;
|
||||
}
|
||||
}
|
||||
|
||||
class SlidePageTransitionBuilder extends PageTransitionsBuilder {
|
||||
|
||||
@@ -542,6 +542,7 @@ class PageJumpTarget {
|
||||
sourceKey: sourceKey,
|
||||
options: List.from(attributes?["options"] ?? []),
|
||||
),
|
||||
iosFullScreenGesture: false,
|
||||
);
|
||||
} else if (page == "category") {
|
||||
var key = ComicSource.find(sourceKey)!.categoryData!.key;
|
||||
|
||||
@@ -170,6 +170,7 @@ class _SliverSearchResultState extends State<_SliverSearchResult>
|
||||
text: widget.keyword,
|
||||
sourceKey: widget.source.key,
|
||||
),
|
||||
iosFullScreenGesture: false,
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
|
||||
@@ -874,7 +874,10 @@ class _ImageFavoritesState extends State<ImageFavorites> {
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: () {
|
||||
context.to(() => const ImageFavoritesPage());
|
||||
context.to(
|
||||
() => const ImageFavoritesPage(),
|
||||
iosFullScreenGesture: false,
|
||||
);
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -993,7 +996,10 @@ class _ImageFavoritesState extends State<ImageFavorites> {
|
||||
maxCount: maxCount,
|
||||
enableTranslation: displayType != 2,
|
||||
onTap: (text) {
|
||||
context.to(() => ImageFavoritesPage(initialKeyword: text));
|
||||
context.to(
|
||||
() => ImageFavoritesPage(initialKeyword: text),
|
||||
iosFullScreenGesture: false,
|
||||
);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
|
||||
@@ -49,7 +49,10 @@ class _SearchPageState extends State<SearchPage> {
|
||||
void search([String? text]) {
|
||||
if (aggregatedSearch) {
|
||||
context
|
||||
.to(() => AggregatedSearchPage(keyword: text ?? controller.text))
|
||||
.to(
|
||||
() => AggregatedSearchPage(keyword: text ?? controller.text),
|
||||
iosFullScreenGesture: false,
|
||||
)
|
||||
.then((_) => update());
|
||||
} else {
|
||||
context
|
||||
@@ -59,6 +62,7 @@ class _SearchPageState extends State<SearchPage> {
|
||||
sourceKey: searchTarget,
|
||||
options: options,
|
||||
),
|
||||
iosFullScreenGesture: false,
|
||||
)
|
||||
.then((_) => update());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user