Skip to main content

FilterChip

Struct FilterChip 

Source
pub struct FilterChip {
Show 37 fields pub key: Option<KeyRef>, pub avatar: Option<WidgetRef>, pub label: WidgetRef, pub label_style: Option<TextStyle>, pub label_padding: Option<EdgeInsetsGeometry>, pub selected: bool, pub on_selected: Option<ValueChanged<bool>>, pub delete_icon: Option<WidgetRef>, pub on_deleted: Option<Listener>, pub delete_icon_color: Option<AnyColor>, pub delete_button_tooltip_message: Option<String>, pub press_elevation: Option<f64>, pub disabled_color: Option<Color>, pub selected_color: Option<Color>, pub tooltip: Option<String>, pub side: Option<AnyBorderSide>, pub shape: Option<OutlinedBorderRef>, pub clip_behavior: Clip, pub focus_node: Option<FocusNodeRef>, pub autofocus: bool, pub color: Option<WidgetStatePropertyRef<Option<Color>>>, pub background_color: Option<Color>, pub padding: Option<EdgeInsetsGeometry>, pub visual_density: Option<VisualDensity>, pub material_tap_target_size: Option<MaterialTapTargetSize>, pub elevation: Option<f64>, pub shadow_color: Option<Color>, pub surface_tint_color: Option<Color>, pub icon_theme: Option<IconThemeData>, pub selected_shadow_color: Option<Color>, pub show_checkmark: Option<bool>, pub checkmark_color: Option<Color>, pub avatar_border: ShapeBorderRef, pub avatar_box_constraints: Option<BoxConstraints>, pub delete_icon_box_constraints: Option<BoxConstraints>, pub chip_animation_style: Option<ChipAnimationStyle>, pub mouse_cursor: Option<MouseCursorRef>, /* private fields */
}
Expand description

A Material Design filter chip.

Filter chips use tags or descriptive words as a way to filter content.

Filter chips are a good alternative to Checkbox or Switch widgets. Unlike these alternatives, filter chips allow for clearly delineated and exposed options in a compact area.

Requires one of its ancestors to be a Material widget.

§Material Design 3

FilterChip can be used for multiple select Filter chips from Material Design 3. If ThemeData::use_material3 is true, then FilterChip will be styled to match the Material Design 3 specification for Filter chips. Use ChoiceChip for single select Filter chips.

See also:

  • Chip, a chip that displays information and can be deleted.
  • InputChip, a chip that represents a complex piece of information, such as an entity (person, place, or thing) or conversational text, in a compact form.
  • ChoiceChip, allows a single selection from a set of options. Choice chips contain related descriptive text or categories.
  • ActionChip, represents an action related to primary content.
  • CircleAvatar, which shows images or initials of people.
  • Wrap, A widget that displays its children in multiple horizontal or vertical runs.
  • https://material.io/design/components/chips.html

Fields§

§key: Option<KeyRef>§avatar: Option<WidgetRef>§label: WidgetRef§label_style: Option<TextStyle>§label_padding: Option<EdgeInsetsGeometry>§selected: bool§on_selected: Option<ValueChanged<bool>>§delete_icon: Option<WidgetRef>§on_deleted: Option<Listener>§delete_icon_color: Option<AnyColor>§delete_button_tooltip_message: Option<String>§press_elevation: Option<f64>§disabled_color: Option<Color>§selected_color: Option<Color>§tooltip: Option<String>§side: Option<AnyBorderSide>§shape: Option<OutlinedBorderRef>§clip_behavior: Clip§focus_node: Option<FocusNodeRef>§autofocus: bool§color: Option<WidgetStatePropertyRef<Option<Color>>>§background_color: Option<Color>§padding: Option<EdgeInsetsGeometry>§visual_density: Option<VisualDensity>§material_tap_target_size: Option<MaterialTapTargetSize>§elevation: Option<f64>§shadow_color: Option<Color>§surface_tint_color: Option<Color>§icon_theme: Option<IconThemeData>§selected_shadow_color: Option<Color>§show_checkmark: Option<bool>§checkmark_color: Option<Color>§avatar_border: ShapeBorderRef§avatar_box_constraints: Option<BoxConstraints>§delete_icon_box_constraints: Option<BoxConstraints>§chip_animation_style: Option<ChipAnimationStyle>§mouse_cursor: Option<MouseCursorRef>

Implementations§

Source§

impl FilterChip

Source

pub fn new<K>( label: impl IntoWidget<K>, on_selected: Option<ValueChanged<bool>>, ) -> FilterChip

Create a chip that acts like a checkbox.

The elevation and press_elevation must be null or non-negative. Dart’s named arguments are the setters.

Source

pub fn elevated<K>( label: impl IntoWidget<K>, on_selected: Option<ValueChanged<bool>>, ) -> FilterChip

Create an elevated chip that acts like a checkbox.

The elevation and press_elevation must be null or non-negative. Dart’s named arguments are the setters.

Source

pub fn key(self, key: KeyRef) -> FilterChip

Dart FilterChip(key:).

Source

pub fn label_style(self, label_style: TextStyle) -> FilterChip

Dart FilterChip(label_style:).

Source

pub fn on_deleted(self, on_deleted: Listener) -> FilterChip

Dart FilterChip(on_deleted:).

Source

pub fn delete_button_tooltip_message( self, delete_button_tooltip_message: String, ) -> FilterChip

Dart FilterChip(delete_button_tooltip_message:).

Source

pub fn disabled_color(self, disabled_color: Color) -> FilterChip

Dart FilterChip(disabled_color:).

Source

pub fn selected_color(self, selected_color: Color) -> FilterChip

Dart FilterChip(selected_color:).

Source

pub fn tooltip(self, tooltip: String) -> FilterChip

Dart FilterChip(tooltip:).

Source

pub fn focus_node(self, focus_node: FocusNodeRef) -> FilterChip

Dart FilterChip(focus_node:).

Source

pub fn color(self, color: WidgetStatePropertyRef<Option<Color>>) -> FilterChip

Dart FilterChip(color:).

Source

pub fn background_color(self, background_color: Color) -> FilterChip

Dart FilterChip(background_color:).

Source

pub fn visual_density(self, visual_density: VisualDensity) -> FilterChip

Dart FilterChip(visual_density:).

Source

pub fn material_tap_target_size( self, material_tap_target_size: MaterialTapTargetSize, ) -> FilterChip

Dart FilterChip(material_tap_target_size:).

Source

pub fn shadow_color(self, shadow_color: Color) -> FilterChip

Dart FilterChip(shadow_color:).

Source

pub fn surface_tint_color(self, surface_tint_color: Color) -> FilterChip

Dart FilterChip(surface_tint_color:).

Source

pub fn icon_theme(self, icon_theme: IconThemeData) -> FilterChip

Dart FilterChip(icon_theme:).

Source

pub fn selected_shadow_color(self, selected_shadow_color: Color) -> FilterChip

Dart FilterChip(selected_shadow_color:).

Source

pub fn show_checkmark(self, show_checkmark: bool) -> FilterChip

Dart FilterChip(show_checkmark:).

Source

pub fn checkmark_color(self, checkmark_color: Color) -> FilterChip

Dart FilterChip(checkmark_color:).

Source

pub fn avatar_box_constraints( self, avatar_box_constraints: BoxConstraints, ) -> FilterChip

Dart FilterChip(avatar_box_constraints:).

Source

pub fn delete_icon_box_constraints( self, delete_icon_box_constraints: BoxConstraints, ) -> FilterChip

Dart FilterChip(delete_icon_box_constraints:).

Source

pub fn chip_animation_style( self, chip_animation_style: ChipAnimationStyle, ) -> FilterChip

Dart FilterChip(chip_animation_style:).

Source

pub fn mouse_cursor(self, mouse_cursor: MouseCursorRef) -> FilterChip

Dart FilterChip(mouse_cursor:).

Source

pub fn selected(self, selected: bool) -> FilterChip

Dart FilterChip(selected:).

Source

pub fn clip_behavior(self, clip_behavior: Clip) -> FilterChip

Dart FilterChip(clip_behavior:).

Source

pub fn autofocus(self, autofocus: bool) -> FilterChip

Dart FilterChip(autofocus:).

Source

pub fn avatar_border(self, avatar_border: ShapeBorderRef) -> FilterChip

Dart FilterChip(avatar_border:).

Source

pub fn avatar<K>(self, avatar: impl IntoWidget<K>) -> FilterChip

Dart FilterChip(avatar:).

Source

pub fn delete_icon<K>(self, delete_icon: impl IntoWidget<K>) -> FilterChip

Dart FilterChip(delete_icon:).

Source

pub fn label_padding( self, label_padding: impl Into<EdgeInsetsGeometry>, ) -> FilterChip

Dart FilterChip(label_padding:).

Source

pub fn side(self, side: impl Into<AnyBorderSide>) -> FilterChip

Dart FilterChip(side:).

Source

pub fn delete_icon_color( self, delete_icon_color: impl Into<AnyColor>, ) -> FilterChip

Dart FilterChip(delete_icon_color:).

Source

pub fn shape(self, shape: impl Into<OutlinedBorderRef>) -> FilterChip

Dart FilterChip(shape:).

Source

pub fn padding(self, padding: impl Into<EdgeInsetsGeometry>) -> FilterChip

Dart FilterChip(padding:).

Source

pub fn press_elevation(self, press_elevation: f64) -> FilterChip

Dart FilterChip(press_elevation:).

Source

pub fn elevation(self, elevation: f64) -> FilterChip

Dart FilterChip(elevation:).

Trait Implementations§

Source§

impl CheckmarkableChipAttributes for FilterChip

Source§

fn show_checkmark(&self) -> Option<bool>

Whether or not to show a check mark when SelectableChipAttributes::selected is true. Read more
Source§

fn checkmark_color(&self) -> Option<Color>

Color of the chip’s check mark when a check mark is visible. Read more
Source§

impl ChipAttributes for FilterChip

Source§

fn label(&self) -> &WidgetRef

The primary content of the chip. Read more
Source§

fn avatar(&self) -> Option<&WidgetRef>

A widget to display prior to the chip’s label. Read more
Source§

fn label_style(&self) -> Option<&TextStyle>

The style to be applied to the chip’s label. Read more
Source§

fn side(&self) -> Option<&AnyBorderSide>

The color and weight of the chip’s outline. Read more
Source§

fn shape(&self) -> Option<&OutlinedBorderRef>

The OutlinedBorder to draw around the chip. Read more
Source§

fn clip_behavior(&self) -> Clip

Defaults to Clip::None.
Source§

fn focus_node(&self) -> Option<&FocusNodeRef>

The focus node of the chip’s InkWell.
Source§

fn autofocus(&self) -> bool

Whether the chip’s InkWell should focus itself when it is built.
Source§

fn color(&self) -> Option<&WidgetStatePropertyRef<Option<Color>>>

The color that fills the chip, in all WidgetStates. Read more
Source§

fn background_color(&self) -> Option<Color>

Color to be used for the unselected, enabled chip’s background. Read more
Source§

fn padding(&self) -> Option<&EdgeInsetsGeometry>

The padding between the contents of the chip and the outside shape. Read more
Source§

fn visual_density(&self) -> Option<VisualDensity>

Defines how compact the chip’s layout will be. Read more
Source§

fn label_padding(&self) -> Option<&EdgeInsetsGeometry>

The padding around the label widget. Read more
Source§

fn material_tap_target_size(&self) -> Option<MaterialTapTargetSize>

Configures the minimum size of the tap target. Read more
Source§

fn elevation(&self) -> Option<f64>

Elevation to be applied on the chip relative to its parent. Read more
Source§

fn shadow_color(&self) -> Option<Color>

Color of the chip’s shadow when the elevation is greater than 0. Read more
Source§

fn surface_tint_color(&self) -> Option<Color>

Color of the chip’s surface tint overlay when its elevation is greater than 0. Read more
Source§

fn icon_theme(&self) -> Option<&IconThemeData>

Theme used for all icons in the chip. Read more
Source§

fn avatar_box_constraints(&self) -> Option<BoxConstraints>

Optional size constraints for the avatar. Read more
Source§

fn chip_animation_style(&self) -> Option<&ChipAnimationStyle>

Used to override the default chip animations durations. Read more
Source§

fn mouse_cursor(&self) -> Option<&MouseCursorRef>

The cursor for a mouse pointer when it enters or is hovering over the widget. Read more
Source§

impl Clone for FilterChip

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FilterChip

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DeletableChipAttributes for FilterChip

Source§

fn delete_icon(&self) -> Option<&WidgetRef>

The icon displayed when on_deleted is set. Read more
Source§

fn on_deleted(&self) -> Option<&Listener>

Called when the user taps the delete_icon to delete the chip. Read more
Source§

fn delete_icon_color(&self) -> Option<&AnyColor>

Used to define the delete icon’s color with an IconTheme that contains the icon. Read more
Source§

fn delete_button_tooltip_message(&self) -> Option<&str>

The message to be used for the chip’s delete button tooltip. Read more
Source§

fn delete_icon_box_constraints(&self) -> Option<BoxConstraints>

Optional size constraints for the delete icon. Read more
Source§

impl DisabledChipAttributes for FilterChip

Source§

fn is_enabled(&self) -> bool

Whether or not this chip is enabled for input. Read more
Source§

fn disabled_color(&self) -> Option<Color>

The color used for the chip’s background when it is disabled.
Source§

impl SelectableChipAttributes for FilterChip

Source§

fn selected(&self) -> bool

Whether or not this chip is selected. Read more
Source§

fn on_selected(&self) -> Option<&ValueChanged<bool>>

Called when the chip should change between selected and de-selected states. Read more
Source§

fn press_elevation(&self) -> Option<f64>

Elevation to be applied on the chip relative to its parent during the press motion. Read more
Source§

fn selected_color(&self) -> Option<Color>

Color to be used for the chip’s background, indicating that it is selected. Read more
Source§

fn selected_shadow_color(&self) -> Option<Color>

Color of the chip’s shadow when the elevation is greater than 0 and the chip is selected. Read more
Source§

fn tooltip(&self) -> Option<&str>

Tooltip string to be used for the body area (where the label and avatar are) of the chip.
Source§

fn avatar_border(&self) -> &ShapeBorderRef

The shape for the avatar’s border: the check mark’s scrim is clipped to it. Read more
Source§

impl StatelessWidget for FilterChip

Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn build(&self, app: &mut App, context: BuildContext) -> WidgetRef

Describes the part of the user interface represented by this widget. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s 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)

Dart’s constructor asserts that relate two or more arguments. Read more
Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Dart’s 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 !RefUnwindSafe for FilterChip

§

impl !Send for FilterChip

§

impl !Sync for FilterChip

§

impl !UnwindSafe for FilterChip

§

impl Forget for FilterChip

§

impl Freeze for FilterChip
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, &'static dyn ColorExtension: Freeze, *const RcInner<dyn ColorExtension> is !null: Freeze, PhantomData<RcInner<dyn ColorExtension>>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, PhantomData<String>: Freeze, *const RcInner<Paint> is !null: Freeze, PhantomData<RcInner<Paint>>: Freeze, PhantomData<Shadow>: Freeze, PhantomData<FontFeature>: Freeze, PhantomData<FontVariation>: Freeze, *const RcInner<dyn Fn(&mut App, bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, NonZero<u32>: Freeze, *const (): Freeze, *const RcInner<dyn BorderSideExtension> is !null: Freeze, PhantomData<RcInner<dyn BorderSideExtension>>: Freeze, *const RcInner<dyn OutlinedBorder> is !null: Freeze, PhantomData<RcInner<dyn OutlinedBorder>>: Freeze, &'static FocusNodeVTable: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: Freeze, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: Freeze, *const RcInner<dyn Fn(&IconThemeData, &mut App, AnyElement) -> IconThemeData> is !null: Freeze, PhantomData<RcInner<dyn Fn(&IconThemeData, &mut App, AnyElement) -> IconThemeData>>: Freeze, *const RcInner<dyn ShapeBorder> is !null: Freeze, PhantomData<RcInner<dyn ShapeBorder>>: Freeze, *const RcInner<dyn Curve> is !null: Freeze, PhantomData<RcInner<dyn Curve>>: Freeze, *const RcInner<dyn MouseCursor> is !null: Freeze, PhantomData<RcInner<dyn MouseCursor>>: Freeze,

§

impl Move for FilterChip

§

impl Unpin for FilterChip
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin, &'static dyn ColorExtension: Unpin, Rc<dyn ColorExtension>: Unpin, *const u8 is !null: Unpin, Rc<Paint>: Unpin, Rc<dyn Fn(&mut App, bool)>: Unpin, Rc<dyn Fn(&mut App)>: Unpin, NonZero<u32>: Unpin, *const (): Unpin, Rc<dyn BorderSideExtension>: Unpin, Rc<dyn OutlinedBorder>: Unpin, &'static FocusNodeVTable: Unpin, Rc<Keep>: Unpin, Rc<dyn WidgetStateProperty<Option<Color>>>: Unpin, Rc<dyn Fn(&IconThemeData, &mut App, AnyElement) -> IconThemeData>: Unpin, Rc<dyn ShapeBorder>: Unpin, Rc<dyn Curve>: Unpin, Rc<dyn MouseCursor>: Unpin,

§

impl UnsafeUnpin for FilterChip
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, &'static dyn ColorExtension: UnsafeUnpin, *const RcInner<dyn ColorExtension> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ColorExtension>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<String>: UnsafeUnpin, *const RcInner<Paint> is !null: UnsafeUnpin, PhantomData<RcInner<Paint>>: UnsafeUnpin, PhantomData<Shadow>: UnsafeUnpin, PhantomData<FontFeature>: UnsafeUnpin, PhantomData<FontVariation>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, bool)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, *const (): UnsafeUnpin, *const RcInner<dyn BorderSideExtension> is !null: UnsafeUnpin, PhantomData<RcInner<dyn BorderSideExtension>>: UnsafeUnpin, *const RcInner<dyn OutlinedBorder> is !null: UnsafeUnpin, PhantomData<RcInner<dyn OutlinedBorder>>: UnsafeUnpin, &'static FocusNodeVTable: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const RcInner<dyn WidgetStateProperty<Option<Color>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetStateProperty<Option<Color>>>>: UnsafeUnpin, *const RcInner<dyn Fn(&IconThemeData, &mut App, AnyElement) -> IconThemeData> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&IconThemeData, &mut App, AnyElement) -> IconThemeData>>: UnsafeUnpin, *const RcInner<dyn ShapeBorder> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ShapeBorder>>: UnsafeUnpin, *const RcInner<dyn Curve> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Curve>>: UnsafeUnpin, *const RcInner<dyn MouseCursor> is !null: UnsafeUnpin, PhantomData<RcInner<dyn MouseCursor>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<W> IntoWidget<StatelessKind> for W
where W: StatelessWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>