You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[docs] InputDecoration.enabled should explain how it interacts with suffixIcon #167713
If I have a TextField widget that uses a suffixIcon, but the text field has enabled: false, the suffixIcon is not interactable, even though it has an onPressed set.
Let the suffix icon handle its enabled state separately from the text field's enabled state. Maybe by allowing it to read the enabled state separately from the InputDecoration, without looking at TextField.enabled ?
A valid workaround seems to be setting both readOnly and enableInteractiveSelection while keeping the text field enabled.
Maybe we should just document this instead? The docs for TextField.enabled say the following:
If non-null this property overrides the [decoration]'s [InputDecoration.enabled] property.
but as mentioned in the OP, the InputDecoration.enabled docs do not mention the suffix icon.
changed the title [-]Allow enabled suffix button when the text field is disabled[/-][+][docs] InputDecoration.enabled should explain how it interacts with suffixIcon[/+]on Apr 24, 2025
@navaronbracke If you want to use a suffixIcon with an onPressed action while the TextFormField is disabled, you can use the readOnly property instead. This way, the text field remains non-editable, but the suffixIcon stays interactive.
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.
Activity
navaronbracke commentedon Apr 24, 2025
A valid workaround seems to be setting both
readOnlyandenableInteractiveSelectionwhile keeping the text field enabled.Maybe we should just document this instead? The docs for
TextField.enabledsay the following:but as mentioned in the OP, the
InputDecoration.enableddocs do not mention the suffix icon.[-]Allow enabled suffix button when the text field is disabled[/-][+][docs] InputDecoration.enabled should explain how it interacts with suffixIcon[/+]justinmc commentedon Apr 30, 2025
Documenting the workaround sounds good.
Your goal is to create a disabled TextField with a suffixIcon that still responds to taps?
navaronbracke commentedon Apr 30, 2025
Exactly!
thakaredipali commentedon May 28, 2025
@navaronbracke If you want to use a suffixIcon with an onPressed action while the TextFormField is disabled, you can use the readOnly property instead. This way, the text field remains non-editable, but the suffixIcon stays interactive.
navaronbracke commentedon May 28, 2025
@thakaredipali I already mentioned that in this comment
thakaredipali commentedon May 28, 2025
@navaronbracke Yes, got it.
Documenting these things will help others understand more easily.
Thanks
Docs: Update docs for suffix icon interaction behaviour (#169828)
github-actions commentedon Jun 25, 2025
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 -vand a minimal reproduction of the issue.Docs: Update docs for suffix icon interaction behaviour (flutter#169828)