A simple Material speed dial.
- Add to your dependencies
dependencies:
material_speed_dial: 0.0.7
- Add to your widget tree
class MyHomePage extends StatelessWidget {
final _key = GlobalKey<SpeedDialState>();
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: SpeedDial(
key: _key,
invokeAfterClosing: true,
child: Icon(Icons.add),
expandedChild: Icon(Icons.share),
backgroundColor: Colors.blue,
expandedBackgroundColor: Colors.black,
children: [
SpeedDialChild(
child: Icon(Icons.close),
label: Text('Test'),
onPressed: () {},
),
SpeedDialChild(
child: Icon(Icons.pending),
label: Text('Another Test'),
onPressed: () {},
),
],
),
);
}
}
- Check for state or toggle
final isOpen = _key.currentState.isOpen;
_key.currentState.toggle();