Skip to content

[Feature] add shouldOpen callback to conditionally allow ExpandableFab opening#44

Open
GeekTree0101 wants to merge 2 commits intozuvola:masterfrom
GeekTree0101:feature/should-open
Open

[Feature] add shouldOpen callback to conditionally allow ExpandableFab opening#44
GeekTree0101 wants to merge 2 commits intozuvola:masterfrom
GeekTree0101:feature/should-open

Conversation

@GeekTree0101
Copy link
Copy Markdown

Summary

This PR introduces a new optional callback shouldOpen to the ExpandableFab widget, allowing developers to conditionally block the FAB menu from opening.

Changes

  • Added final bool Function()? shouldOpen to ExpandableFab
  • Updated toggle() and open() methods to respect shouldOpen result
  • If shouldOpen returns false, the menu will not open
  • Ensured backward compatibility: if shouldOpen is null, menu opens as usual

Motivation

This provides better control for developers who want to prevent opening the FAB under certain conditions (e.g., unsaved changes, dialogs open, etc).

Example

ExpandableFab(
  shouldOpen: () => !_isLocked,
  ...
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant