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
impl IconThemeData
Sourcepub fn debug_fill_properties(
&self,
properties: &mut DiagnosticPropertiesBuilder,
)
pub fn debug_fill_properties( &self, properties: &mut DiagnosticPropertiesBuilder, )
Dart’s IconThemeData.debugFillProperties, which IconTheme’s own
body calls where Dart writes super.
Sourcepub fn new() -> IconThemeData
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.
Sourcepub fn fallback() -> IconThemeData
pub fn fallback() -> IconThemeData
Sourcepub fn size(self, size: f64) -> IconThemeData
pub fn size(self, size: f64) -> IconThemeData
Dart IconThemeData(size:).
Sourcepub fn fill(self, fill: f64) -> IconThemeData
pub fn fill(self, fill: f64) -> IconThemeData
Dart IconThemeData(fill:). Must be between 0.0 and 1.0 inclusive.
Sourcepub fn weight(self, weight: f64) -> IconThemeData
pub fn weight(self, weight: f64) -> IconThemeData
Dart IconThemeData(weight:). Must be greater than 0.0.
Sourcepub fn grade(self, grade: f64) -> IconThemeData
pub fn grade(self, grade: f64) -> IconThemeData
Dart IconThemeData(grade:).
Sourcepub fn optical_size(self, optical_size: f64) -> IconThemeData
pub fn optical_size(self, optical_size: f64) -> IconThemeData
Dart IconThemeData(opticalSize:). Must be greater than 0.0.
Sourcepub fn color(self, color: impl Into<AnyColor>) -> IconThemeData
pub fn color(self, color: impl Into<AnyColor>) -> IconThemeData
Dart IconThemeData(color:).
Sourcepub fn opacity(self, opacity: f64) -> IconThemeData
pub fn opacity(self, opacity: f64) -> IconThemeData
Dart IconThemeData(opacity:). The value is clamped between 0.0 and 1.0.
Sourcepub fn shadows(self, shadows: Vec<Shadow>) -> IconThemeData
pub fn shadows(self, shadows: Vec<Shadow>) -> IconThemeData
Dart IconThemeData(shadows:).
Sourcepub fn apply_text_scaling(self, apply_text_scaling: bool) -> IconThemeData
pub fn apply_text_scaling(self, apply_text_scaling: bool) -> IconThemeData
Dart IconThemeData(applyTextScaling:).
Sourcepub fn resolver(self, resolver: IconThemeDataResolver) -> IconThemeData
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.
Sourcepub fn copy_with(&self) -> IconThemeData
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)).
Sourcepub fn merge(&self, other: Option<&IconThemeData>) -> IconThemeData
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.
Sourcepub fn resolve(&self, app: &mut App, context: BuildContext) -> IconThemeData
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.resolvean implementation that resolves the color ofCupertinoIconThemeDatabefore returning.
Sourcepub fn is_concrete(&self) -> bool
pub fn is_concrete(&self) -> bool
Whether all the properties (except shadows) of this object are non-null.
Sourcepub fn lerp(
a: Option<&IconThemeData>,
b: Option<&IconThemeData>,
t: f64,
) -> IconThemeData
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
impl Clone for IconThemeData
Source§impl Debug for IconThemeData
impl Debug for IconThemeData
Source§impl Default for IconThemeData
impl Default for IconThemeData
Source§fn default() -> IconThemeData
fn default() -> IconThemeData
Source§impl Diagnosticable for IconThemeData
impl Diagnosticable for IconThemeData
Source§fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Object.runtimeType as diagnostics print it: the last segment of
the Rust type path, without generic arguments.Source§fn identity_hash(&self) -> u64
fn identity_hash(&self) -> u64
Object.hashCode as diagnostics print it: the object’s address.Source§fn to_string_short(&self) -> String
fn to_string_short(&self) -> String
Source§fn to_diagnostics_node(&self) -> DiagnosticableNode
fn to_diagnostics_node(&self) -> DiagnosticableNode
DiagnosticsNode::to_string_deep.Source§fn to_diagnostics_node_with(
&self,
name: Option<String>,
style: Option<DiagnosticsTreeStyle>,
) -> DiagnosticableNode
fn to_diagnostics_node_with( &self, name: Option<String>, style: Option<DiagnosticsTreeStyle>, ) -> DiagnosticableNode
toDiagnosticsNode(name:, style:).Source§fn to_string(&self) -> String
fn to_string(&self) -> String
toString: a single-line description with properties and no
children. Read moreSource§fn to_string_at(&self, min_level: DiagnosticLevel) -> String
fn to_string_at(&self, min_level: DiagnosticLevel) -> String
toString(minLevel:).Source§impl Display for IconThemeData
Dart’s Diagnosticable.toString, which a property holding an icon theme prints.
impl Display for IconThemeData
Dart’s Diagnosticable.toString, which a property holding an icon theme prints.
Source§impl PartialEq for IconThemeData
Dart’s == checks runtimeType first: a subclass instance never equals a base one.
impl PartialEq for IconThemeData
Dart’s == checks runtimeType first: a subclass instance never equals a base one.