Widgets

SearchBar

SearchBar

SearchBar control. Build it with the search_bar helper.

Example

search_bar(
  value: "Sample",
  expand: true,
  width: 240,
  height: 120,
  on_change: ->(event) {}
)

Properties

  • autofocus — Requests focus when first shown.
  • bar_bgcolor — Bar background color.
  • bar_border_side — Sets the bar border side property.
  • bar_elevation — Sets the bar elevation property.
  • bar_hint_text — Bar hint text.
  • bar_hint_text_style — Bar hint text style.
  • bar_leading — Sets the bar leading property.
  • bar_overlay_color — Bar overlay color.
  • bar_padding — Bar padding.
  • bar_scroll_padding — Bar scroll padding.
  • bar_shadow_color — Bar shadow color.
  • bar_shape — Sets the bar shape property.
  • bar_size_constraints — Sets the bar size constraints property.
  • bar_text_style — Bar text style.
  • bar_trailing — Sets the bar trailing property.
  • capitalization — Sets the capitalization property.
  • controls — The list of child controls.
  • divider_color — Divider color.
  • full_screen — Sets the full screen property.
  • keyboard_type — On-screen keyboard type (e.g. number, email).
  • shrink_wrap — Sets the shrink wrap property.
  • value — The control's current value.
  • view_bar_padding — View bar padding.
  • view_bgcolor — View background color.
  • view_elevation — Sets the view elevation property.
  • view_header_height — View header height.
  • view_header_text_style — View header text style.
  • view_hint_text — View hint text.
  • view_hint_text_style — View hint text style.
  • view_leading — Sets the view leading property.
  • view_padding — View padding.
  • view_shape — Sets the view shape property.
  • view_side — Sets the view side property.
  • view_size_constraints — Sets the view size constraints property.
  • view_trailing — Sets the view trailing property.

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_focus — Fired when the control gains focus.
  • on_size_change — Fired when the control's size changes.
  • on_submit — Fired when the input is submitted.
  • on_tap — Fired on a tap.
  • on_tap_outside_bar — Fired on tap outside bar.

Methods

  • close_view(text = ..., timeout: ..., on_result: ...)
  • focus(timeout: ..., on_result: ...)
  • open_view(timeout: ..., on_result: ...)

Reference

  • Family: materials
  • Widget type: searchbar
  • Helpers: search_bar, searchbar