Skip to content

Conversation

@SuhwanCha
Copy link
Contributor

@SuhwanCha SuhwanCha commented Jan 11, 2022

Fixes #96453

This PR fixes bugs that text selection located wrong position when selecting multiple lines over max lines.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

image

@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jan 11, 2022
@skia-gold
Copy link

Gold has detected about 2 new digest(s) on patchset 2.
View them at https://flutter-gold.skia.org/cl/github/96471

@skia-gold
Copy link

Gold has detected about 2 new digest(s) on patchset 3.
View them at https://flutter-gold.skia.org/cl/github/96471

@SuhwanCha SuhwanCha marked this pull request as ready for review January 12, 2022 02:37
@HansMuller HansMuller requested a review from chunhtai January 14, 2022 22:49
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@chunhtai chunhtai requested a review from justinmc January 21, 2022 19:00
@chunhtai
Copy link
Contributor

cc @justinmc for one more approval

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

This doesn't seem to work in every case. I tried it when the field is vertically centered in the app and the toolbar shows up in the wrong place:

Screen Shot 2022-01-27 at 1 41 13 PM

Code
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Demo'),
        ),
        body: const Center(
          child: TextField(
            maxLines: 2,
          ),
        ),
      ),
    );
  }
}

Unfortunately our existing tests didn't catch that.

@justinmc
Copy link
Contributor

@SuhwanCha I'm going to close this since it's been stale for awhile and has merge conflicts. If you still want to fix this bug, feel free to let me know and I'm happy to help with reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Text selection toolbar offset bound to global position of the text

4 participants