MenuButton<T> class
Custom MenuButton to display a menu button following Material Design example
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MenuButton
Constructors
-
MenuButton({required Widget child, required List<
T> items, required MenuItemBuilder<T> itemBuilder, Widget? toggledChild, Widget divider = const Divider(height: 1, color: Colors.grey), bool topDivider = true, MenuItemSelected<T> ? onItemSelected, BoxDecoration? decoration, MenuButtonToggleCallback? onMenuButtonToggle, ScrollPhysics scrollPhysics = const NeverScrollableScrollPhysics(), double? popupHeight, bool crossTheEdge = false, double edgeMargin = 0.0, bool showSelectedItemOnList = true, T? selectedItem, Text? label, LabelDecoration? labelDecoration, Color itemBackgroundColor = Colors.white, }) -
const
Properties
- child → Widget
-
Widget to display the default button to trigger the menu button
final
- crossTheEdge → bool
-
Set it to true if you want the button to expand
final
- decoration → BoxDecoration?
-
A custom decoration for menu button
final
- divider → Widget
-
Divider widget
default = true
final - edgeMargin → double
-
Prevent the button to not touch the edge
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- itemBackgroundColor → Color
-
Background color of items
default = Colors.white
final -
itemBuilder
→ MenuItemBuilder<
T> -
A widget to design each item of the menu button
final
-
items
→ List<
T> -
List of all items available on the menu
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → Text?
-
Add a label on top of the menu button as Material design
final
- labelDecoration → LabelDecoration?
-
Custom LabelDecoration if you use a label
final
-
Background color of menu button
default = Colors.white
final -
onItemSelected
→ MenuItemSelected<
T> ? -
Action to do when an item is selected
final
- onMenuButtonToggle → MenuButtonToggleCallback?
-
Function triggered when menu button is triggered
final
- popupHeight → double?
-
Force a define height for the popup view
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollPhysics → ScrollPhysics
-
Determines the scroll physics
default = NeverScrollableScrollPhysics()
final - selectedItem → T?
-
Define the selected item
final
- showSelectedItemOnList → bool
-
Display or not the selected item on the list
default = true
final - toggledChild → Widget?
-
Same as child but when the menu button is opened
final
- topDivider → bool
-
Top Divider visibility
default = Divider(height: 1, color: Colors.grey)
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited