menu

pub package GitHub

menu with flutter

just wrap your widget ,and long tap to show menu

like this:

img

Usage

import 'package:menu/menu.dart';

Menu(
  child: Container(
    width: 200,
    color: Colors.yellow,
    height: 100,
    child: Text("long press show menu"),
  ),
  items: [
    MenuItem("copy", () {}),
    MenuItem("add", _incrementCounter),
  ],
  decoration: MenuDecoration(
    itemConstraints: BoxConstraints(),
  ),
);

params

NameTypeRequiredDescribe
childWidgettruewidget
itemsListtrueoptions
decorationMenuDecorationfalsedecoration for menu and item
itemBuilderItemBuilderfalsecustomItem
clickTypeClickTypefalse
NameTypeRequiredDescribe
textstringtrue
onTapFunctiontrueonTap
NameTypeRequiredDescribe
textStyleTextStylefalsestyle of menu item
colorColorfalsecolor of menu item
splashColorColorfalsesplashColor of menu item
radiusdoulefalseradius of menu item, only first and last item
constraintsBoxConstraintsfalseconstraints of menu item
paddingTextStylefalsepadding of menu item'text

ClickType

NameDescribe
clickclick to show menu
longPresslongPress widget to show menu
doubleClickdouble click widget to show menu
noneNot responding to touch events

Libraries