Sitelet https://github.com/flutter/flutter/issues/139201
Skip to content

TextField with TextAlign.right throws Failed assertion: line 206 pos 12: 'isValid': is not true. #139201

Description

@optimisme

Is there an existing issue for this?

Steps to reproduce

Create a CupertinoTextField object with TextAlign.right, enter a text with several letters, and press the up and down keys to go to the beginning or end of the text.

Expected results

The cursor moving at the beginning or end of the text.

Actual results

This message:

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following assertion was thrown during method call TextInputClient.performSelectors:
'package:flutter/src/rendering/editable.dart': Failed assertion: line 206 pos 12: 'isValid': is not
true.

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.yml

When the exception was thrown, this was the stack:
#2      VerticalCaretMovementRun.movePrevious (package:flutter/src/rendering/editable.dart:206:12)
#3      _UpdateTextSelectionVerticallyAction.invoke (package:flutter/src/widgets/editable_text.dart:5557:61)
#4      _OverridableContextAction.invokeDefaultAction (package:flutter/src/widgets/actions.dart:1811:28)
#5      _OverridableActionMixin.invoke (package:flutter/src/widgets/actions.dart:1676:9)
#6      Action._invoke (package:flutter/src/widgets/actions.dart:336:19)
#7      ActionDispatcher.invokeAction (package:flutter/src/widgets/actions.dart:641:19)
#8      Actions.invoke.<anonymous closure> (package:flutter/src/widgets/actions.dart:963:48)
#9      Actions._visitActionsAncestors (package:flutter/src/widgets/actions.dart:745:18)
#10     Actions.invoke (package:flutter/src/widgets/actions.dart:957:30)
#11     EditableTextState.performSelector (package:flutter/src/widgets/editable_text.dart:4347:17)
#12     ListBase.forEach (dart:collection/list.dart:51:13)
#13     TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:1880:19)
#14     TextInput._loudlyHandleTextInputInvocation (package:flutter/src/services/text_input.dart:1759:20)
#15     MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:559:55)
#16     MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:552:34)
#17     _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:567:35)
#18     _invoke2 (dart:ui/hooks.dart:344:13)
#19     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:45:5)
#20     _Channel.push (dart:ui/channel_buffers.dart:135:31)
#21     ChannelBuffers.push (dart:ui/channel_buffers.dart:343:17)
#22     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:722:22)
#23     _dispatchPlatformMessage (dart:ui/hooks.dart:257:31)
(elided 2 frames from class _AssertionError)

Code sample

Code sample
CupertinoTextField(
      textAlign: TextAlign.right,
      controller: widget.controller,
    )

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.16.1, on macOS 14.0 23A344 darwin-arm64, locale en-ES)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.84.2)
[✓] VS Code (version 1.85.0-insider)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consolefound in release: 3.16Found to occur in 3.16found in release: 3.17Found to occur in 3.17has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cupertino_uicupertino_ui package in flutter/packagesp: material_uimaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.team-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions