Widgets

DropdownM2

DropdownM2

DropdownM2 control. Build it with the dropdown_m2 helper.

Example

dropdown_m2(
  value: "Sample",
  label: "Label",
  icon: "add",
  options: [],
  on_click: ->(event) {}
)

Properties

  • align_label_with_hint — Sets the align label with hint property.
  • alignment — Alignment of the content within the control.
  • autofocus — Requests focus when first shown.
  • bgcolor — Background color.
  • border — Border definition.
  • border_color — Border color.
  • border_radius — Corner radius.
  • border_width — Border thickness.
  • collapsed — Sets the collapsed property.
  • color — Foreground color.
  • content_padding — Content padding.
  • counter — Sets the counter property.
  • counter_style — Counter style.
  • dense — Sets the dense property.
  • disabled_hint_content — Sets the disabled hint content property.
  • elevation — Shadow depth (z-height).
  • enable_feedback — Plays touch feedback (sound/haptic) on interaction.
  • error — Sets the error property.
  • error_max_lines — Sets the error max lines property.
  • error_style — Error style.
  • fill_color — Fill color.
  • filled — Sets the filled property.
  • fit_parent_size — Sets the fit parent size property.
  • focus_color — Color shown while focused.
  • focused_bgcolor — Focused background color.
  • focused_border_color — Focused border color.
  • focused_border_width — Focused border width.
  • focused_color — Focused color.
  • helper — Sets the helper property.
  • helper_max_lines — Sets the helper max lines property.
  • helper_style — Helper style.
  • hint_content — Sets the hint content property.
  • hint_fade_duration — Sets the hint fade duration property.
  • hint_max_lines — Sets the hint max lines property.
  • hint_style — Hint style.
  • hint_text — Placeholder shown when the field is empty.
  • hover_color — Color shown while hovered.
  • icon — Icon name shown by the control.
  • item_height — Item height.
  • label — Text label shown for the control.
  • label_style — Label style.
  • max_menu_height — Max menu height.
  • options — The selectable options (built with the control's option helper).
  • options_fill_horizontally — Sets the options fill horizontally property.
  • padding — Inner spacing between the border and the content.
  • prefix — Sets the prefix property.
  • prefix_icon — Prefix icon.
  • prefix_icon_size_constraints — Sets the prefix icon size constraints property.
  • prefix_style — Prefix style.
  • select_icon — Select icon.
  • select_icon_disabled_color — Select icon disabled color.
  • select_icon_enabled_color — Select icon enabled color.
  • select_icon_size — Sets the select icon size property.
  • size_constraints — Min/max size constraints.
  • suffix — Sets the suffix property.
  • suffix_icon — Suffix icon.
  • suffix_icon_size_constraints — Sets the suffix icon size constraints property.
  • suffix_style — Suffix style.
  • text_size — Sets the text size property.
  • text_style — Text style.
  • text_vertical_align — Sets the text vertical align property.
  • value — The control's current value.

Common layout and animation properties

  • align — Alignment of the control within its parent.
  • animate_align — Animates alignment changes.
  • animate_margin — Animates margin changes.
  • animate_offset — Animates offset changes.
  • animate_opacity — Animates opacity changes.
  • animate_position — Animates position changes.
  • animate_rotation — Animates rotation changes.
  • animate_scale — Animates scale changes.
  • animate_size — Animates size changes.
  • aspect_ratio — Width-to-height ratio to maintain.
  • badge — Badge drawn on the corner of the control.
  • bottom — Bottom offset when positioned inside a stack.
  • col — Responsive column span (1-12) per breakpoint.
  • data — Arbitrary value you can attach to the control and read back in handlers.
  • disabled — Disables interaction when true.
  • expand — Fills the available space along the parent's main axis when true.
  • expand_loose — Like expand, but only grows up to the child's natural size.
  • height — Fixed height in logical pixels.
  • key — Stable identity used to preserve state across rebuilds.
  • left — Left offset when positioned inside a stack.
  • margin — Outer spacing around the control.
  • offset — Translation offset applied to the control.
  • opacity — Opacity from 0.0 (transparent) to 1.0 (opaque).
  • right — Right offset when positioned inside a stack.
  • rotate — Rotation applied to the control.
  • rtl — Renders right-to-left when true.
  • scale — Scale transform applied to the control.
  • size_change_interval — Throttle interval for on_size_change, in ms.
  • tooltip — Text shown on hover/long-press.
  • top — Top offset when positioned inside a stack.
  • visible — Hides the control when false.
  • width — Fixed width in logical pixels.

Events

  • on_animation_end — Fired when an animation completes.
  • on_blur — Fired when the control loses focus.
  • on_change — Fired when the value changes.
  • on_click — Fired when the control is clicked/tapped.
  • on_focus — Fired when the control gains focus.
  • on_size_change — Fired when the control's size changes.

Reference

  • Family: materials
  • Widget type: dropdownm2
  • Helpers: dropdown_m2, dropdownm2