This project was writed with pure dart code，which means it's support both iOS and Android.
You can find the demo at the 'example' folder.
First, you should set the context at somewhere in you code. Like below:
PopupMenu.context = context;
PopupMenu menu = PopupMenu( items: [ MenuItem(title: 'Copy', image: Image.asset('assets/copy.png')), MenuItem(title: 'Home', image: Icon(Icons.home, color: Colors.white,)), MenuItem(title: 'Mail', image: Icon(Icons.mail, color: Colors.white,)), MenuItem(title: 'Power', image: Icon(Icons.power, color: Colors.white,)), MenuItem(title: 'Setting', image: Icon(Icons.settings, color: Colors.white,)), MenuItem(title: 'Traffic', image: Icon(Icons.traffic, color: Colors.white,))], onClickMenu: onClickMenu, onDismiss: onDismiss); menu.show(rect: rect);
A new Flutter project.
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Add this to your package's pubspec.yaml file:
dependencies: popup_menu: ^1.0.1
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Jul 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
lib/popup_menu.dart. (-0.50 points)
lib/popup_menu.dart reported 1 hint:
line 40 col 1: Prefer using /// for doc comments.