fab_dialer 0.1.0 fab_dialer: ^0.1.0 copied to clipboard
A new flutter package project.
Introduction #
THIS IS A FORK OF https://github.com/Leondev7/flutter_fab_dialer
SWITCHING FROM THE ORIGINAL TO THIS WILL CAUSE BREAKING CHANGES! READ BELOW:
Due to the fact that I want to be able to continually add to this package and have optional arguments for backwards-compatibility moving forward, I've switched from positional parameters to named parameters on both the main dialer and menu items. I believe this makes more sense and is more user friendly as the library expands.
This is a Widget build for having an alternative to default menus
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),
],
),
);
}
}