pub trait ChipAttributes {
Show 21 methods
// Required methods
fn label(&self) -> &WidgetRef;
fn avatar(&self) -> Option<&WidgetRef>;
fn label_style(&self) -> Option<&TextStyle>;
fn side(&self) -> Option<&AnyBorderSide>;
fn shape(&self) -> Option<&OutlinedBorderRef>;
fn clip_behavior(&self) -> Clip;
fn focus_node(&self) -> Option<&FocusNodeRef>;
fn autofocus(&self) -> bool;
fn color(&self) -> Option<&WidgetStatePropertyRef<Option<Color>>>;
fn background_color(&self) -> Option<Color>;
fn padding(&self) -> Option<&EdgeInsetsGeometry>;
fn visual_density(&self) -> Option<VisualDensity>;
fn label_padding(&self) -> Option<&EdgeInsetsGeometry>;
fn material_tap_target_size(&self) -> Option<MaterialTapTargetSize>;
fn elevation(&self) -> Option<f64>;
fn shadow_color(&self) -> Option<Color>;
fn surface_tint_color(&self) -> Option<Color>;
fn icon_theme(&self) -> Option<&IconThemeData>;
fn avatar_box_constraints(&self) -> Option<BoxConstraints>;
fn chip_animation_style(&self) -> Option<&ChipAnimationStyle>;
fn mouse_cursor(&self) -> Option<&MouseCursorRef>;
}Expand description
An interface defining the base attributes for a Material Design chip.
Chips are compact elements that represent an attribute, text, entity, or action.
The defaults mentioned in the documentation for each attribute are what the implementing classes typically use for defaults (but this class doesn’t provide or enforce them).
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.FilterChip, uses tags or descriptive words as a way to filter content.ActionChip, represents an action related to primary content.- https://material.io/design/components/chips.html
Required Methods§
Sourcefn avatar(&self) -> Option<&WidgetRef>
fn avatar(&self) -> Option<&WidgetRef>
A widget to display prior to the chip’s label.
Typically a CircleAvatar widget.
Sourcefn label_style(&self) -> Option<&TextStyle>
fn label_style(&self) -> Option<&TextStyle>
The style to be applied to the chip’s label.
If this is null and ThemeData::use_material3 is true, then
TextTheme::label_large is used. Otherwise, TextTheme::body_large
is used.
This only has an effect on widgets that respect the DefaultTextStyle,
such as Text.
If TextStyle::color is a WidgetStateProperty<Color>,
WidgetStateProperty::resolve is used for the following WidgetStates:
Sourcefn side(&self) -> Option<&AnyBorderSide>
fn side(&self) -> Option<&AnyBorderSide>
The color and weight of the chip’s outline.
Defaults to the border side in the ambient ChipThemeData. If the theme
border side resolves to null and ThemeData::use_material3 is true, then
BorderSide with a ColorScheme::outline color is used when the chip is
enabled, and BorderSide with a ColorScheme::on_surface color with an
opacity of 0.12 is used when the chip is disabled. Otherwise, it defaults
to null.
This value is combined with shape to create a shape decorated with an
outline. To omit the outline entirely, pass BorderSide::NONE to
side.
If it is a WidgetStateBorderSide, WidgetStateProperty::resolve is
used for the following WidgetStates:
Sourcefn shape(&self) -> Option<&OutlinedBorderRef>
fn shape(&self) -> Option<&OutlinedBorderRef>
The OutlinedBorder to draw around the chip.
Defaults to the shape in the ambient ChipThemeData. If the theme
shape resolves to null and ThemeData::use_material3 is true, then
RoundedRectangleBorder with a circular border radius of 8.0 is used.
Otherwise, StadiumBorder is used.
This shape is combined with side to create a shape decorated with an
outline. If side is not null or side of shape is
BorderSide::NONE, side of shape is ignored. To omit the outline
entirely, pass BorderSide::NONE to side.
If it is a WidgetStateOutlinedBorder, WidgetStateProperty::resolve
is used for the following WidgetStates:
Sourcefn clip_behavior(&self) -> Clip
fn clip_behavior(&self) -> Clip
Defaults to Clip::None.
Sourcefn focus_node(&self) -> Option<&FocusNodeRef>
fn focus_node(&self) -> Option<&FocusNodeRef>
The focus node of the chip’s InkWell.
Sourcefn color(&self) -> Option<&WidgetStatePropertyRef<Option<Color>>>
fn color(&self) -> Option<&WidgetStatePropertyRef<Option<Color>>>
The color that fills the chip, in all WidgetStates.
Defaults to null.
Resolves in the following states:
Sourcefn background_color(&self) -> Option<Color>
fn background_color(&self) -> Option<Color>
Color to be used for the unselected, enabled chip’s background.
The default is light grey.
Sourcefn padding(&self) -> Option<&EdgeInsetsGeometry>
fn padding(&self) -> Option<&EdgeInsetsGeometry>
The padding between the contents of the chip and the outside shape.
If this is null and ThemeData::use_material3 is true, then
a padding of 8.0 logical pixels on all sides is used. Otherwise,
it defaults to a padding of 4.0 logical pixels on all sides.
Sourcefn visual_density(&self) -> Option<VisualDensity>
fn visual_density(&self) -> Option<VisualDensity>
Defines how compact the chip’s layout will be.
Chips are unaffected by horizontal density changes.
See also:
ThemeData::visual_density, which specifies thevisual_densityfor all widgets within aTheme.
Sourcefn label_padding(&self) -> Option<&EdgeInsetsGeometry>
fn label_padding(&self) -> Option<&EdgeInsetsGeometry>
The padding around the label widget.
By default, this is 4 logical pixels at the beginning and the end of the label, and zero on top and bottom.
Sourcefn material_tap_target_size(&self) -> Option<MaterialTapTargetSize>
fn material_tap_target_size(&self) -> Option<MaterialTapTargetSize>
Configures the minimum size of the tap target.
Defaults to ThemeData::material_tap_target_size.
See also:
MaterialTapTargetSize, for a description of how this affects tap targets.
Sourcefn elevation(&self) -> Option<f64>
fn elevation(&self) -> Option<f64>
Elevation to be applied on the chip relative to its parent.
This controls the size of the shadow below the chip.
Defaults to 0. The value is always non-negative.
Sourcefn shadow_color(&self) -> Option<Color>
fn shadow_color(&self) -> Option<Color>
Color of the chip’s shadow when the elevation is greater than 0.
If this is null and ThemeData::use_material3 is true, then
Colors::TRANSPARENT color is used. Otherwise, it defaults to null.
Sourcefn surface_tint_color(&self) -> Option<Color>
fn surface_tint_color(&self) -> Option<Color>
Color of the chip’s surface tint overlay when its elevation is greater than 0.
This is not recommended for use. Material 3 spec introduced a set of tone-based
surfaces and surface containers in its ColorScheme, which provide more flexibility.
The intention is to eventually remove surface tint color from the framework.
If this is null, defaults to Colors::TRANSPARENT.
Sourcefn icon_theme(&self) -> Option<&IconThemeData>
fn icon_theme(&self) -> Option<&IconThemeData>
Theme used for all icons in the chip.
If this is null and ThemeData::use_material3 is true, then IconThemeData
with a ColorScheme::primary color and a size of 18.0 is used when
the chip is enabled, and IconThemeData with a ColorScheme::on_surface
color and a size of 18.0 is used when the chip is disabled. Otherwise,
it defaults to null.
Sourcefn avatar_box_constraints(&self) -> Option<BoxConstraints>
fn avatar_box_constraints(&self) -> Option<BoxConstraints>
Optional size constraints for the avatar.
When unspecified, defaults to a minimum size of chip height or label height (whichever is greater) and a padding of 8.0 pixels on all sides.
The default constraints ensure that the avatar is accessible. Specifying this parameter enables creation of avatar smaller than the minimum size, but it is not recommended.
Sourcefn chip_animation_style(&self) -> Option<&ChipAnimationStyle>
fn chip_animation_style(&self) -> Option<&ChipAnimationStyle>
Used to override the default chip animations durations.
If ChipAnimationStyle::enable_animation with duration or reverse duration is
provided, it will be used to override the chip enable and disable animation durations.
If it is null, then default duration will be 75ms.
If ChipAnimationStyle::select_animation with duration or reverse duration is
provided, it will be used to override the chip select and unselect animation
durations. If it is null, then default duration will be 195ms.
If ChipAnimationStyle::avatar_drawer_animation with duration or reverse duration
is provided, it will be used to override the chip checkmark animation duration.
If it is null, then default duration will be 150ms.
If ChipAnimationStyle::delete_drawer_animation with duration or reverse duration
is provided, it will be used to override the chip delete icon animation duration.
If it is null, then default duration will be 150ms.
Sourcefn mouse_cursor(&self) -> Option<&MouseCursorRef>
fn mouse_cursor(&self) -> Option<&MouseCursorRef>
The cursor for a mouse pointer when it enters or is hovering over the widget.
If mouse_cursor is a WidgetStateMouseCursor,
WidgetStateProperty::resolve is used for the following WidgetStates:
If this property is null, WidgetStateMouseCursor::adaptive_clickable will be used.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".