pub struct DropdownMenuEntry<T> {
pub value: T,
pub label: String,
pub label_widget: Option<WidgetRef>,
pub leading_icon: Option<WidgetRef>,
pub trailing_icon: Option<WidgetRef>,
pub enabled: bool,
pub style: Option<ButtonStyle>,
}Expand description
Defines a DropdownMenu menu button that represents one item view in the menu.
See also:
Fields§
§value: Tthe value used to identify the entry.
This value must be unique across all entries in a DropdownMenu.
label: StringThe label displayed in the center of the menu item.
label_widget: Option<WidgetRef>Overrides the default label widget which is Text(label).
This widget is only displayed in the open dropdown menu. When an item is selected, the
menu closes and the text field displays the plain text of the label.
The dropdown menu’s closed state is a text field or a read-only text field on mobile,
which can only display text. While custom widgets like icons or images can be shown
in label_widget when the menu is open, the text field will only
show the label string upon selection.
To control the text that appears in the text field for a selected item, set the
label property to a descriptive string.
leading_icon: Option<WidgetRef>An optional icon to display before the label.
trailing_icon: Option<WidgetRef>An optional icon to display after the label.
enabled: boolWhether the menu item is enabled or disabled.
The default value is true. If true, the label will be filled out in
the text field of the DropdownMenu when this entry is clicked; otherwise, this
entry is disabled.
style: Option<ButtonStyle>Customizes this menu item’s appearance.
Null by default.
Implementations§
Source§impl<T> DropdownMenuEntry<T>
impl<T> DropdownMenuEntry<T>
Sourcepub fn new(value: T, label: impl Into<String>) -> DropdownMenuEntry<T>
pub fn new(value: T, label: impl Into<String>) -> DropdownMenuEntry<T>
Creates an entry that is used with DropdownMenu::dropdown_menu_entries.
Sourcepub fn label_widget<K>(
self,
label_widget: impl IntoWidget<K>,
) -> DropdownMenuEntry<T>
pub fn label_widget<K>( self, label_widget: impl IntoWidget<K>, ) -> DropdownMenuEntry<T>
Dart DropdownMenuEntry(labelWidget:).
Sourcepub fn leading_icon<K>(
self,
leading_icon: impl IntoWidget<K>,
) -> DropdownMenuEntry<T>
pub fn leading_icon<K>( self, leading_icon: impl IntoWidget<K>, ) -> DropdownMenuEntry<T>
Dart DropdownMenuEntry(leadingIcon:).
Sourcepub fn trailing_icon<K>(
self,
trailing_icon: impl IntoWidget<K>,
) -> DropdownMenuEntry<T>
pub fn trailing_icon<K>( self, trailing_icon: impl IntoWidget<K>, ) -> DropdownMenuEntry<T>
Dart DropdownMenuEntry(trailingIcon:).
Sourcepub fn enabled(self, enabled: bool) -> DropdownMenuEntry<T>
pub fn enabled(self, enabled: bool) -> DropdownMenuEntry<T>
Dart DropdownMenuEntry(enabled:).
Sourcepub fn style(self, style: ButtonStyle) -> DropdownMenuEntry<T>
pub fn style(self, style: ButtonStyle) -> DropdownMenuEntry<T>
Dart DropdownMenuEntry(style:).