Skip to main content

ChipThemeData

Struct ChipThemeData 

Source
pub struct ChipThemeData {
Show 23 fields pub color: Option<WidgetStatePropertyRef<Option<Color>>>, pub background_color: Option<Color>, pub delete_icon_color: Option<AnyColor>, pub disabled_color: Option<Color>, pub selected_color: Option<Color>, pub secondary_selected_color: Option<Color>, pub shadow_color: Option<Color>, pub surface_tint_color: Option<Color>, pub selected_shadow_color: Option<Color>, pub show_checkmark: Option<bool>, pub checkmark_color: Option<Color>, pub label_padding: Option<EdgeInsetsGeometry>, pub padding: Option<EdgeInsetsGeometry>, pub side: Option<AnyBorderSide>, pub shape: Option<OutlinedBorderRef>, pub label_style: Option<TextStyle>, pub secondary_label_style: Option<TextStyle>, pub brightness: Option<Brightness>, pub elevation: Option<f64>, pub press_elevation: Option<f64>, pub icon_theme: Option<IconThemeData>, pub avatar_box_constraints: Option<BoxConstraints>, pub delete_icon_box_constraints: Option<BoxConstraints>,
}
Expand description

Holds the color, shape, and text styles for a Material widget subtree.

ChipThemeData is used by ChipTheme to control the visual properties of chip widgets in a widget hierarchy.

To obtain the current ChipThemeData for a given BuildContext, use ChipTheme::of. A widget’s build method can use ChipTheme::of to obtain the current visual properties for a chip.

The ChipTheme constructor is used to apply a ChipThemeData to a subtree, and ThemeData::chip_theme is the default that applies when there is no ChipTheme.

See also:

  • ChipTheme, a widget that sets the theme data for a subtree.
  • ThemeData, which describes the overall theme information for the application.

Fields§

§color: Option<WidgetStatePropertyRef<Option<Color>>>

Overrides the default for ChipAttributes::color.

§background_color: Option<Color>

Color to be used for the unselected, enabled chip’s background.

The default is light grey.

§delete_icon_color: Option<AnyColor>

The Color for the delete icon. The default is Color(0xde000000) (slightly transparent black) for light themes, and Color(0xdeffffff) (slightly transparent white) for dark themes.

May be set to null, in which case the ambient IconTheme.color is used.

§disabled_color: Option<Color>

Color to be used for the chip’s background, indicating that it is disabled.

The chip is disabled when DisabledChipAttributes::is_enabled is false, or all three of SelectableChipAttributes::on_selected, TappableChipAttributes::on_pressed, and DeletableChipAttributes::on_deleted are null.

§selected_color: Option<Color>

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

The chip is selected when SelectableChipAttributes::selected is true.

§secondary_selected_color: Option<Color>

An alternate color to be used for the chip’s background, indicating that it is selected. For example, this color can be used for a ChoiceChip when selected.

§shadow_color: Option<Color>

Color of the chip’s shadow when the elevation is greater than 0.

§surface_tint_color: 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.

§selected_shadow_color: Option<Color>

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

§show_checkmark: Option<bool>

Whether or not to show a check mark when SelectableChipAttributes::selected is true.

§checkmark_color: Option<Color>

Color of the chip’s check mark when a check mark is visible.

This will override the color set by the platform’s brightness setting.

§label_padding: 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.

§padding: Option<EdgeInsetsGeometry>

The padding between the contents of the chip and the outside shape.

Defaults to 4 logical pixels on all sides.

§side: Option<AnyBorderSide>

The color and weight of the chip’s outline.

This value is combined with shape to create a shape decorated with an outline. To omit the outline entirely, pass BorderSide::NONE to side.

§shape: Option<OutlinedBorderRef>

The border to draw around the chip.

This shape is combined with side to create a shape decorated with an outline.

§label_style: Option<TextStyle>

The style to be applied to the chip’s label.

This only has an effect on label widgets that respect the DefaultTextStyle, such as Text.

§secondary_label_style: Option<TextStyle>

An alternate style to be applied to the chip’s label, indicating that it is selected.

This only has an effect on label widgets that respect the DefaultTextStyle, such as Text.

§brightness: Option<Brightness>

Overrides the default for the brightness of the chip.

§elevation: Option<f64>

The elevation to be applied to the chip. Defaults to 0.

§press_elevation: Option<f64>

The elevation to be applied to the chip during the press motion. Defaults to 8.

§icon_theme: Option<IconThemeData>

Theme used for all icons in the chip.

§avatar_box_constraints: 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.

§delete_icon_box_constraints: Option<BoxConstraints>

Optional size constraints for the delete icon.

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.

Implementations§

Source§

impl ChipThemeData

Source

pub fn new() -> ChipThemeData

Create a ChipThemeData given a set of exact values. Dart’s optional named arguments are the fluent setters.

This will rarely be used directly. It is used by lerp to create intermediate themes based on two themes.

Source

pub fn from_defaults( brightness: Option<Brightness>, primary_color: Option<Color>, secondary_color: Color, label_style: TextStyle, ) -> ChipThemeData

Dart’s ChipThemeData.fromDefaults: generates a ChipThemeData from a brightness, a primary color, a secondary color, and a text style.

Only one of primary_color or brightness may be given, and one of them must be: brightness is derived from primary_color when that is given, and the primary color is black or white from brightness when it is not.

The secondary_color is used for the selection state. The colors, opacities and padding of the result are Material Design defaults.

Source

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

Dart ChipThemeData(color:).

Source

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

Dart ChipThemeData(backgroundColor:).

Source

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

Dart ChipThemeData(deleteIconColor:).

Source

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

Dart ChipThemeData(disabledColor:).

Source

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

Dart ChipThemeData(selectedColor:).

Source

pub fn secondary_selected_color( self, secondary_selected_color: Color, ) -> ChipThemeData

Dart ChipThemeData(secondarySelectedColor:).

Source

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

Dart ChipThemeData(shadowColor:).

Source

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

Dart ChipThemeData(surfaceTintColor:).

Source

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

Dart ChipThemeData(selectedShadowColor:).

Source

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

Dart ChipThemeData(showCheckmark:).

Source

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

Dart ChipThemeData(checkmarkColor:).

Source

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

Dart ChipThemeData(labelPadding:).

Source

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

Dart ChipThemeData(padding:).

Source

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

Dart ChipThemeData(side:).

Source

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

Dart ChipThemeData(shape:).

Source

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

Dart ChipThemeData(labelStyle:).

Source

pub fn secondary_label_style( self, secondary_label_style: TextStyle, ) -> ChipThemeData

Dart ChipThemeData(secondaryLabelStyle:).

Source

pub fn brightness(self, brightness: Brightness) -> ChipThemeData

Dart ChipThemeData(brightness:).

Source

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

Dart ChipThemeData(elevation:).

Source

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

Dart ChipThemeData(pressElevation:).

Source

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

Dart ChipThemeData(iconTheme:).

Source

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

Dart ChipThemeData(avatarBoxConstraints:).

Source

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

Dart ChipThemeData(deleteIconBoxConstraints:).

Source

pub fn copy_with(&self) -> ChipThemeData

Creates a copy of this object but with the given fields replaced with the new values.

Dart’s named arguments are the fluent setters on the copy (data.copy_with().elevation(4.0)).

Source

pub fn lerp( a: Option<&ChipThemeData>, b: Option<&ChipThemeData>, t: f64, ) -> Option<ChipThemeData>

Linearly interpolate between two chip themes.

{@macro dart.ui.shadow.lerp}

Trait Implementations§

Source§

impl ChipThemeDataGetters for ChipThemeData

Source§

fn chip_theme_data(&self) -> &ChipThemeData

The fields Dart’s constructor sets: the struct itself, or the super(...) arguments a defaults struct keeps.
Source§

fn color(&self, app: &mut App) -> Option<WidgetStatePropertyRef<Option<Color>>>

Dart’s color getter.
Source§

fn background_color(&self, app: &mut App) -> Option<Color>

Dart’s background_color getter.
Source§

fn delete_icon_color(&self, app: &mut App) -> Option<AnyColor>

Dart’s delete_icon_color getter.
Source§

fn disabled_color(&self, app: &mut App) -> Option<Color>

Dart’s disabled_color getter.
Source§

fn selected_color(&self, app: &mut App) -> Option<Color>

Dart’s selected_color getter.
Source§

fn secondary_selected_color(&self, app: &mut App) -> Option<Color>

Dart’s secondary_selected_color getter.
Source§

fn shadow_color(&self, app: &mut App) -> Option<Color>

Dart’s shadow_color getter.
Source§

fn surface_tint_color(&self, app: &mut App) -> Option<Color>

Dart’s surface_tint_color getter.
Source§

fn selected_shadow_color(&self, app: &mut App) -> Option<Color>

Dart’s selected_shadow_color getter.
Source§

fn show_checkmark(&self, app: &mut App) -> Option<bool>

Dart’s show_checkmark getter.
Source§

fn checkmark_color(&self, app: &mut App) -> Option<Color>

Dart’s checkmark_color getter.
Source§

fn label_padding(&self, app: &mut App) -> Option<EdgeInsetsGeometry>

Dart’s label_padding getter.
Source§

fn padding(&self, app: &mut App) -> Option<EdgeInsetsGeometry>

Dart’s padding getter.
Source§

fn side(&self, app: &mut App) -> Option<AnyBorderSide>

Dart’s side getter.
Source§

fn shape(&self, app: &mut App) -> Option<OutlinedBorderRef>

Dart’s shape getter.
Source§

fn label_style(&self, app: &mut App) -> Option<TextStyle>

Dart’s label_style getter.
Source§

fn secondary_label_style(&self, app: &mut App) -> Option<TextStyle>

Dart’s secondary_label_style getter.
Source§

fn brightness(&self, app: &mut App) -> Option<Brightness>

Dart’s brightness getter.
Source§

fn elevation(&self, app: &mut App) -> Option<f64>

Dart’s elevation getter.
Source§

fn press_elevation(&self, app: &mut App) -> Option<f64>

Dart’s press_elevation getter.
Source§

fn icon_theme(&self, app: &mut App) -> Option<IconThemeData>

Dart’s icon_theme getter.
Source§

fn avatar_box_constraints(&self, app: &mut App) -> Option<BoxConstraints>

Dart’s avatar_box_constraints getter.
Source§

fn delete_icon_box_constraints(&self, app: &mut App) -> Option<BoxConstraints>

Dart’s delete_icon_box_constraints getter.
Source§

fn copy_with(&self, app: &mut App) -> ChipThemeData

Dart’s copyWith() with no arguments: a plain value holding what every getter answers, for the caller’s setters to change.
Source§

impl Clone for ChipThemeData

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 ChipThemeData

Source§

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

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

impl Default for ChipThemeData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Diagnosticable for ChipThemeData

Source§

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

Add additional properties associated with the node.
Source§

fn type_name(&self) -> &'static str

Dart’s Object.runtimeType as diagnostics print it: the last segment of the Rust type path, without generic arguments.
Source§

fn identity_hash(&self) -> u64

Dart’s Object.hashCode as diagnostics print it: the object’s address.
Source§

fn to_string_short(&self) -> String

A brief description of this object, usually just the type and the hash.
Source§

fn to_diagnostics_node(&self) -> DiagnosticableNode

Returns a debug representation of the object used by debugging tools and by DiagnosticsNode::to_string_deep.
Source§

fn to_diagnostics_node_with( &self, name: Option<String>, style: Option<DiagnosticsTreeStyle>, ) -> DiagnosticableNode

Dart toDiagnosticsNode(name:, style:).
Source§

fn to_string(&self) -> String

Dart’s toString: a single-line description with properties and no children. Read more
Source§

fn to_string_at(&self, min_level: DiagnosticLevel) -> String

Dart’s toString(minLevel:).
Source§

impl Display for ChipThemeData

Source§

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

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

impl PartialEq for ChipThemeData

Source§

fn eq(&self, other: &ChipThemeData) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for ChipThemeData

§

impl !Send for ChipThemeData

§

impl !Sync for ChipThemeData

§

impl !UnwindSafe for ChipThemeData

§

impl Forget for ChipThemeData

§

impl Freeze for ChipThemeData

§

impl Move for ChipThemeData

§

impl Unpin for ChipThemeData

§

impl UnsafeUnpin for ChipThemeData

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<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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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>