Skip to content

Add prefixIcon and suffixIcon parameters to InputDecoration.collapsed #61331

Closed

Description

@d-apps

InputDecoration has a lot of parameters that helps us to customize TextField and TextFormField.

image

when using InputDecoration.collapsed, it's missing a lot of parameters that could help us to customize more easily the widget.

image

I would like to request if is it possible to add at least this two parameters: prefixIcon and suffixIcon.

Thank you.

Activity

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

    @justinmc
    Contributor

    @HansMuller Any idea if prefix and suffix were intentionally disabled for InputDecoration.collapsed?

    @d-apps Keep in mind that you can achieve the same thing by passing isCollapsed: true to the default InputDecoration constructor.

  4. bleroux commented on Jul 12, 2024

    @bleroux
    Contributor

    @justinmc
    I’m looking at InputDecoration.isCollapsed, InputDecoration.isDense and InputDecoration.contentPadding. I read some previous discussions on this topic, for instance #46160 (comment).

    To summarize the history behind isCollapsed :

    • InputDecoration.collapsed was added long ago in Rationalize text input widgets #9119. And the isCollapsed property was not exposed in the default constructor.
    • In Text field height fix #55911, the isCollapsed property was added to the default constructor which gave more flexibility but also opened up to many bogus cases (because there are no asserts to restrict its usage, for instance it is valid to set isCollapsed to true while providing a label, but it will render badly).

    The less disruptive way to go is probably to consider adding checks (assert) to the default InputDecoration constructors (might be tricky because some people perhaps rely on the current flexibility) and to try to adapt the rendering logic to use cases that we find acceptable (for instance, specifying prefix/suffix icons for a collapsed decoration).

    This might increase even more the complexity of the rendering logic but It looks like we can’t afford to get back to the more restricted constructor (this kind of constructor is interesting because its signature clearly states the expected restrictions and it is also a clear entry point where the feature can be documented. But because one can bypass the constructor restriction by using copyWith it is not a complete solution ).

  5. flutter-triage-bot commented on Jul 13, 2024

    @flutter-triage-bot

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

  6. justinmc commented on Jul 18, 2024

    @justinmc
    Contributor

    @bleroux Exposing isCollapsed may have been a bad idea, I'm on board with removing it if we can get away with it.

  7. added and removed
    team-designOwned by Design Languages team
    on Jul 18, 2024
  8. github-actions commented on Aug 8, 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.

  9. locked as resolved and limited conversation to collaborators on Aug 8, 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/packagesr: invalidIssue is closed as not validteam-text-inputOwned by Text Input team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions