pub struct RadioMenuButton<T: Clone + PartialEq + 'static> {Show 15 fields
pub key: Option<KeyRef>,
pub value: T,
pub group_value: Option<T>,
pub toggleable: bool,
pub on_changed: Option<ValueChanged<Option<T>>>,
pub on_hover: Option<ValueChanged<bool>>,
pub on_focus_change: Option<ValueChanged<bool>>,
pub focus_node: Option<FocusNodeRef>,
pub shortcut: Option<MenuSerializableShortcutRef>,
pub style: Option<ButtonStyle>,
pub states_controller: Option<Ref<WidgetStatesController>>,
pub clip_behavior: Clip,
pub trailing_icon: Option<WidgetRef>,
pub close_on_activate: bool,
pub child: Option<WidgetRef>,
}Expand description
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.
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.
Fields§
§key: Option<KeyRef>See Widget::key.
value: TThe value represented by this radio button.
This radio button is considered selected if its value matches the
group_value.
group_value: Option<T>The currently selected value for a group of radio buttons.
This radio button is considered selected if its value matches the
group_value.
toggleable: boolSet to true if this radio button is allowed to be returned to an indeterminate state by selecting it again when selected.
To indicate returning to an indeterminate state, on_changed will
be called with null.
If true, on_changed is called with value when
selected while group_value != value, and with
null when selected again while group_value ==
value.
If false, on_changed will be called with value
when it is selected while group_value != value,
and only by selecting another radio button in the group (i.e. changing the value of
group_value) can this radio button be unselected.
The default is false.
on_changed: Option<ValueChanged<Option<T>>>Called when the user selects this radio button.
The radio button passes value as a parameter to this callback. The
radio button does not actually change state until the parent widget rebuilds the
radio button with the new group_value.
If null, the radio button will be displayed as disabled.
The provided callback will not be invoked if this radio button is already selected.
on_hover: Option<ValueChanged<bool>>Called when a pointer enters or exits the button response area.
The value passed to the callback is true if a pointer has entered button area and false if a pointer has exited.
on_focus_change: Option<ValueChanged<bool>>Handler called when the focus changes.
Called with true if this widget’s node gains focus, and false if it loses focus.
focus_node: Option<FocusNodeRef>An optional focus node to use as the focus node for this widget.
shortcut: Option<MenuSerializableShortcutRef>The optional shortcut that selects this MenuItemButton.
style: Option<ButtonStyle>Customizes this button’s appearance.
Non-null properties of this style override the corresponding properties in
MenuItemButton::theme_style_of and MenuItemButton::default_style_of.
WidgetStatePropertys that resolve to non-null values will similarly
override the corresponding WidgetStatePropertys in
MenuItemButton::theme_style_of and MenuItemButton::default_style_of.
Null by default.
states_controller: Option<Ref<WidgetStatesController>>Represents the interactive “state” of this widget in terms of a set of
WidgetStates.
clip_behavior: ClipThe content will be clipped (or not) according to this option.
Defaults to Clip::None.
trailing_icon: Option<WidgetRef>An optional icon to display after the child label.
close_on_activate: boolDetermines if the menu will be closed when a MenuItemButton
is pressed.
Defaults to true.
child: Option<WidgetRef>The widget displayed in the center of this button.
Typically this is the button’s label, using a Text widget.
Implementations§
Source§impl<T: Clone + PartialEq + Debug + 'static> RadioMenuButton<T>
impl<T: Clone + PartialEq + Debug + 'static> RadioMenuButton<T>
Sourcepub fn new<K>(
value: T,
group_value: Option<T>,
on_changed: Option<ValueChanged<Option<T>>>,
child: Option<impl IntoWidget<K>>,
) -> RadioMenuButton<T>
pub fn new<K>( value: T, group_value: Option<T>, on_changed: Option<ValueChanged<Option<T>>>, child: Option<impl IntoWidget<K>>, ) -> RadioMenuButton<T>
Creates a const RadioMenuButton.
The child attribute is required.
Sourcepub fn key(self, key: KeyRef) -> RadioMenuButton<T>
pub fn key(self, key: KeyRef) -> RadioMenuButton<T>
Dart RadioMenuButton(key:).
Sourcepub fn toggleable(self, toggleable: bool) -> RadioMenuButton<T>
pub fn toggleable(self, toggleable: bool) -> RadioMenuButton<T>
Dart RadioMenuButton(toggleable:).
Sourcepub fn on_hover(self, on_hover: ValueChanged<bool>) -> RadioMenuButton<T>
pub fn on_hover(self, on_hover: ValueChanged<bool>) -> RadioMenuButton<T>
Dart RadioMenuButton(onHover:).
Sourcepub fn on_focus_change(
self,
on_focus_change: ValueChanged<bool>,
) -> RadioMenuButton<T>
pub fn on_focus_change( self, on_focus_change: ValueChanged<bool>, ) -> RadioMenuButton<T>
Dart RadioMenuButton(onFocusChange:).
Sourcepub fn focus_node(self, focus_node: FocusNodeRef) -> RadioMenuButton<T>
pub fn focus_node(self, focus_node: FocusNodeRef) -> RadioMenuButton<T>
Dart RadioMenuButton(focusNode:).
Sourcepub fn shortcut(
self,
shortcut: MenuSerializableShortcutRef,
) -> RadioMenuButton<T>
pub fn shortcut( self, shortcut: MenuSerializableShortcutRef, ) -> RadioMenuButton<T>
Dart RadioMenuButton(shortcut:).
Sourcepub fn style(self, style: ButtonStyle) -> RadioMenuButton<T>
pub fn style(self, style: ButtonStyle) -> RadioMenuButton<T>
Dart RadioMenuButton(style:).
Sourcepub fn states_controller(
self,
states_controller: Ref<WidgetStatesController>,
) -> RadioMenuButton<T>
pub fn states_controller( self, states_controller: Ref<WidgetStatesController>, ) -> RadioMenuButton<T>
Dart RadioMenuButton(statesController:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> RadioMenuButton<T>
pub fn clip_behavior(self, clip_behavior: Clip) -> RadioMenuButton<T>
Dart RadioMenuButton(clipBehavior:).
Sourcepub fn trailing_icon<K>(
self,
trailing_icon: impl IntoWidget<K>,
) -> RadioMenuButton<T>
pub fn trailing_icon<K>( self, trailing_icon: impl IntoWidget<K>, ) -> RadioMenuButton<T>
Dart RadioMenuButton(trailingIcon:).
Sourcepub fn close_on_activate(self, close_on_activate: bool) -> RadioMenuButton<T>
pub fn close_on_activate(self, close_on_activate: bool) -> RadioMenuButton<T>
Dart RadioMenuButton(closeOnActivate:).
Sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Whether the button is enabled or disabled.
To enable a button, set its on_changed property to a non-null
value.
Trait Implementations§
Source§impl<T: Clone + PartialEq + Debug + 'static> StatelessWidget for RadioMenuButton<T>
impl<T: Clone + PartialEq + Debug + 'static> StatelessWidget for RadioMenuButton<T>
Source§fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl<T> !RefUnwindSafe for RadioMenuButton<T>
impl<T> !Send for RadioMenuButton<T>
impl<T> !Sync for RadioMenuButton<T>
impl<T> !UnwindSafe for RadioMenuButton<T>
impl<T> Forget for RadioMenuButton<T>
impl<T> Freeze for RadioMenuButton<T>where
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
T: Freeze,
*const RcInner<dyn Fn(&mut App, Option<T>)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, Option<T>)>>: Freeze,
*const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze,
NonZero<u32>: Freeze,
&'static FocusNodeVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<dyn MenuSerializableShortcut> is !null: Freeze,
PhantomData<RcInner<dyn MenuSerializableShortcut>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<Size>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Size>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: Freeze,
*const RcInner<dyn InteractiveInkFeatureFactory> is !null: Freeze,
PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>>>: Freeze,
*const (): Freeze,
PhantomData<fn() -> WidgetStatesController>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl<T> Move for RadioMenuButton<T>
impl<T> Unpin for RadioMenuButton<T>where
T: Unpin,
Rc<dyn Key>: Unpin,
Rc<dyn Fn(&mut App, Option<T>)>: Unpin,
Rc<dyn Fn(&mut App, bool)>: Unpin,
NonZero<u32>: Unpin,
&'static FocusNodeVTable: Unpin,
Rc<Keep>: Unpin,
Rc<dyn MenuSerializableShortcut>: Unpin,
Rc<dyn WidgetStateProperty<Option<TextStyle>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<Color>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<f64>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<Size>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<BorderSide>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>: Unpin,
Rc<dyn InteractiveInkFeatureFactory>: Unpin,
Rc<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>>: Unpin,
*const (): Unpin,
Rc<dyn Widget>: Unpin,
impl<T> UnsafeUnpin for RadioMenuButton<T>where
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
T: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, Option<T>)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, Option<T>)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
&'static FocusNodeVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const RcInner<dyn MenuSerializableShortcut> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn MenuSerializableShortcut>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<Size>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Size>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Rc<dyn MouseCursor>>>>>: UnsafeUnpin,
*const RcInner<dyn InteractiveInkFeatureFactory> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn InteractiveInkFeatureFactory>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, &HashSet<WidgetState>, Option<Rc<dyn Widget>>) -> Rc<dyn Widget>>>: UnsafeUnpin,
*const (): UnsafeUnpin,
PhantomData<fn() -> WidgetStatesController>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.