Skip to main content

DisabledChipAttributes

Trait DisabledChipAttributes 

Source
pub trait DisabledChipAttributes {
    // Required methods
    fn is_enabled(&self) -> bool;
    fn disabled_color(&self) -> Option<Color>;
}
Expand description

An interface for Material Design chips that can be enabled and disabled.

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:

  • 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§

Source

fn is_enabled(&self) -> bool

Whether or not this chip is enabled for input.

If this is true, but all of the user action callbacks are null (for example, SelectableChipAttributes::on_selected, TappableChipAttributes::on_pressed, and DeletableChipAttributes::on_deleted), then the control will still be shown as disabled.

This is typically used if you want the chip to be disabled, but also show a delete button.

For classes which don’t have this as a constructor option, is_enabled is true if their user action callback is set.

Defaults to true.

Source

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

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§