animated_fab_button_menu 0.0.2 animated_fab_button_menu: ^0.0.2 copied to clipboard
Flutter package to implement an animated FAB with a scrollable Menu.
import 'package:animated_fab_button_menu/animated_fab_button_menu.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Animated FAB Menu',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
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'),
),
);
}
}