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