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> {
|
class _FloatingCreationButtonState extends State<FloatingCreationButton> {
|
||||||
final AccountController _accountController = AccountController();
|
final AccountController _accountController = AccountController();
|
||||||
|
final _key = GlobalKey<ExpandableFabState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) => ExpandableFab(
|
Widget build(final BuildContext context) => ExpandableFab(
|
||||||
|
key: _key,
|
||||||
openButtonBuilder: RotateFloatingActionButtonBuilder(
|
openButtonBuilder: RotateFloatingActionButtonBuilder(
|
||||||
child: const Icon(Icons.add),
|
child: const Icon(Icons.add),
|
||||||
),
|
),
|
||||||
@@ -54,7 +56,14 @@ class _FloatingCreationButtonState extends State<FloatingCreationButton> {
|
|||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
FloatingActionButton.small(
|
FloatingActionButton.small(
|
||||||
heroTag: null,
|
heroTag: null,
|
||||||
onPressed: onPressed,
|
onPressed: () {
|
||||||
|
onPressed.call();
|
||||||
|
|
||||||
|
final ExpandableFabState? state = _key.currentState;
|
||||||
|
if (state != null && state.isOpen) {
|
||||||
|
state.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Icon(icon),
|
child: Icon(icon),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user