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
Add prefixIcon and suffixIcon parameters to InputDecoration.collapsed #61331
@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 ).
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
justinmc commentedon Jul 13, 2020
@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: trueto the default InputDecoration constructor.bleroux commentedon Jul 12, 2024
@justinmc
I’m looking at
InputDecoration.isCollapsed,InputDecoration.isDenseandInputDecoration.contentPadding. I read some previous discussions on this topic, for instance #46160 (comment).To summarize the history behind
isCollapsed:InputDecoration.collapsedwas added long ago in Rationalize text input widgets #9119. And theisCollapsedproperty was not exposed in the default constructor.isCollapsedproperty 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 setisCollapsedto 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
InputDecorationconstructors (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 ).
flutter-triage-bot commentedon Jul 13, 2024
This issue is missing a priority label. Please set a priority label when adding the
triaged-designlabel.justinmc commentedon Jul 18, 2024
@bleroux Exposing isCollapsed may have been a bad idea, I'm on board with removing it if we can get away with it.
Cleanup InputDecoration.collapsed constructor (#152165)
Cleanup InputDecoration.collapsed constructor (flutter#152165)
github-actions commentedon Aug 8, 2024
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.Cleanup InputDecoration.collapsed constructor (flutter#152165)
Cleanup InputDecoration.collapsed constructor (#152165)