Skip to content

Proposal: softWrap Property for the TextFormField labelText #53166

Closed

Description

@psygo

Use case

This was originally posted on StackOverflow. Check it out here.

To avoid height changes when receiving error messages, I decided to show the error messages on the labelText. However, the labelText only allows for short error messages, even though there is still space for many more characters.

TextFormField(
  ...
  decoration: InputDecoration(
    labelText: 'min 8 characters allowed',
  ),
),

image

Proposal

I wish there were a way of controlling the amount of characters shown before everything gets replaced by the ellipsis (… or Unicode 2026) character.

This could be achieved through a softWrap property, similar to what's on the TextField. We wouldn't be able to control how many characters are shown, but at least we could explore the full width of the labelText.

The closest I've been able to get to know where the ellipsis is put in is this line, inside the TextPainter class. I've checked out plenty of other related files, but with no success1.


1 This should be related to TextStyle, shouldn't it?

Activity

  1. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: proposalA detailed proposal for a change to Flutter
    on Mar 24, 2020
  2. justinmc commented on Mar 27, 2020

    @justinmc
    Contributor

    The ellipsis behavior in Flutter is a bit weird, see #18761. Is that the same problem you're seeing in the label here? I worry that a new parameter might not fix this without fixing that generic ellipsis issue first.

  3. psygo commented on Mar 30, 2020

    @psygo
    Author

    The workaround mentioned created by @marcglasberg is basically what I wanted to do indeed, though I haven't tested it yet and would like it to be more generic.

  4. justinmc commented on Mar 30, 2020

    @justinmc
    Contributor

    Sounds good. I'll prioritize #18761 and revisit this when that one gets fixed. I hope that workaround helps you out in the meantime.

  5. psygo commented on Mar 30, 2020

    @psygo
    Author

    By the way, how did you find that issue? Was it only by Googling it? Was it by experience with the repo only or do you guys at Google have a more specialized tool for search inside repos?

  6. justinmc commented on Mar 30, 2020

    @justinmc
    Contributor

    No special tool, I just remembered seeing it before, and I had written it down as an issue that I'd like to get fixed. The only search tip I have is to use the labels if it clearly should be related to one of them. There are tons of issues to narrow down, but most of them do have labels now at least.

  7. olfek commented on May 3, 2022

    @olfek

    I need the Text widget softWrap property for TextField, find it hard to believe that something so simple but important is missing.

  8. flutter-triage-bot commented on Mar 7, 2024

    @flutter-triage-bot

    This issue is missing a priority label. Please set a priority label when adding the triaged-design label.

  9. justinmc commented on Mar 7, 2024

    @justinmc
    Contributor

    I'm going to close this since there is a workaround mentioned above, and it hasn't received much attention in the last few years. If anyone still thinks we should implement something like this, please comment and I can reopen, or open a new issue.

  10. github-actions commented on Mar 22, 2024

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  11. locked as resolved and limited conversation to collaborators on Mar 22, 2024
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

    a: text inputEntering text in a text field or keyboard related problemsc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesteam-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions