Skip to content

onTapUp not triggered after app is suspended and re-opened #24658

@miguelcmedeiros

Description

@miguelcmedeiros

Steps to Reproduce

I am seeing the following behaviour when the app is suspended (for instance, when receiving a phone call) during a gesture (long tapping or dragging) and then is re-opened:

  1. Tap down on the following widget -> prints "onTapDown"
  2. Press home button (could be receive phone call)
  3. Re-open app -> "onTapUp" is never printed
class DemoScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) => Center(
        child: Container(
          width: 300.0,
          height: 300.0,
          color: Colors.blue,
          child: Center(
            child: GestureDetector(
              onTapDown: (_) => print('onTapDown'),
              onTapUp: (_) => print('onTapUp'),
              child: Container(
                width: 100.0,
                height: 100.0,
                color: Colors.orange,
              ),
            ),
          ),
        ),
      );
}

This is a problem when you have some behaviour associated with the gesture, like an animation. The consequence here is that once the app is re-opened, the animation will be in the end state, which can be quite strange for the user.

I would expect that on such case, any on-going gesture gets completed. Is this the right expectation?

Flutter doctor

flutter doctor -v
[✓] Flutter (Channel unknown, v0.10.2, on Mac OS X 10.13.6 17G65, locale en-NL)
    • Flutter version 0.10.2 at /Users/user/IdeaProjects/hue_blue/flutter
    • Framework revision d8cbb80206 (4 weeks ago), 2018-10-26 01:30:21 -0400
    • Engine revision 6c2ade9fa2
    • Dart version 2.1.0-dev.8.0.flutter-bf26f760b1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).
      If Android SDK has been installed to a custom location, set $ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.


[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.io/setup/#android-setup for detailed instructions).

[✓] IntelliJ IDEA Community Edition (version 2018.1.6)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 30.0.1
    • Dart plugin version 181.4892.1

[✓] Connected device (1 available)
    • iPhone XS • B74C2265-233F-4EAB-89B5-6850589648EF • ios • iOS 12.1 (simulator)

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions