Skip to main content

PopupMenuItem

Struct PopupMenuItem 

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

An item 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.

To show a checkmark next to a popup menu item, consider using CheckedPopupMenuItem.

Typically the child of a PopupMenuItem is a Text widget. More elaborate menus with icons can use a ListTile. By default, a PopupMenuItem is K_MIN_INTERACTIVE_DIMENSION pixels high. If you use a widget with a different height, it must be specified in the height property.

See also:

Fields§

§popup_menu_item: PopupMenuItemData<T>

Implementations§

Source§

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

Source

pub fn new<K>(child: Option<impl IntoWidget<K>>) -> PopupMenuItem<T>

Creates an item for a popup menu.

By default, the item is enabled.

Source

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

Dart PopupMenuItem(key:).

Source

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

Dart PopupMenuItem(value:).

Source

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

Dart PopupMenuItem(onTap:).

Source

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

Dart PopupMenuItem(enabled:).

Source

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

Dart PopupMenuItem(height:).

Source

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

Dart PopupMenuItem(padding:).

Source

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

Dart PopupMenuItem(labelTextStyle:).

Source

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

Dart PopupMenuItem(mouseCursor:).

Source

pub fn text_style(self, text_style: TextStyle) -> PopupMenuItem<T>

Dart PopupMenuItem(textStyle:).

Trait Implementations§

Source§

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

Source§

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

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

impl<T: Clone + PartialEq + 'static> PopupMenuEntry<T> for PopupMenuItem<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 PopupMenuItem<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 PopupMenuItem<T>

Source§

type State = PopupMenuItemState<T>

The state this widget creates.
Source§

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

Source§

fn create_state(&self) -> PopupMenuItemState<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 PopupMenuItem<T>

§

impl<T> !Send for PopupMenuItem<T>

§

impl<T> !Sync for PopupMenuItem<T>

§

impl<T> !UnwindSafe for PopupMenuItem<T>

§

impl<T> Forget for PopupMenuItem<T>

§

impl<T> Freeze for PopupMenuItem<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 PopupMenuItem<T>

§

impl<T> Unpin for PopupMenuItem<T>

§

impl<T> UnsafeUnpin for PopupMenuItem<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>