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
Disabled behavior of floating action buttons like other buttonsΒ #76120
c: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages
Currently, a fab (floating action button) can be disabled by setting the onPressed attribute to null. This is in accordance with other buttons and fine like it is. However, in contrary to the behavior to other buttons, the visuals do not change, so the user does not know that the button is disabled.
The docs state that it's better to never disable it at all, or change the background color manually, which of course can be done. But I don't see the reason to why not automatically adapt the color, if it's disabled. Imo the behavior should be the same as with other buttons.
Proposal
Automatically adapt the color, if the fab is disabled, so no cumbersome workaround is needed.
Reacted by Jeremy Kolb, Hsingchien Cheng, Renato Marinho, Seb, Yauheni Pakala, Tenzin Tamdin, Chathu Vishwaijith, leors75, Inclu Cat, Mahmood Janabi and 14 more
If the onPressed callback is null, then the button will be disabled and will not react to touch. It is highly discouraged to disable a floating action button as there is no indication to the user that the button is disabled. Consider changing the backgroundColor if disabling the floating action button.
-Docs
Seems like this could be a nice addition to the behavior. I'd be willing to open a PR if that's alright :)
From Material's perspective, FABs should never be disabled (show enabled or not at all), so the actual fix here would be to make the onPressed callable non-nullable and required.
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.
c: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packages
Activity
emem365 commentedon Feb 21, 2021
-Docs
Seems like this could be a nice addition to the behavior. I'd be willing to open a PR if that's alright :)
iamchathu commentedon Sep 7, 2021
Yeap it will nice that FAB too works like the other buttons when disabled.
jesselopespereira commentedon Dec 18, 2021
Great
vedantkulkarni commentedon Jun 15, 2022
Hey please can I work on this ?
guidezpl commentedon Jul 12, 2022
From Material's perspective, FABs should never be disabled (show enabled or not at all), so the actual fix here would be to make the onPressed callable non-nullable and required.
github-actions commentedon Jul 26, 2022
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.