opt scroll view

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-14 09:21:06 +08:00
parent 4de43faa2e
commit f9441db232
121 changed files with 4536 additions and 126 deletions

View File

@@ -0,0 +1,39 @@
import 'package:flutter/gestures.dart'
show VerticalDragGestureRecognizer, PointerEvent, RecognizerCallback;
typedef IsDyAllowed = bool Function(double dy);
class CustomVerticalDragGestureRecognizer
extends VerticalDragGestureRecognizer {
CustomVerticalDragGestureRecognizer({
super.debugOwner,
super.supportedDevices,
super.allowedButtonsFilter,
});
IsDyAllowed? isDyAllowed;
bool _isDyAllowed = false;
@override
bool isPointerAllowed(PointerEvent event) {
_isDyAllowed = isDyAllowed?.call(event.localPosition.dy) ?? true;
return super.isPointerAllowed(event);
}
@override
T? invokeCallback<T>(
String name,
RecognizerCallback<T> callback, {
String Function()? debugReport,
}) {
if (!_isDyAllowed) return null;
return super.invokeCallback(name, callback, debugReport: debugReport);
}
@override
void dispose() {
isDyAllowed = null;
super.dispose();
}
}