Skip to content

Support linux desktop tap events#2

Open
MartinMacek wants to merge 2 commits intomainfrom
feature/handle-linux-tap-events
Open

Support linux desktop tap events#2
MartinMacek wants to merge 2 commits intomainfrom
feature/handle-linux-tap-events

Conversation

@MartinMacek
Copy link
Collaborator

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CustomGestureDetector with platform-specific pointer event fallback for Linux
  • Replaced GestureDetector with CustomGestureDetector in 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.

Comment on lines +43 to +44
bool get _needsPointerFallback =>
defaultTargetPlatform == TargetPlatform.linux;
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants