pub struct SearchBar {Show 31 fields
pub key: Option<KeyRef>,
pub controller: Option<TextEditingControllerRef>,
pub focus_node: Option<FocusNodeRef>,
pub hint_text: Option<String>,
pub leading: Option<WidgetRef>,
pub trailing: Option<Vec<WidgetRef>>,
pub on_tap: Option<Listener>,
pub on_tap_outside: Option<TapRegionCallback>,
pub on_changed: Option<ValueChanged<String>>,
pub on_submitted: Option<ValueChanged<String>>,
pub constraints: Option<BoxConstraints>,
pub elevation: Option<WidgetStatePropertyRef<Option<f64>>>,
pub background_color: Option<WidgetStatePropertyRef<Option<Color>>>,
pub shadow_color: Option<WidgetStatePropertyRef<Option<Color>>>,
pub surface_tint_color: Option<WidgetStatePropertyRef<Option<Color>>>,
pub overlay_color: Option<WidgetStatePropertyRef<Option<Color>>>,
pub side: Option<WidgetStatePropertyRef<Option<BorderSide>>>,
pub shape: Option<WidgetStatePropertyRef<Option<OutlinedBorderRef>>>,
pub padding: Option<WidgetStatePropertyRef<Option<EdgeInsetsGeometry>>>,
pub text_style: Option<WidgetStatePropertyRef<Option<TextStyle>>>,
pub hint_style: Option<WidgetStatePropertyRef<Option<TextStyle>>>,
pub text_capitalization: Option<TextCapitalization>,
pub enabled: bool,
pub auto_focus: bool,
pub text_input_action: Option<TextInputAction>,
pub keyboard_type: Option<TextInputType>,
pub scroll_padding: EdgeInsets,
pub context_menu_builder: Option<EditableTextContextMenuBuilder>,
pub read_only: bool,
pub smart_dashes_type: Option<SmartDashesType>,
pub smart_quotes_type: Option<SmartQuotesType>,
}Expand description
A Material Design search bar.
A SearchBar looks like a TextField. Pressing the SearchBar typically shows a
search view route. Users can type the search query in the search view.
See also:
SearchAnchor, a widget that typically shows aSearchBarand, when tapped, displays a search view.SearchBarTheme, a widget that overrides the default configuration of a search bar.SearchViewTheme, a widget that overrides the default configuration of a search view.
Fields§
§key: Option<KeyRef>§controller: Option<TextEditingControllerRef>Controls the text being edited in the search bar’s text field.
focus_node: Option<FocusNodeRef>Defines the keyboard focus for this widget.
hint_text: Option<String>Text that suggests what sort of input the field accepts.
Displayed at the same location on the screen where text may be entered when the input is empty.
leading: Option<WidgetRef>A widget to display before the text input field.
Typically the leading widget is an Icon or an IconButton.
trailing: Option<Vec<WidgetRef>>A list of widgets to display in a row after the text field.
Typically these actions can represent additional modes of searching (like voice search), an avatar, or an overflow menu. There should not be more than two trailing actions.
on_tap: Option<Listener>Called when the user taps this search bar.
on_tap_outside: Option<TapRegionCallback>Called when the user taps outside the search bar’s text field.
on_changed: Option<ValueChanged<String>>Invoked upon user input.
on_submitted: Option<ValueChanged<String>>Called when the user indicates that they are done editing the text in the field.
constraints: Option<BoxConstraints>Optional size constraints for the search bar.
If null, the value of [SearchBarThemeData::constraints] will be used. If that is
also null, then the constraints defaults to:
BoxConstraints { min_width: 360.0, max_width: 800.0, min_height: 56.0, .. }.
elevation: Option<WidgetStatePropertyRef<Option<f64>>>The elevation of the search bar’s Material.
If null, the value of [SearchBarThemeData::elevation] will be used. If that is also
null, then default value is 6.0.
background_color: Option<WidgetStatePropertyRef<Option<Color>>>The search bar’s background fill color.
If null, the value of [SearchBarThemeData::background_color] will be used. If that
is also null, then the default value is ColorScheme::surface_container_high.
shadow_color: Option<WidgetStatePropertyRef<Option<Color>>>The shadow color of the search bar’s Material.
If null, the value of [SearchBarThemeData::shadow_color] will be used. If that is
also null, then the default value is ColorScheme::shadow.
surface_tint_color: Option<WidgetStatePropertyRef<Option<Color>>>The surface tint color of the search bar’s Material.
If null, the value of [SearchBarThemeData::surface_tint_color] will be used. If that
is also null, then the default value is Colors::TRANSPARENT.
overlay_color: Option<WidgetStatePropertyRef<Option<Color>>>The highlight color that’s typically used to indicate that the search bar is focused, hovered, or pressed.
side: Option<WidgetStatePropertyRef<Option<BorderSide>>>The color and weight of the search bar’s outline.
This value is combined with shape to create a shape decorated with an
outline.
shape: Option<WidgetStatePropertyRef<Option<OutlinedBorderRef>>>The shape of the search bar’s underlying Material.
This shape is combined with side to create a shape decorated with an
outline.
padding: Option<WidgetStatePropertyRef<Option<EdgeInsetsGeometry>>>The padding between the search bar’s boundary and its contents.
If null, the value of [SearchBarThemeData::padding] will be used. If that is also
null, then the default value is 8.0 horizontally.
text_style: Option<WidgetStatePropertyRef<Option<TextStyle>>>The style to use for the text being edited.
If null, defaults to the bodyLarge text style from the current Theme. The
default text color is ColorScheme::on_surface.
hint_style: Option<WidgetStatePropertyRef<Option<TextStyle>>>The style to use for the hint_text.
If null, the value of [SearchBarThemeData::hint_style] will be used. If that is also
null, the value of text_style will be used, and then
bodyLarge.
text_capitalization: Option<TextCapitalization>Configures how the platform keyboard will select an uppercase or lowercase keyboard.
Defaults to TextCapitalization::None.
enabled: boolIf false the text field is “disabled”: it ignores taps and its decoration is rendered in grey.
auto_focus: boolWhether this text field should focus itself if nothing else is already focused.
text_input_action: Option<TextInputAction>The type of action button to use for the keyboard.
keyboard_type: Option<TextInputType>The type of action button to use for the keyboard.
scroll_padding: EdgeInsetsConfigures padding to edges surrounding a Scrollable when
the text field scrolls into view.
Builds the text selection toolbar when requested by the user.
See also:
SearchBar::default_context_menu_builder, which is the default context menu builder.
read_only: boolWhether this text field is read only.
smart_dashes_type: Option<SmartDashesType>Whether to allow the platform to automatically format dashes.
smart_quotes_type: Option<SmartQuotesType>Whether to allow the platform to automatically format quotes.
Implementations§
Source§impl SearchBar
impl SearchBar
Sourcepub fn controller(self, controller: TextEditingControllerRef) -> SearchBar
pub fn controller(self, controller: TextEditingControllerRef) -> SearchBar
Dart SearchBar(controller:).
Sourcepub fn focus_node(self, focus_node: FocusNodeRef) -> SearchBar
pub fn focus_node(self, focus_node: FocusNodeRef) -> SearchBar
Dart SearchBar(focusNode:).
Sourcepub fn leading<K>(self, leading: impl IntoWidget<K>) -> SearchBar
pub fn leading<K>(self, leading: impl IntoWidget<K>) -> SearchBar
Dart SearchBar(leading:).
Sourcepub fn on_tap_outside(self, on_tap_outside: TapRegionCallback) -> SearchBar
pub fn on_tap_outside(self, on_tap_outside: TapRegionCallback) -> SearchBar
Dart SearchBar(onTapOutside:).
Sourcepub fn on_changed(
self,
on_changed: impl Fn(&mut App, String) + 'static,
) -> SearchBar
pub fn on_changed( self, on_changed: impl Fn(&mut App, String) + 'static, ) -> SearchBar
Dart SearchBar(onChanged:).
Sourcepub fn on_submitted(
self,
on_submitted: impl Fn(&mut App, String) + 'static,
) -> SearchBar
pub fn on_submitted( self, on_submitted: impl Fn(&mut App, String) + 'static, ) -> SearchBar
Dart SearchBar(onSubmitted:).
Sourcepub fn constraints(self, constraints: BoxConstraints) -> SearchBar
pub fn constraints(self, constraints: BoxConstraints) -> SearchBar
Dart SearchBar(constraints:).
Sourcepub fn elevation(
self,
elevation: WidgetStatePropertyRef<Option<f64>>,
) -> SearchBar
pub fn elevation( self, elevation: WidgetStatePropertyRef<Option<f64>>, ) -> SearchBar
Dart SearchBar(elevation:).
Sourcepub fn background_color(
self,
background_color: WidgetStatePropertyRef<Option<Color>>,
) -> SearchBar
pub fn background_color( self, background_color: WidgetStatePropertyRef<Option<Color>>, ) -> SearchBar
Dart SearchBar(backgroundColor:).
Sourcepub fn shadow_color(
self,
shadow_color: WidgetStatePropertyRef<Option<Color>>,
) -> SearchBar
pub fn shadow_color( self, shadow_color: WidgetStatePropertyRef<Option<Color>>, ) -> SearchBar
Dart SearchBar(shadowColor:).
Sourcepub fn surface_tint_color(
self,
surface_tint_color: WidgetStatePropertyRef<Option<Color>>,
) -> SearchBar
pub fn surface_tint_color( self, surface_tint_color: WidgetStatePropertyRef<Option<Color>>, ) -> SearchBar
Dart SearchBar(surfaceTintColor:).
Sourcepub fn overlay_color(
self,
overlay_color: WidgetStatePropertyRef<Option<Color>>,
) -> SearchBar
pub fn overlay_color( self, overlay_color: WidgetStatePropertyRef<Option<Color>>, ) -> SearchBar
Dart SearchBar(overlayColor:).
Sourcepub fn side(self, side: WidgetStatePropertyRef<Option<BorderSide>>) -> SearchBar
pub fn side(self, side: WidgetStatePropertyRef<Option<BorderSide>>) -> SearchBar
Dart SearchBar(side:).
Sourcepub fn shape(
self,
shape: WidgetStatePropertyRef<Option<OutlinedBorderRef>>,
) -> SearchBar
pub fn shape( self, shape: WidgetStatePropertyRef<Option<OutlinedBorderRef>>, ) -> SearchBar
Dart SearchBar(shape:).
Sourcepub fn padding(
self,
padding: WidgetStatePropertyRef<Option<EdgeInsetsGeometry>>,
) -> SearchBar
pub fn padding( self, padding: WidgetStatePropertyRef<Option<EdgeInsetsGeometry>>, ) -> SearchBar
Dart SearchBar(padding:).
Sourcepub fn text_style(
self,
text_style: WidgetStatePropertyRef<Option<TextStyle>>,
) -> SearchBar
pub fn text_style( self, text_style: WidgetStatePropertyRef<Option<TextStyle>>, ) -> SearchBar
Dart SearchBar(textStyle:).
Sourcepub fn hint_style(
self,
hint_style: WidgetStatePropertyRef<Option<TextStyle>>,
) -> SearchBar
pub fn hint_style( self, hint_style: WidgetStatePropertyRef<Option<TextStyle>>, ) -> SearchBar
Dart SearchBar(hintStyle:).
Sourcepub fn text_capitalization(
self,
text_capitalization: TextCapitalization,
) -> SearchBar
pub fn text_capitalization( self, text_capitalization: TextCapitalization, ) -> SearchBar
Dart SearchBar(textCapitalization:).
Sourcepub fn auto_focus(self, auto_focus: bool) -> SearchBar
pub fn auto_focus(self, auto_focus: bool) -> SearchBar
Dart SearchBar(autoFocus:).
Sourcepub fn text_input_action(self, text_input_action: TextInputAction) -> SearchBar
pub fn text_input_action(self, text_input_action: TextInputAction) -> SearchBar
Dart SearchBar(textInputAction:).
Sourcepub fn keyboard_type(self, keyboard_type: TextInputType) -> SearchBar
pub fn keyboard_type(self, keyboard_type: TextInputType) -> SearchBar
Dart SearchBar(keyboardType:).
Sourcepub fn scroll_padding(self, scroll_padding: EdgeInsets) -> SearchBar
pub fn scroll_padding(self, scroll_padding: EdgeInsets) -> SearchBar
Dart SearchBar(scrollPadding:).
Dart SearchBar(contextMenuBuilder:).
Sourcepub fn smart_dashes_type(self, smart_dashes_type: SmartDashesType) -> SearchBar
pub fn smart_dashes_type(self, smart_dashes_type: SmartDashesType) -> SearchBar
Dart SearchBar(smartDashesType:).
Sourcepub fn smart_quotes_type(self, smart_quotes_type: SmartQuotesType) -> SearchBar
pub fn smart_quotes_type(self, smart_quotes_type: SmartQuotesType) -> SearchBar
Dart SearchBar(smartQuotesType:).
Dart’s _defaultContextMenuBuilder.
Trait Implementations§
Source§impl StatefulWidget for SearchBar
impl StatefulWidget for SearchBar
Source§type State = SearchBarState
type State = SearchBarState
Source§fn create_state(&self) -> SearchBarState
fn create_state(&self) -> SearchBarState
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 as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for SearchBar
impl !Send for SearchBar
impl !Sync for SearchBar
impl !UnwindSafe for SearchBar
impl Forget for SearchBar
impl Freeze for SearchBarwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
NonZero<u32>: Freeze,
&'static TextEditingControllerVTable: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
&'static FocusNodeVTable: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
PhantomData<Rc<dyn Widget>>: Freeze,
*const RcInner<dyn Fn(&mut App)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze,
*const (): Freeze,
*const RcInner<dyn Fn(&mut App, PointerDownEvent)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, PointerDownEvent)>>: Freeze,
*const RcInner<dyn Fn(&mut App, String)> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, String)>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: Freeze,
*const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: Freeze,
PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, Handle<EditableTextState>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Handle<EditableTextState>) -> Rc<dyn Widget>>>: Freeze,
impl Move for SearchBar
impl Unpin for SearchBarwhere
Rc<dyn Key>: Unpin,
NonZero<u32>: Unpin,
&'static TextEditingControllerVTable: Unpin,
Rc<Keep>: Unpin,
&'static FocusNodeVTable: Unpin,
*const u8 is !null: Unpin,
Rc<dyn Widget>: Unpin,
Rc<dyn Fn(&mut App)>: Unpin,
*const (): Unpin,
Rc<dyn Fn(&mut App, PointerDownEvent)>: Unpin,
Rc<dyn Fn(&mut App, String)>: Unpin,
Rc<dyn WidgetStateProperty<Option<f64>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<Color>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<BorderSide>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>: Unpin,
Rc<dyn WidgetStateProperty<Option<TextStyle>>>: Unpin,
Rc<dyn Fn(&mut App, AnyElement, Handle<EditableTextState>) -> Rc<dyn Widget>>: Unpin,
impl UnsafeUnpin for SearchBarwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
&'static TextEditingControllerVTable: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
&'static FocusNodeVTable: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
PhantomData<Rc<dyn Widget>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin,
*const (): UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, PointerDownEvent)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, PointerDownEvent)>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, String)> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, String)>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<f64>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<f64>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<BorderSide>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<BorderSide>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<OutlinedBorderRef>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<EdgeInsetsGeometry>>>>: UnsafeUnpin,
*const RcInner<dyn WidgetStateProperty<Option<TextStyle>>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn WidgetStateProperty<Option<TextStyle>>>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, Handle<EditableTextState>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Handle<EditableTextState>) -> Rc<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<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.