Skip to content

Disabled behavior of floating action buttons like other buttonsΒ #76120

Closed as not planned

Description

@Chris1234567899

Use case

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.

Activity

  1. added
    p: material_ui
    framework
    on Feb 16, 2021
  2. added
    c: proposal
    on Feb 17, 2021
  3. emem365 commented on Feb 21, 2021

    @emem365
    Contributor

    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 :)

  4. iamchathu commented on Sep 7, 2021

    @iamchathu

    Yeap it will nice that FAB too works like the other buttons when disabled.

  5. jesselopespereira commented on Dec 18, 2021

    @jesselopespereira

    Great

  6. vedantkulkarni commented on Jun 15, 2022

    @vedantkulkarni

    Hey please can I work on this ?

  7. guidezpl commented on Jul 12, 2022

    @guidezpl
    Member

    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.

  8. github-actions commented on Jul 26, 2022

    @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 Jul 26, 2022
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

    c: proposalframeworkp: material_ui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions