Skip to content

Xezolpl/popup_menu

This branch is 3 commits ahead of, 14 commits behind chinabrant/popup_menu:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Mateusz Pietras
May 16, 2021
bdc3739 Â· May 16, 2021

History

39 Commits
May 31, 2019
May 16, 2021
May 16, 2021
May 30, 2019
May 30, 2019
May 30, 2019
May 31, 2019
May 31, 2019
May 31, 2019
Oct 17, 2019
May 31, 2019
Oct 17, 2019
May 30, 2019
May 16, 2021
May 16, 2021

Repository files navigation

pub package

This project was writed with pure dart code,which means it's support both iOS and Android.

Screenshot

Todo

  • show/hide animation

Usage

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, 
      stateChanged: stateChanged,
      onDismiss: onDismiss);

menu.show(rect: rect);

void stateChanged(bool isShow) {
  print('menu is ${ isShow ? 'showing': 'closed' }');
}

or

PopupMenu menu = PopupMenu(
        backgroundColor: Colors.teal,
        lineColor: Colors.tealAccent,
        maxColumn: 3,
        items: [
          MenuItem(title: 'Copy', image: Image.asset('assets/copy.png')),
          MenuItem(
              title: 'Home',
              textStyle: TextStyle(fontSize: 10.0, color: Colors.tealAccent),
              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: 'PopupMenu',
              image: Icon(
                Icons.menu,
                color: Colors.white,
              ))
        ],
        onClickMenu: onClickMenu,
        onDismiss: onDismiss);
    menu.show(widgetKey: btnKey2);

About

🔥A flutter popup menu. Pub enabled.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 93.3%
  • Objective-C 3.1%
  • Shell 2.1%
  • Java 1.5%