/flutter_fab_dialer

Floating action button dialer

Primary LanguageDartBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Introduction

THIS IS A FORK OF https://github.com/Leondev7/flutter_fab_dialer

This is a Widget build for having an alternative to default menus

alt text

There are two types of fab menu items

One with text associated

   FabMiniMenuItem.withText(
       new Icon(Icons.add),
       Colors.blue,
       4.0,
       "Button menu",
       yourFunction,
       "Click me",
       Colors.blue,
       Colors.white,
      )

The other one without text

  FabMiniMenuItem.noText(
        new Icon(Icons.add),
        Colors.blue,
        4.0,
        "Button menu",
        yourFunction,
      )

Usage

Create a list with your desired elements and customize each one

 var _fabMiniMenuItemList = [
   new FabMiniMenuItem.withText(
       new Icon(Icons.add),
       Colors.blue,
       4.0,
       "Button menu 1",
     yourFunction1,
       "Click me",
       Colors.blue,
       Colors.white,
      ),
    new FabMiniMenuItem.noText(
      new Icon(Icons.add),
      Colors.blue,
      4.0,
      "Button menu 2",
      yourFunction2,
    )
    ];

Add the Dialer to your UI

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    //The list of FabMiniMenuItems that we are going to use
    var _fabMiniMenuItemList = [
   new FabMiniMenuItem.withText(
       new Icon(Icons.add),
       Colors.blue,
       4.0,
       "Button menu",
     _incrementCounter,
       "Click me",
       Colors.blue,
       Colors.white,
      ),
    new FabMiniMenuItem.noText(
      new Icon(Icons.add),
      Colors.blue,
      4.0,
      "Button menu",
      _incrementCounter,
    )
    ];
    
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      //Using a Stack will assure that the Dialer will appear at the end of your layout
      body:  new Stack(
          children: <Widget>[
            new Center(
              child: new Column(
                children: <Widget>[
                  new Text('You have pushed the button this many times:'),
                  new Text('$_counter', style: Theme.of(context).textTheme.display1),
                ],
              ),
            ),
            // menuItems, FAB color, Initial Icon, Close Icon, Animation Duration
            new FabDialer(_fabMiniMenuItemList, Colors.blue, new Icon(Icons.add), new Icon(Icons.close), 250),
          ],
        ),
    );
  }
}