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

[Bug report] ExtendedTextField 点击段尾巴,光标无法移动到最后,官方的 TextField 可以。 #198

Closed
zjywill opened this issue Feb 27, 2023 · 4 comments

Comments

@zjywill
Copy link

zjywill commented Feb 27, 2023

Version

11.0.0

Platforms

iOS

Device Model

Iphone 14 pro max , ios 16.3.2

flutter info

[✓] Flutter (Channel stable, 3.7.5, on macOS 13.2.1 22D68 darwin-x64, locale en-CN)
    • Flutter version 3.7.5 on channel stable at /Users/zhangjunyi/Develop/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c07f788888 (4 days ago), 2023-02-22 17:52:33 -0600
    • Engine revision 0f359063c4
    • Dart version 2.19.2
    • DevTools version 2.20.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

How to reproduce?

ExtendedTextField 点击段尾巴,光标无法移动到最后,官方的 TextField 可以。

Column(
          children: [
            TextField(
              cursorColor: Theme.of(context).primaryColor,
              textAlignVertical: TextAlignVertical.center,
              textAlign: TextAlign.start,
              controller: controller,
              textCapitalization: TextCapitalization.sentences,
              textInputAction: TextInputAction.send,
              onSubmitted: (value) {
                // FocusScope.of(context).requestFocus(textBox);
                controller.text = "";
              },
            ),
            ExtendedTextField(
              autofocus: true,
              cursorColor: Theme.of(context).primaryColor,
              textAlignVertical: TextAlignVertical.center,
              textAlign: TextAlign.start,
              controller: controller1,
              textCapitalization: TextCapitalization.sentences,
              textInputAction: TextInputAction.send,
              onSubmitted: (value) {
                // FocusScope.of(context).requestFocus(textBox);
                controller.text = "";
              },
            ),
          ],
)

### Logs

_No response_

### Example code (optional)

_No response_

### Contact

_No response_
@zjywill zjywill changed the title [Bug report] [Bug report] ExtendedTextField 点击段尾巴,光标无法移动到最后,官方的 TextField 可以。 Mar 1, 2023
@lnd1992
Copy link

lnd1992 commented Mar 2, 2023

我也遇到这个问题了,什么原因?

@zmtzawqlp
Copy link
Member

好吧。。3.7之后。。去掉了 1.。这官方

@zmtzawqlp
Copy link
Member

3.7 version

  void selectWordEdge({ required SelectionChangedCause cause }) {
    assert(cause != null);
    _computeTextMetricsIfNeeded();
    assert(_lastTapDownPosition != null);
    final TextPosition position = _textPainter.getPositionForOffset(globalToLocal(_lastTapDownPosition! - _paintOffset));
    final TextRange word = _textPainter.getWordBoundary(position);
    late TextSelection newSelection;
    if (position.offset <= word.start) {
      newSelection = TextSelection.collapsed(offset: word.start);
    } else {
      newSelection = TextSelection.collapsed(offset: word.end, affinity: TextAffinity.upstream);
    }
    _setSelection(newSelection, cause);
  }

@zmtzawqlp
Copy link
Member

#191

zmtzawqlp added a commit that referenced this issue Mar 4, 2023
* fix issue on ios after flutter version 3.7.0. #191 #198
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

No branches or pull requests

3 participants