flutter_popup_menu_button 0.0.1+5 flutter_popup_menu_button: ^0.0.1+5 copied to clipboard
A Customizable popup menu button.
FlutterPopupMenuButton. #
FlutterPopupMenuButton is a widget used for a customizable popup menu button
Features #
FlutterPopupMenuButton provides you a complete customizable popup menu button.
In this package you have control of almost each and every thing like where to show the menu,how much to shift menu on x and y axis and giving fixed height to menu.
It has MenuDirection enum to set your menu direction.
enum MenuDirection{
left,
right,
top,
bottom,
center,
none
}
You can even draw custom shape for your menu using CustomPainter class and provide painter to named parameter customPainter in FlutterPopupMenuButton widget.
Getting started #
Just add dependency to your pubspec.yaml and you can start using the package.
dependencies:
flutter:
sdk: flutter
flutter_popup_menu_button:
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: SafeArea(
child: Scaffold(
body: Align(
alignment: Alignment.topLeft,
child: FlutterPopupMenuButton(
direction: MenuDirection.right,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Colors.white
),
popupMenuSize: const Size(160,200),
child: FlutterPopupMenuIcon(
key: GlobalKey(),
child: Icon(Icons.more_vert),
),
children: [
FlutterPopupMenuItem(
closeOnItemClick: false,
child: ListTile(
title: const Text('List 1'),
leading: Container(
height: 20,
width: 20,
decoration: BoxDecoration(
color: Colors.redAccent.withOpacity(0.3),
shape: BoxShape.circle
),
),
)),
FlutterPopupMenuItem(
closeOnItemClick: false,
child: ListTile(
title: const Text('List 2'),
leading: Container(
height: 20,
width: 20,
decoration: BoxDecoration(
color: Colors.green.withOpacity(0.3),
shape: BoxShape.circle
),
),
)),
FlutterPopupMenuItem(
child: ListTile(
title: const Text('List 3'),
leading: Container(
height: 20,
width: 20,
decoration: BoxDecoration(
color: Colors.blue.withOpacity(0.3),
shape: BoxShape.circle
),
),
)),
FlutterPopupMenuItem(
child: ListTile(
title: const Text('List 4'),
leading: Container(
height: 20,
width: 20,
decoration: BoxDecoration(
color: Colors.cyanAccent.withOpacity(0.3),
shape: BoxShape.circle
),
),
))
],
),
),
),
),
);
}
}