Skip to main content

CheckedPopupMenuItem

Struct CheckedPopupMenuItem 

Source
pub struct CheckedPopupMenuItem<T: 'static> {
    pub popup_menu_item: PopupMenuItemData<T>,
    pub checked: bool,
}
Expand description

An item with a checkmark in a Material Design popup menu.

To show a popup menu, use the ShowMenu function. To create a button that shows a popup menu, consider using PopupMenuButton.

A CheckedPopupMenuItem is K_MIN_INTERACTIVE_DIMENSION pixels high, which matches the default minimum height of a PopupMenuItem. The horizontal layout uses ListTile; the checkmark is an Icons::done icon, shown in the ListTile::leading position.

See also:

  • PopupMenuItem, a popup menu entry for picking a command (as opposed to toggling a value).
  • PopupMenuDivider, a popup menu entry that is just a horizontal line.
  • ShowMenu, a method to dynamically show a popup menu at a given location.
  • PopupMenuButton, an IconButton that automatically shows a menu when it is tapped.

Fields§

§popup_menu_item: PopupMenuItemData<T>§checked: bool

Whether to display a checkmark next to the menu item.

Defaults to false.

When true, an Icons::done checkmark is displayed.

When this popup menu item is selected, the checkmark will fade in or out as appropriate to represent the implied new state.

Implementations§

Source§

impl<T: Clone + PartialEq + 'static> CheckedPopupMenuItem<T>

Source

pub fn new() -> CheckedPopupMenuItem<T>

Creates a popup menu item with a checkmark.

By default, the menu item is enabled but unchecked. To mark the item as checked, set checked to true.

Source

pub fn key(self, key: KeyRef) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(key:).

Source

pub fn value(self, value: T) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(value:).

Source

pub fn on_tap(self, on_tap: Listener) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(onTap:).

Source

pub fn enabled(self, enabled: bool) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(enabled:).

Source

pub fn height(self, height: f64) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(height:).

Source

pub fn padding(self, padding: EdgeInsets) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(padding:).

Source

pub fn label_text_style( self, label_text_style: WidgetStatePropertyRef<Option<TextStyle>>, ) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(labelTextStyle:).

Source

pub fn mouse_cursor( self, mouse_cursor: MouseCursorRef, ) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(mouseCursor:).

Source

pub fn checked(self, checked: bool) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(checked:).

Source

pub fn child<K>(self, child: impl IntoWidget<K>) -> CheckedPopupMenuItem<T>

Dart CheckedPopupMenuItem(child:).

The widget below this widget in the tree.

Typically a Text. An appropriate DefaultTextStyle is put in scope for the child. The text should be short enough that it won’t wrap.

This widget is placed in the ListTile::title slot of a ListTile whose ListTile::leading slot is an Icons::done icon.

Trait Implementations§

Source§

impl<T: 'static> Debug for CheckedPopupMenuItem<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Clone + PartialEq + 'static> Default for CheckedPopupMenuItem<T>

Source§

fn default() -> CheckedPopupMenuItem<T>

Returns the “default value” for a type. Read more
Source§

impl<T: Clone + PartialEq + 'static> PopupMenuEntry<T> for CheckedPopupMenuItem<T>

Source§

fn height(&self) -> f64

The amount of vertical space occupied by this entry. Read more
Source§

fn represents(&self, value: Option<&T>) -> bool

Whether this entry represents a particular value. Read more
Source§

impl<T: Clone + PartialEq + 'static> PopupMenuItemLeaf for CheckedPopupMenuItem<T>

Source§

type Value = T

Dart’s T of PopupMenuItem<T>.
Source§

fn popup_menu_item_data(&self) -> &PopupMenuItemData<T>

The PopupMenuItemData bag, held under the field popup_menu_item.
Source§

impl<T: Clone + PartialEq + 'static> StatefulWidget for CheckedPopupMenuItem<T>

Source§

type State = CheckedPopupMenuItemState<T>

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> CheckedPopupMenuItemState<T>

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for CheckedPopupMenuItem<T>

§

impl<T> !Send for CheckedPopupMenuItem<T>

§

impl<T> !Sync for CheckedPopupMenuItem<T>

§

impl<T> !UnwindSafe for CheckedPopupMenuItem<T>

§

impl<T> Forget for CheckedPopupMenuItem<T>

§

impl<T> Freeze for CheckedPopupMenuItem<T>
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, T: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, NonZero<u32>: Freeze, *const (): Freeze, &'static dyn ColorExtension: Freeze, *const RcInner<dyn ColorExtension> is !null: Freeze, PhantomData<RcInner<dyn ColorExtension>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<String>: Freeze, *const RcInner<Paint> is !null: Freeze, PhantomData<RcInner<Paint>>: Freeze, PhantomData<Shadow>: Freeze, PhantomData<FontFeature>: Freeze, PhantomData<FontVariation>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: Freeze, *const RcInner<dyn MouseCursor> is !null: Freeze, PhantomData<RcInner<dyn MouseCursor>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze,

§

impl<T> Move for CheckedPopupMenuItem<T>

§

impl<T> Unpin for CheckedPopupMenuItem<T>

§

impl<T> UnsafeUnpin for CheckedPopupMenuItem<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>