-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Upgraded Flutter from version 1.20.x to 1.22.x, now when using a stylus what used to registrer as tap gestures are often registrered as drag/pan.
Everything works fine when using fingers. Downgrading fixes it.
Seems to be an issue on both Android (Nvidia Shield with stylus) and iOS (iPad with Apple pencil).
@jonahwilliams mentioned in discord that he has changed the touch thresholds for stylus pointer types and that changing https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/gestures/constants.dart#L99 may fix the issue.
I might try fixing the problem when I get time.
Steps to Reproduce
Using the following code and tapping with a stylus inside the red container:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Scaffold(
body: GestureDetector(
onTap: () => print('ON TAP'),
onPanStart: (_) => print('ON PAN'),
child: Container(color: Colors.red, height: 500, width: 500)),
),
);
}
}
Expected results:
Flutter version 1.20.4 on the Nvidia tablet I get the expect output when tapping:
I/flutter (30919): ON TAP
I/flutter (30919): ON TAP
I/flutter (30919): ON TAP
I/flutter (30919): ON TAP
I/flutter (30919): ON TAP
Actual results:
Flutter version 1.22.1:
I/flutter (30625): ON PAN
I/flutter (30625): ON TAP
I/flutter (30625): ON TAP
I/flutter (30625): ON PAN
I/flutter (30625): ON PAN
Logs
[✓] Flutter (Channel stable, 1.22.1, on Linux, locale en_US.UTF-8)
• Flutter version 1.22.1 at /opt/flutter
• Framework revision f30b7f4db9 (3 days ago), 2020-10-08 10:06:30 -0700
• Engine revision 75bef9f6c8
• Dart version 2.10.1
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /home/mrb/Android/Sdk
• Platform android-29, build-tools 28.0.3
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Android Studio (version 4.0)
• Android Studio at /opt/android-studio
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[!] IntelliJ IDEA Community Edition (version 2019.3)
• IntelliJ at /usr/share/idea
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[!] IntelliJ IDEA Ultimate Edition (version 2019.2)
• IntelliJ at /opt/intellij-idea-ultimate-edition
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• For information about installing plugins, see
https://flutter.dev/intellij-setup/#installing-the-plugins
[✓] Connected device (1 available)
• SHIELD Tablet (mobile) • 04249146051820029c2c • android-arm • Android 7.0 (API 24)
! Doctor found issues in 2 categories.