Skip to content

Taskulu/material_speed_dial

Repository files navigation

material_speed_dial

A simple Material speed dial.

Preview

Preview

Usage

  1. Add to your dependencies
dependencies:
  material_speed_dial: 0.0.7
  1. 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: () {},
          ),
        ],
      ),
    );
  }
}
  1. Check for state or toggle
final isOpen = _key.currentState.isOpen;
_key.currentState.toggle();