RadioMenuButton<T> class

A menu item that combines a Radio widget with a MenuItemButton.

To style the radio button separately from the overall button, add a RadioTheme ancestor.

This example shows a menu with three radio buttons with shortcuts that changes the background color of the body when the buttons are selected.
link

To create a local project with this code sample, run:
flutter create --sample=material.RadioMenuButton.1 mysample

See also:

  • MenuBar, a widget that creates a menu bar of cascading menu items.
  • MenuAnchor, a widget that defines a region which can host a cascading menu.
Inheritance

Constructors

RadioMenuButton({Key? key, required T value, required T? groupValue, required ValueChanged<T?>? onChanged, bool toggleable = false, ValueChanged<bool>? onHover, ValueChanged<bool>? onFocusChange, FocusNode? focusNode, MenuSerializableShortcut? shortcut, ButtonStyle? style, MaterialStatesController? statesController, Clip clipBehavior = Clip.none, Widget? trailingIcon, bool closeOnActivate = true, required Widget? child})
Creates a const RadioMenuButton.
const

Properties

child Widget?
The widget displayed in the center of this button.
final
clipBehavior Clip
The content will be clipped (or not) according to this option.
final
closeOnActivate bool
Determines if the menu will be closed when a MenuItemButton is pressed.
final
enabled bool
Whether the button is enabled or disabled.
no setter
focusNode FocusNode?
An optional focus node to use as the focus node for this widget.
final
groupValue → T?
The currently selected value for a group of radio buttons.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged ValueChanged<T?>?
Called when the user selects this radio button.
final
onFocusChange ValueChanged<bool>?
Handler called when the focus changes.
final
onHover ValueChanged<bool>?
Called when a pointer enters or exits the button response area.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shortcut MenuSerializableShortcut?
The optional shortcut that selects this MenuItemButton.
final
statesController MaterialStatesController?
Represents the interactive "state" of this widget in terms of a set of MaterialStates, like MaterialState.pressed and MaterialState.focused.
final
style ButtonStyle?
Customizes this button's appearance.
final
toggleable bool
Set to true if this radio button is allowed to be returned to an indeterminate state by selecting it again when selected.
final
trailingIcon Widget?
An optional icon to display after the child label.
final
value → T
The value represented by this radio button.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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