pub struct AnyTextStyle { /* private fields */ }Expand description
A TextStyle that may be an instance of a TextStyle subclass, as AnyColor is
for Color.
The framework stores this wherever Flutter stores a TextStyle that may be a subclass
(WidgetStateTextStyle). The plain value is the one the subclass passed to super, reached
by value or by deref; the subclass is recovered with
extension, Dart’s is check.
Equality follows Dart’s: two plain values compare by value, two extended ones by value
and by the subclass’s ==, and a plain value never equals an extended one.
Implementations§
Source§impl AnyTextStyle
impl AnyTextStyle
Sourcepub fn new(value: TextStyle) -> AnyTextStyle
pub fn new(value: TextStyle) -> AnyTextStyle
A plain value.
A subclass instance: value is what it passed to super.
Sourcepub fn extension<E>(&self) -> Option<&E>where
E: TextStyleExtension,
pub fn extension<E>(&self) -> Option<&E>where
E: TextStyleExtension,
Dart’s value is T: the subclass instance, if this value is one.
Sourcepub fn has_extension(&self) -> bool
pub fn has_extension(&self) -> bool
Whether this value is a subclass instance.
Methods from Deref<Target = TextStyle>§
Sourcepub fn font_family_fallback_list(&self) -> Option<Vec<String>>
pub fn font_family_fallback_list(&self) -> Option<Vec<String>>
The ordered list of font families to fall back on when a glyph cannot be found in a higher priority font family.
If the font is defined in a package, each font family in the list is
prefixed with packages/package_name/.
Sourcepub fn copy_with(&self) -> TextStyle
pub fn copy_with(&self) -> TextStyle
Creates a copy of this text style but with the given fields replaced with the new values.
Chain setters: style.copy_with().color(c).
Sourcepub fn apply(&self) -> TextStyleApply
pub fn apply(&self) -> TextStyleApply
Creates a copy of this text style replacing or altering the specified properties.
Chain replacements and factors, then TextStyleApply::into_style.
style.apply() with no further setters is Dart apply() with defaults.
Sourcepub fn merge(&self, other: Option<&TextStyle>) -> TextStyle
pub fn merge(&self, other: Option<&TextStyle>) -> TextStyle
Returns a new text style that is a combination of this style and the
given other style.
If other has inherit set to true, its null
properties are replaced with the non-null properties of this text style.
If other has inherit set to false, returns other unchanged.
Sourcepub fn get_text_style(&self) -> TextStyle
pub fn get_text_style(&self) -> TextStyle
The style information for text runs, encoded for use by dart:ui.
Sourcepub fn get_text_style_with(&self, text_scaler: &TextScaler) -> TextStyle
pub fn get_text_style_with(&self, text_scaler: &TextScaler) -> TextStyle
The style information for text runs, encoded for use by dart:ui, with the font
size scaled by text_scaler (Dart’s getTextStyle(textScaler: scaler)).
Sourcepub fn get_paragraph_style(&self) -> GetParagraphStyle<'_>
pub fn get_paragraph_style(&self) -> GetParagraphStyle<'_>
The style information for paragraphs, encoded for use by dart:ui.
Chain optional Dart named arguments, then GetParagraphStyle::build.
Sourcepub fn compare_to(&self, other: &TextStyle) -> RenderComparison
pub fn compare_to(&self, other: &TextStyle) -> RenderComparison
Describe the difference between this style and another, in terms of how much damage it will make to the rendering.
Sourcepub fn debug_fill_properties_with_prefix(
&self,
properties: &mut DiagnosticPropertiesBuilder,
prefix: &str,
)
pub fn debug_fill_properties_with_prefix( &self, properties: &mut DiagnosticPropertiesBuilder, prefix: &str, )
Dart debugFillProperties(properties, {String prefix = ''}).
TextSpan calls this to add the style’s properties to its own node, where Dart’s
InlineSpan.debugFillProperties does.
Trait Implementations§
Source§impl Clone for AnyTextStyle
impl Clone for AnyTextStyle
Source§fn clone(&self) -> AnyTextStyle
fn clone(&self) -> AnyTextStyle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnyTextStyle
impl Debug for AnyTextStyle
Source§impl Deref for AnyTextStyle
impl Deref for AnyTextStyle
Source§impl Display for AnyTextStyle
Dart’s TextStyle.toString and a text-style subclass’s, which the inner Debug writes.
impl Display for AnyTextStyle
Dart’s TextStyle.toString and a text-style subclass’s, which the inner Debug writes.
Source§impl From<TextStyle> for AnyTextStyle
impl From<TextStyle> for AnyTextStyle
Source§fn from(value: TextStyle) -> AnyTextStyle
fn from(value: TextStyle) -> AnyTextStyle
Source§impl From<WidgetStateTextStyle> for AnyTextStyle
impl From<WidgetStateTextStyle> for AnyTextStyle
Source§fn from(style: WidgetStateTextStyle) -> AnyTextStyle
fn from(style: WidgetStateTextStyle) -> AnyTextStyle
Source§impl MaybeWidgetStateProperty<TextStyle> for AnyTextStyle
impl MaybeWidgetStateProperty<TextStyle> for AnyTextStyle
Source§fn as_widget_state_property(
&self,
) -> Option<&dyn WidgetStateProperty<TextStyle>>
fn as_widget_state_property( &self, ) -> Option<&dyn WidgetStateProperty<TextStyle>>
Source§fn from_resolved(value: TextStyle) -> AnyTextStyle
fn from_resolved(value: TextStyle) -> AnyTextStyle
T is both).