Skip to main content

AnyTextStyle

Struct AnyTextStyle 

Source
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

Source

pub fn new(value: TextStyle) -> AnyTextStyle

A plain value.

Source

pub fn with_shared( value: TextStyle, extension: Rc<dyn TextStyleExtension>, ) -> AnyTextStyle

A subclass instance: value is what it passed to super.

Source

pub fn value(&self) -> &TextStyle

The plain value: the subclass’s super value.

Source

pub fn extension<E>(&self) -> Option<&E>

Dart’s value is T: the subclass instance, if this value is one.

Source

pub fn has_extension(&self) -> bool

Whether this value is a subclass instance.

Methods from Deref<Target = TextStyle>§

Source

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/.

Source

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).

Source

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.

Source

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.

Source

pub fn get_text_style(&self) -> TextStyle

The style information for text runs, encoded for use by dart:ui.

Source

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)).

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> AnyTextStyle

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 AnyTextStyle

Source§

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

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

impl Deref for AnyTextStyle

Source§

type Target = TextStyle

The resulting type after dereferencing.
Source§

fn deref(&self) -> &TextStyle

Dereferences the value.
Source§

impl Display for AnyTextStyle

Dart’s TextStyle.toString and a text-style subclass’s, which the inner Debug writes.

Source§

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

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

impl From<TextStyle> for AnyTextStyle

Source§

fn from(value: TextStyle) -> AnyTextStyle

Converts to this type from the input type.
Source§

impl From<WidgetStateTextStyle> for AnyTextStyle

Source§

fn from(style: WidgetStateTextStyle) -> AnyTextStyle

Converts to this type from the input type.
Source§

impl MaybeWidgetStateProperty<TextStyle> for AnyTextStyle

Source§

fn as_widget_state_property( &self, ) -> Option<&dyn WidgetStateProperty<TextStyle>>

The property this value is, if it is one.
Source§

fn from_resolved(value: TextStyle) -> AnyTextStyle

A resolved value as this type (Dart’s T is both).
Source§

impl PartialEq for AnyTextStyle

Source§

fn eq(&self, other: &AnyTextStyle) -> 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 AnyTextStyle

§

impl !Send for AnyTextStyle

§

impl !Sync for AnyTextStyle

§

impl !UnwindSafe for AnyTextStyle

§

impl Forget for AnyTextStyle

§

impl Freeze for AnyTextStyle

§

impl Move for AnyTextStyle

§

impl Unpin for AnyTextStyle
where &'static dyn ColorExtension: Unpin, Rc<dyn ColorExtension>: Unpin, *const u8 is !null: Unpin, Rc<Paint>: Unpin, Rc<dyn TextStyleExtension>: Unpin,

§

impl UnsafeUnpin for AnyTextStyle

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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>