Skip to main content

IconThemeData

Struct IconThemeData 

Source
pub struct IconThemeData {
    pub size: Option<f64>,
    pub fill: Option<f64>,
    pub weight: Option<f64>,
    pub grade: Option<f64>,
    pub optical_size: Option<f64>,
    pub color: Option<AnyColor>,
    pub opacity: Option<f64>,
    pub shadows: Option<Vec<Shadow>>,
    pub apply_text_scaling: Option<bool>,
    /* private fields */
}
Expand description

Defines the size, font variations, color, opacity, and shadows of icons.

Used by IconTheme to control those properties in a widget subtree.

To obtain the current icon theme, use IconTheme::of. To convert an icon theme to a version with all the fields filled in, use IconThemeData::fallback.

Dart’s named constructor arguments are the fluent setters (IconThemeData::new().size(16.0).opacity(0.5)).

Fields§

§size: Option<f64>

The default for Icon.size.

Falls back to 24.0.

§fill: Option<f64>

The default for Icon.fill.

Falls back to 0.0.

§weight: Option<f64>

The default for Icon.weight.

Falls back to 400.0.

§grade: Option<f64>

The default for Icon.grade.

Falls back to 0.0.

§optical_size: Option<f64>

The default for Icon.opticalSize.

Falls back to 48.0.

§color: Option<AnyColor>

The default for Icon.color.

In material apps, if there is a Theme without any IconThemes specified, icon colors default to white if ThemeData.brightness is dark and black if ThemeData.brightness is light.

Otherwise, falls back to black.

§opacity: Option<f64>

An opacity to apply to both explicit and default icon colors.

Falls back to 1.0. Dart clamps its private _opacity in this getter; here the value is clamped between 0.0 and 1.0 when it is set.

§shadows: Option<Vec<Shadow>>

The default for Icon.shadows.

§apply_text_scaling: Option<bool>

The default for Icon.applyTextScaling.

Implementations§

Source§

impl IconThemeData

Source

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

Dart’s IconThemeData.debugFillProperties, which IconTheme’s own body calls where Dart writes super.

Source

pub fn new() -> IconThemeData

Creates an icon theme data.

The opacity applies to both explicit and default icon colors. The value is clamped between 0.0 and 1.0.

Source

pub fn fallback() -> IconThemeData

Creates an icon theme with some reasonable default values.

The size is 24.0, fill is 0.0, weight is 400.0, grade is 0.0, opticalSize is 48.0, color is black, and opacity is 1.0.

Source

pub fn size(self, size: f64) -> IconThemeData

Dart IconThemeData(size:).

Source

pub fn fill(self, fill: f64) -> IconThemeData

Dart IconThemeData(fill:). Must be between 0.0 and 1.0 inclusive.

Source

pub fn weight(self, weight: f64) -> IconThemeData

Dart IconThemeData(weight:). Must be greater than 0.0.

Source

pub fn grade(self, grade: f64) -> IconThemeData

Dart IconThemeData(grade:).

Source

pub fn optical_size(self, optical_size: f64) -> IconThemeData

Dart IconThemeData(opticalSize:). Must be greater than 0.0.

Source

pub fn color(self, color: impl Into<AnyColor>) -> IconThemeData

Dart IconThemeData(color:).

Source

pub fn opacity(self, opacity: f64) -> IconThemeData

Dart IconThemeData(opacity:). The value is clamped between 0.0 and 1.0.

Source

pub fn shadows(self, shadows: Vec<Shadow>) -> IconThemeData

Dart IconThemeData(shadows:).

Source

pub fn apply_text_scaling(self, apply_text_scaling: bool) -> IconThemeData

Dart IconThemeData(applyTextScaling:).

Source

pub fn resolver(self, resolver: IconThemeDataResolver) -> IconThemeData

Makes this data a subclass instance whose resolve runs resolver: Dart’s class CupertinoIconThemeData extends IconThemeData overriding resolve. copy_with and merge keep it, as the subclass’s copyWith does; lerp drops it, as Dart’s IconThemeData.lerp returns the base class.

Source

pub fn copy_with(&self) -> IconThemeData

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

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

Source

pub fn merge(&self, other: Option<&IconThemeData>) -> IconThemeData

Returns a new icon theme that matches this icon theme but with some values replaced by the non-null parameters of the given icon theme. If the given icon theme is null, returns this icon theme.

Source

pub fn resolve(&self, app: &mut App, context: BuildContext) -> IconThemeData

Called by IconTheme::of to convert this instance to an IconThemeData that fits the given BuildContext.

This method gives the ambient IconThemeData a chance to update itself, after it’s been retrieved by IconTheme::of, and before being returned as the final result. For instance, CupertinoIconThemeData overrides this method to resolve color, in case color is a CupertinoDynamicColor and needs to be resolved against the given BuildContext before it can be used as a regular Color.

The default implementation returns this IconThemeData as-is.

See also:

  • CupertinoIconThemeData.resolve an implementation that resolves the color of CupertinoIconThemeData before returning.
Source

pub fn is_concrete(&self) -> bool

Whether all the properties (except shadows) of this object are non-null.

Source

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

Linearly interpolate between two icon theme data objects.

The t argument represents position on the timeline, with 0.0 meaning that the interpolation has not started, returning a (or something equivalent to a), 1.0 meaning that the interpolation has finished, returning b (or something equivalent to b), and values in between meaning that the interpolation is at the relevant point on the timeline between a and b. The interpolation can be extrapolated beyond 0.0 and 1.0, so negative values and values greater than 1.0 are valid (and can easily be generated by curves such as Curves.elasticInOut).

Values for t are usually obtained from an Animation<f64>, such as an AnimationController.

Trait Implementations§

Source§

impl Clone for IconThemeData

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 IconThemeData

Source§

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

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

impl Default for IconThemeData

Source§

fn default() -> IconThemeData

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

impl Diagnosticable for IconThemeData

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 IconThemeData

Dart’s Diagnosticable.toString, which a property holding an icon theme prints.

Source§

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

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

impl PartialEq for IconThemeData

Dart’s == checks runtimeType first: a subclass instance never equals a base one.

Source§

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

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

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

Inequality operator !=. Read more

Auto Trait Implementations§

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>