pub struct DropdownMenuItem<T: 'static> {
pub key: Option<KeyRef>,
pub on_tap: Option<Listener>,
pub value: Option<T>,
pub enabled: bool,
pub alignment: AlignmentGeometry,
pub child: WidgetRef,
}Expand description
An item in a menu created by a DropdownButton.
The type T is the type of the value the entry represents. All the entries in a given menu
must represent values with consistent types.
Fields§
§key: Option<KeyRef>§on_tap: Option<Listener>Called when the dropdown menu item is tapped.
value: Option<T>The value to return if the user selects this menu item.
Eventually returned in a call to DropdownButton::on_changed.
enabled: boolWhether or not a user can select this menu item.
Defaults to true.
alignment: AlignmentGeometryDefines how the item is positioned within the container.
Defaults to AlignmentDirectional::CENTER_START.
child: WidgetRefThe widget below this widget in the tree.
Typically a Text widget.
Implementations§
Source§impl<T: 'static> DropdownMenuItem<T>
impl<T: 'static> DropdownMenuItem<T>
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> DropdownMenuItem<T>
pub fn new<K>(child: impl IntoWidget<K>) -> DropdownMenuItem<T>
Creates an item for a dropdown menu.
Sourcepub fn key(self, key: KeyRef) -> DropdownMenuItem<T>
pub fn key(self, key: KeyRef) -> DropdownMenuItem<T>
Dart DropdownMenuItem(key:).
Sourcepub fn on_tap(self, on_tap: Listener) -> DropdownMenuItem<T>
pub fn on_tap(self, on_tap: Listener) -> DropdownMenuItem<T>
Dart DropdownMenuItem(onTap:).
Sourcepub fn value(self, value: T) -> DropdownMenuItem<T>
pub fn value(self, value: T) -> DropdownMenuItem<T>
Dart DropdownMenuItem(value:).
Sourcepub fn enabled(self, enabled: bool) -> DropdownMenuItem<T>
pub fn enabled(self, enabled: bool) -> DropdownMenuItem<T>
Dart DropdownMenuItem(enabled:).
Sourcepub fn alignment(self, alignment: AlignmentGeometry) -> DropdownMenuItem<T>
pub fn alignment(self, alignment: AlignmentGeometry) -> DropdownMenuItem<T>
Dart DropdownMenuItem(alignment:).
Trait Implementations§
Source§impl<T: Clone + 'static> Clone for DropdownMenuItem<T>
impl<T: Clone + 'static> Clone for DropdownMenuItem<T>
Source§fn clone(&self) -> DropdownMenuItem<T>
fn clone(&self) -> DropdownMenuItem<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: Debug + 'static> Debug for DropdownMenuItem<T>
impl<T: Debug + 'static> Debug for DropdownMenuItem<T>
Source§impl<T: Debug + 'static> StatelessWidget for DropdownMenuItem<T>
impl<T: Debug + 'static> StatelessWidget for DropdownMenuItem<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 DropdownMenuItem<T>
impl<T> !Send for DropdownMenuItem<T>
impl<T> !Sync for DropdownMenuItem<T>
impl<T> !UnwindSafe for DropdownMenuItem<T>
impl<T> Forget for DropdownMenuItem<T>
impl<T> Freeze for DropdownMenuItem<T>where
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
NonZero<u32>: Freeze,
*const (): Freeze,
T: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
impl<T> Move for DropdownMenuItem<T>
impl<T> Unpin for DropdownMenuItem<T>
impl<T> UnsafeUnpin for DropdownMenuItem<T>where
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const (): UnsafeUnpin,
T: 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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.