Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR addresses a bug where pressable buttons get stuck in pressed state when testing on Linux desktop by implementing a fallback gesture detection mechanism. The solution introduces a CustomGestureDetector that wraps the standard GestureDetector with additional pointer event handling specifically for Linux platforms.
Key changes:
- Created
CustomGestureDetectorwith platform-specific pointer event fallback for Linux - Replaced
GestureDetectorwithCustomGestureDetectorin all pressable widgets - Added proper gesture state tracking to prevent duplicate event handling
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/src/custom_gesture_detector.dart | New widget implementing hybrid gesture detection with Linux-specific pointer event fallback |
| lib/src/scale.dart | Updated to use CustomGestureDetector instead of GestureDetector |
| lib/src/opacity.dart | Updated to use CustomGestureDetector instead of GestureDetector |
| lib/src/builder.dart | Updated to use CustomGestureDetector instead of GestureDetector |
| lib/pressable.dart | Added export for the new CustomGestureDetector class |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| bool get _needsPointerFallback => | ||
| defaultTargetPlatform == TargetPlatform.linux; |
There was a problem hiding this comment.
[nitpick] Consider making the platform check configurable rather than hardcoded. This would allow easier testing and future platform support without code changes. You could add a constructor parameter like enablePointerFallback with a default value based on the platform check.
When testing on linux desktop, I noticed the buttons get stuck in pressed state after holding them a few seconds.
Trying to solve it by adding additional Listener on linux platorm to catch pointers up, down and cancel.