ContextMenuButton<T> class
Button that shows a context menu when pressed.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- Button
- ContextMenuButton
Constructors
-
ContextMenuButton({Key? key, Widget? body, Widget? trailing, Widget? leading, String? tooltip, ButtonThemeData? theme, EdgeInsets? leadingPadding, EdgeInsets? padding, EdgeInsets? bodyPadding, EdgeInsets? trailingPadding, VoidCallback? onLongPress, FocusNode? focusNode, bool canRequestFocus = true, bool autofocus = false, bool filled = false, bool willChangeState = false, bool enableAnimation = true, ContextMenuCanceled? onCanceled, T? value, required ContextMenuItemSelected<
T> ? onSelected, required ContextMenuItemBuilder<T> itemBuilder}) -
const
-
ContextMenuButton.dropdown(Widget body, {Key? key, String? tooltip, EdgeInsets? padding, FocusNode? focusNode, bool canRequestFocus = true, bool autofocus = false, bool willChangeState = false, VoidCallback? onLongPress, ButtonThemeData? theme, T? value, ContextMenuCanceled? onCanceled, required ContextMenuItemSelected<
T> ? onSelected, required ContextMenuItemBuilder<T> itemBuilder}) -
Creates a dropdown button. The difference with a regular DropdownButton,
is that a widget will be used alongside the icon instead of the context menu value.
factory
-
ContextMenuButton.filled(String text, {Key? key, double? fontSize, String? tooltip, EdgeInsets? padding, FocusNode? focusNode, bool canRequestFocus = true, bool autofocus = false, bool enableAnimation = false, bool willChangeState = false, VoidCallback? onLongPress, ButtonThemeData? theme, T? value, ContextMenuCanceled? onCanceled, required ContextMenuItemSelected<
T> ? onSelected, required ContextMenuItemBuilder<T> itemBuilder}) -
Creates a button with a filled background.
factory
-
ContextMenuButton.icon(IconData icon, {Key? key, String? tooltip, double? size, EdgeInsets? padding, FocusNode? focusNode, bool canRequestFocus = true, bool autofocus = false, bool willChangeState = false, VoidCallback? onLongPress, ButtonThemeData? theme, T? value, ContextMenuCanceled? onCanceled, required ContextMenuItemSelected<
T> ? onSelected, required ContextMenuItemBuilder<T> itemBuilder}) -
Creates a button with a icon.
factory
-
ContextMenuButton.text(String text, {Key? key, double? fontSize, String? tooltip, ButtonThemeData? theme, EdgeInsets? padding, FocusNode? focusNode, bool canRequestFocus = true, bool autofocus = false, bool willChangeState = false, VoidCallback? onLongPress, T? value, ContextMenuCanceled? onCanceled, required ContextMenuItemSelected<
T> ? onSelected, required ContextMenuItemBuilder<T> itemBuilder}) -
Creates a button with a text.
factory
Properties
- active → bool?
-
Forces the button highlight.
finalinherited
- autofocus → bool
-
True if this widget will be selected as the initial focus when no other
node in its scope is currently focused.
finalinherited
- body → Widget?
-
The main widget placed in the button.
finalinherited
- bodyPadding → EdgeInsets?
-
The body padding.
finalinherited
- canRequestFocus → bool
-
If true, this widget may request the primary focus.
finalinherited
- enableAnimation → bool
-
If animations are enabled.
finalinherited
- filled → bool
-
If the button fills a background.
finalinherited
- focusNode → FocusNode?
-
An optional focus node to use as the focus node for this widget.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
itemBuilder
→ ContextMenuItemBuilder<
T> -
The list of ContextMenuItem used for the context menu.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
Widget to place at the beginning of the button.
finalinherited
- leadingPadding → EdgeInsets?
-
The leading padding.
finalinherited
- onCanceled → ContextMenuCanceled?
-
Called when the user cancels the context menu selection.
final
- onLongPress → VoidCallback?
-
Called when button is long pressed.
finalinherited
- onPressed → VoidCallback?
-
Called when button is pressed.
finalinherited
-
onSelected
→ ContextMenuItemSelected<
T> ? -
Called when the context menu selection changes.
final
- padding → EdgeInsets?
-
Padding of the button.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- theme → ButtonThemeData?
-
The style ButtonThemeData of the button.
finalinherited
- tooltip → String?
-
The button tooltip.
finalinherited
- trailing → Widget?
-
Widget to place at the end of the button.
finalinherited
- trailingPadding → EdgeInsets?
-
The trailing padding.
finalinherited
- value → T?
-
The current value in the context menu.
final
- willChangeState → bool
-
Heuristic to indicate that the active or onPressed will change.
finalinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ContextMenuButton< T> > -
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