Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextField in a ListView becomes unresponsive #123734

Merged
merged 3 commits into from Mar 31, 2023

Conversation

justinmc
Copy link
Contributor

@justinmc justinmc commented Mar 30, 2023

Partial fix for #102084, along with #123055.

An error (Null check operator) was being swallowed related to that setup of a TapAndDragGestureRecognizer nested in another GestureDetector. This app can reproduce it:

import 'package:flutter/material.dart';

final buggyTextEditingController = TextEditingController(text: 'Keep scrolling while I have an active cursor.');
int activePointers = 0;
void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        body: Center(
          child: RawGestureDetector(
            gestures: {
              TapAndDragGestureRecognizer: GestureRecognizerFactoryWithHandlers<TapAndDragGestureRecognizer>(
                () => TapAndDragGestureRecognizer(),
                (TapAndDragGestureRecognizer instance) {
                  instance.onTapDown = (TapDragDownDetails? details) {
                    print('justin onTapDown in app');
                  };
                },
              ),
            },
            child: Container(
              width: 200.0,
              height: 100.0,
              color: Colors.red,
            ),
          ),
        ),
      ),
    ),
  );
}

Drag the red box horizontally, then try tapping it. An error is logged.

This PR fixes the error.

The other PR #123055 fixes some state getting mixed up between the drag and the tap that prevented the tap from being accepted.

@justinmc justinmc self-assigned this Mar 30, 2023
@flutter-dashboard flutter-dashboard bot added f: gestures flutter/packages/flutter/gestures repository. framework flutter/packages/flutter repository. See also f: labels. labels Mar 30, 2023
This reverts commit 4641fc2.

This will be fixed in another PR, so this PR will only include the null
check error fix from the first commit.
@justinmc justinmc marked this pull request as ready for review March 30, 2023 23:59
Copy link
Contributor

@Renzo-Olivares Renzo-Olivares left a comment

Choose a reason for hiding this comment

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

LGTM

@Renzo-Olivares Renzo-Olivares added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 31, 2023
@auto-submit auto-submit bot merged commit d5e25f2 into flutter:master Mar 31, 2023
71 checks passed
@justinmc justinmc deleted the drag-freeze branch March 31, 2023 21:58
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 1, 2023
exaby73 pushed a commit to NevercodeHQ/flutter that referenced this pull request Apr 17, 2023
TextField in a ListView becomes unresponsive
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App f: gestures flutter/packages/flutter/gestures repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants