Skip to main content

PopupMenuItemData

Struct PopupMenuItemData 

Source
pub struct PopupMenuItemData<T> {
    pub key: Option<KeyRef>,
    pub value: Option<T>,
    pub on_tap: Option<Listener>,
    pub enabled: bool,
    pub height: f64,
    pub padding: Option<EdgeInsets>,
    pub text_style: Option<TextStyle>,
    pub label_text_style: Option<WidgetStatePropertyRef<Option<TextStyle>>>,
    pub mouse_cursor: Option<MouseCursorRef>,
    pub child: Option<WidgetRef>,
}
Expand description

The fields of Dart’s PopupMenuItem<T>, which PopupMenuItem and its subclasses, such as CheckedPopupMenuItem, carry under the field popup_menu_item.

Fields§

§key: Option<KeyRef>§value: Option<T>

The value that will be returned by ShowMenu if this entry is selected.

§on_tap: Option<Listener>

Called when the menu item is tapped.

§enabled: bool

Whether the user is permitted to select this item.

Defaults to true. If this is false, then the item will not react to touches.

§height: f64

The minimum height of the menu item.

Defaults to K_MIN_INTERACTIVE_DIMENSION pixels.

§padding: Option<EdgeInsets>

The padding of the menu item.

The height property may interact with the applied padding. For example, If a height greater than the height of the sum of the padding and child is provided, then the padding’s effect will not be visible.

If this is None and ThemeData::use_material3 is true, the horizontal padding defaults to 12.0 on both sides.

If this is None and ThemeData::use_material3 is false, the horizontal padding defaults to 16.0 on both sides.

§text_style: Option<TextStyle>

The text style of the popup menu item.

If this property is None, then PopupMenuThemeData::text_style is used. If PopupMenuThemeData::text_style is also None, then TextTheme::title_medium of ThemeData::text_theme is used.

§label_text_style: Option<WidgetStatePropertyRef<Option<TextStyle>>>

The label style of the popup menu item.

When ThemeData::use_material3 is true, this styles the text of the popup menu item.

If this property is None, then PopupMenuThemeData::label_text_style is used. If PopupMenuThemeData::label_text_style is also None, then TextTheme::label_large is used with the ColorScheme::on_surface color when popup menu item is enabled and the ColorScheme::on_surface color with 0.38 opacity when the popup menu item is disabled.

§mouse_cursor: Option<MouseCursorRef>

{@template material_ui.popupmenu.mouseCursor} The cursor for a mouse pointer when it enters or is hovering over the widget.

If mouse_cursor is a WidgetStateMouseCursor, WidgetStateProperty::resolve is used for the following WidgetStates:

{@endtemplate}

If None, then the value of PopupMenuThemeData::mouse_cursor is used. If that is also None, then WidgetStateMouseCursor::adaptive_clickable is used.

§child: Option<WidgetRef>

The widget below this widget in the tree.

Typically a single-line ListTile (for menus with icons) or a Text. An appropriate DefaultTextStyle is put in scope for the child. In either case, the text should be short enough that it won’t wrap.

Implementations§

Source§

impl<T> PopupMenuItemData<T>

Source

pub fn new(child: Option<WidgetRef>) -> PopupMenuItemData<T>

The fields of an item showing child, with Dart’s defaults.

Trait Implementations§

Source§

impl<T: Debug> Debug for PopupMenuItemData<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !RefUnwindSafe for PopupMenuItemData<T>

§

impl<T> !Send for PopupMenuItemData<T>

§

impl<T> !Sync for PopupMenuItemData<T>

§

impl<T> !UnwindSafe for PopupMenuItemData<T>

§

impl<T> Forget for PopupMenuItemData<T>

§

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

§

impl<T> Unpin for PopupMenuItemData<T>

§

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