Feat: Schließt den FloatingCreationButton beim Anklicken einer Option wieder.
This commit is contained in:
@@ -15,9 +15,11 @@ class FloatingCreationButton extends StatefulWidget {
|
||||
|
||||
class _FloatingCreationButtonState extends State<FloatingCreationButton> {
|
||||
final AccountController _accountController = AccountController();
|
||||
final _key = GlobalKey<ExpandableFabState>();
|
||||
|
||||
@override
|
||||
Widget build(final BuildContext context) => ExpandableFab(
|
||||
key: _key,
|
||||
openButtonBuilder: RotateFloatingActionButtonBuilder(
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
@@ -54,7 +56,14 @@ class _FloatingCreationButtonState extends State<FloatingCreationButton> {
|
||||
const SizedBox(width: 12),
|
||||
FloatingActionButton.small(
|
||||
heroTag: null,
|
||||
onPressed: onPressed,
|
||||
onPressed: () {
|
||||
onPressed.call();
|
||||
|
||||
final ExpandableFabState? state = _key.currentState;
|
||||
if (state != null && state.isOpen) {
|
||||
state.close();
|
||||
}
|
||||
},
|
||||
child: Icon(icon),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user