class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
floatingActionButton: FabMenu(
fabBackgroundColor: Colors.amber,
elevation: 2.0,
fabAlignment: Alignment.bottomCenter,
fabIcon: const Icon(Icons.more_horiz),
closeMenuButton: const Icon(
Icons.arrow_back,
color: Colors.white,
),
overlayOpacity: 0.5,
overlayColor: Colors.amber,
children: [
MenuItem(
title: 'Home',
onTap: () {},
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
MenuItem(
title: 'Profile',
onTap: () {},
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
MenuItem(
title: 'Messages',
onTap: () {},
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
MenuItem(
title: 'Feedback',
onTap: () {},
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
MenuItem(
title: 'Settings',
onTap: () {},
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
MenuItem(
title: 'Share',
onTap: () {},
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
MenuItem(
title: 'Get in touch!',
onTap: () {},
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold),
),
]),
body: const Center(
child: Text('Flutter animated FAB Menu'),
),
);
}
}
|
Here's what it looks like:
https://user-images.githubusercontent.com/68671238/134640734-751456fa-686b-4e77-bc8d-04ba3a324baf.mp4
|