All Projects → huextrat → menu_button

huextrat / menu_button

Licence: MIT License
Flutter plugin to display a popup menu button widget with handsome design and easy to use.

Programming Languages

dart
5743 projects
C++
36643 projects - #6 most used programming language
CMake
9771 projects
swift
15916 projects
c
50402 projects - #5 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to menu button

Projeny
A project and package manager for Unity
Stars: ✭ 656 (+925%)
Mutual labels:  package, dependency
Timeline list
Timeline widget for flutter
Stars: ✭ 281 (+339.06%)
Mutual labels:  package, widget
Boss
Dependency Manager for Delphi
Stars: ✭ 188 (+193.75%)
Mutual labels:  package, dependency
Styled widget
Simplifying widget style in Flutter.
Stars: ✭ 424 (+562.5%)
Mutual labels:  package, widget
Gitdependencyresolverforunity
This plugin resolves git url dependencies in the package for Unity Package Manager. You can use a git url as a package dependency!
Stars: ✭ 126 (+96.88%)
Mutual labels:  package, dependency
Flutterweekview
Displays a highly customizable week view (or day view) which is able to display events, to be scrolled, to be zoomed-in & out and a lot more !
Stars: ✭ 130 (+103.13%)
Mutual labels:  package, widget
PackageProject.cmake
🏛️ Help other developers use your project. A CMake script for packaging C/C++ projects for simple project installation while employing best-practices for maximum compatibility.
Stars: ✭ 48 (-25%)
Mutual labels:  package, dependency
react-double-marquee
A React marquee component that smoothly loops content.
Stars: ✭ 24 (-62.5%)
Mutual labels:  package
rc-year-calendar
Official React wrapper for the year-calendar widget
Stars: ✭ 27 (-57.81%)
Mutual labels:  widget
pixel-widget
Scriptable Widget inspired by Pixel's "At a Glance" widget.
Stars: ✭ 96 (+50%)
Mutual labels:  widget
presetter
🛹 Reuse and manage build scripts, devDependencies and config files from your favourite presets, instead of copy and paste!
Stars: ✭ 61 (-4.69%)
Mutual labels:  dependency
uploadcare-rails
Rails wrapper for Uploadcare
Stars: ✭ 48 (-25%)
Mutual labels:  widget
get-installed-path
Get locally or globally installation path of given package name.
Stars: ✭ 39 (-39.06%)
Mutual labels:  package
ReplAPI.it-NodeJS
[DEPRECIATED] 𝙀𝙫𝙚𝙧𝙮𝙩𝙝𝙞𝙣𝙜 𝙍𝙚𝙥𝙡𝙞𝙩, 𝙖𝙡𝙡 𝙖𝙩 𝙮𝙤𝙪𝙧 𝙙𝙞𝙨𝙥𝙤𝙨𝙖𝙡. This is the single most extensive Replit package, allowing you to access various parts of the site with just a few classes and methods. Maintained by @RayhanADev.
Stars: ✭ 32 (-50%)
Mutual labels:  package
siringa
Minimalist dependency injection library for Python that embraces type annotations syntax
Stars: ✭ 51 (-20.31%)
Mutual labels:  dependency
normalize-pkg
Normalize values in package.json to improve compatibility, programmatic readability and usefulness with third party libs.
Stars: ✭ 18 (-71.87%)
Mutual labels:  package
grammarly
Grammarly API interface
Stars: ✭ 87 (+35.94%)
Mutual labels:  package
bazaar
思源笔记社区集市。SiYuan community bazaar.
Stars: ✭ 18 (-71.87%)
Mutual labels:  widget
ModularPlayers
Modular desktop media widget
Stars: ✭ 28 (-56.25%)
Mutual labels:  widget
pidesktop
Collected files, drivers and documentation for the pidesktop case
Stars: ✭ 26 (-59.37%)
Mutual labels:  package

menu_button

Pub Package License

Flutter widget to display a popup menu button very simply and easily customizable.

Resources

Installations

Add menu_button: ^1.4.2+1 in your pubspec.yaml dependencies. And import it:

import 'package:menu_button/menu_button.dart';

Usage

The widget has a lot of properties to customize it, we will see here the ones needed to get a "basic" menu button.

Firstly we have to declare a variable to keep the selected item (selectedKey) and a list that contains all the items we want to display in this menu button.

Here we will make a list of strings that we will call keys and that contains the values Low, Medium & High.

String selectedKey;

List<String> keys = <String>[
  'Low',
  'Medium',
  'High',
];

Now that we have these two elements we can start using the MenuButton<T> widget.

MenuButton<String>(
  child: normalChildButton,
  items: keys,
  itemBuilder: (String value) => Container(
   height: 40,
   alignment: Alignment.centerLeft,
   padding: const EdgeInsets.symmetric(vertical: 0.0, horizontal: 16),
   child: Text(value),
  ),
  toggledChild: Container(
    child: normalChildButton,
  ),
  onItemSelected: (String value) {
    setState(() {
      selectedKey = value;
    });
  },
  onMenuButtonToggle: (bool isToggle) {
    print(isToggle);
  },
)

And finally here is an example of the child widget used for the MenuButton above:

final Widget normalChildButton = SizedBox(
  width: 93,
  height: 40,
  child: Padding(
    padding: const EdgeInsets.only(left: 16, right: 11),
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: <Widget>[
        Flexible(
          child: Text(selectedKey, overflow: TextOverflow.ellipsis)
        ),
        const SizedBox(
          width: 12,
          height: 17,
          child: FittedBox(
            fit: BoxFit.fill,
            child: Icon(
              Icons.arrow_drop_down,
              color: Colors.grey,
            ),
          ),
        ),
      ],
    ),
  ),
);

Of course you can make your own according to your needs.

Basic Parameters

Parameter Description
child A widget to display the default button to trigger the menu button
items The list that contains all values that you want to display on the menu button
itemBuilder A widget to design each item of the menu button
onItemSelected Function triggered when an item is selected
onMenuButtonToggle Function triggered when menu button is triggered (true if displayed, false if not)
toggledChild Same as child but when the menu button is opened

More Parameters

Parameter Description
crossTheEdge By default false you can set it to true if you want the button to expand
divider A custom divider between each items
decoration A custom decoration for menu button
edgeMargin By default 0 add a custom value to prevent the button to not touch the edge, check the example edge_menu_button.dart for more information
itemBackgroundColor By default Colors.white add custom Colors to customize the background of every items
label Add a widget to display a custom label as MaterialDesign on top of the button, check label_menu_button.dart for more information
labelDecoration If you use a label you can set a custom LabelDecoration
menuButtonBackgroundColor By default Colors.white add custom Colors to customize the background of the menu button
popupHeight By default popupHeight is automatically calculated but if you need a custom height use this property
scrollPhysics By default items are not scrollable (NeverScrollableScrollPhysics), add a ScrollPhysics to enable it, for instance AlwaysScrollableScrollPhysics
showSelectedItemOnList By default true, set it to false if you don't want the selected items in the list

For a more detail example please take a look at the example folder.

Example

Menu button with 3 items:


If something is missing, feel free to open a ticket or contribute!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].