pub trait TextModifiers: Modifiable {
Show 17 methods
// Provided methods
fn text<T>(self, value: impl Res<T>) -> Self
where T: ToStringLocalized { ... }
fn font_family<U>(self, value: impl Res<U>) -> Self
where U: Into<Vec<FamilyOwned>> { ... }
fn font_weight<U>(self, value: impl Res<U>) -> Self
where U: Into<FontWeight> { ... }
fn font_slant<U>(self, value: impl Res<U>) -> Self
where U: Into<FontSlant> { ... }
fn font_width<U>(self, value: impl Res<U>) -> Self
where U: Into<FontWidth> { ... }
fn font_variation_settings<U>(self, value: impl Res<U>) -> Self
where U: Into<Vec<FontVariation>> { ... }
fn color<U>(self, value: impl Res<U>) -> Self
where U: Clone + Into<Color> { ... }
fn font_size<U>(self, value: impl Res<U>) -> Self
where U: Into<FontSize> { ... }
fn caret_color<U>(self, value: impl Res<U>) -> Self
where U: Into<Color> { ... }
fn selection_color<U>(self, value: impl Res<U>) -> Self
where U: Into<Color> { ... }
fn text_wrap<U>(self, value: impl Res<U>) -> Self
where U: Into<bool> { ... }
fn text_align<U>(self, value: impl Res<U>) -> Self
where U: Into<TextAlign> { ... }
fn text_overflow<U>(self, value: impl Res<U>) -> Self
where U: Into<TextOverflow> { ... }
fn line_clamp<U>(self, value: impl Res<U>) -> Self
where U: Into<LineClamp> { ... }
fn text_decoration_line<U>(self, value: impl Res<U>) -> Self
where U: Into<TextDecorationLine> { ... }
fn text_stroke_width<U>(self, value: impl Res<U>) -> Self
where U: Into<Length> { ... }
fn text_stroke_style<U>(self, value: impl Res<U>) -> Self
where U: Into<TextStrokeStyle> { ... }
}
Expand description
Modifiers for changing the text properties of a view.
Provided Methods§
Sourcefn text<T>(self, value: impl Res<T>) -> Selfwhere
T: ToStringLocalized,
fn text<T>(self, value: impl Res<T>) -> Selfwhere
T: ToStringLocalized,
Sets the text content of the view.
Sourcefn font_family<U>(self, value: impl Res<U>) -> Self
fn font_family<U>(self, value: impl Res<U>) -> Self
Sets the font that should be used by the view.
The font name refers to the name assigned when the font is added to context.
Sourcefn font_weight<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<FontWeight>,
fn font_weight<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<FontWeight>,
Sets the font weight that should be used by the view.
Sourcefn font_slant<U>(self, value: impl Res<U>) -> Self
fn font_slant<U>(self, value: impl Res<U>) -> Self
Sets the font style that should be used by the view.
Sourcefn font_width<U>(self, value: impl Res<U>) -> Self
fn font_width<U>(self, value: impl Res<U>) -> Self
Sets the font stretch that should be used by the view if the font supports it.
Sourcefn font_variation_settings<U>(self, value: impl Res<U>) -> Self
fn font_variation_settings<U>(self, value: impl Res<U>) -> Self
Sets the font variation settings that should be used by the view.
Sourcefn caret_color<U>(self, value: impl Res<U>) -> Self
fn caret_color<U>(self, value: impl Res<U>) -> Self
Sets the ext caret color of the view.
Sourcefn selection_color<U>(self, value: impl Res<U>) -> Self
fn selection_color<U>(self, value: impl Res<U>) -> Self
Sets the color used to highlight selected text within the view.
Sourcefn text_wrap<U>(self, value: impl Res<U>) -> Self
fn text_wrap<U>(self, value: impl Res<U>) -> Self
Sets whether the text of the view should be allowed to wrap.
Sourcefn text_align<U>(self, value: impl Res<U>) -> Self
fn text_align<U>(self, value: impl Res<U>) -> Self
Sets the horizontal alignment of text within the view.
Sourcefn text_overflow<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<TextOverflow>,
fn text_overflow<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<TextOverflow>,
Sets the text overflow.
Sourcefn line_clamp<U>(self, value: impl Res<U>) -> Self
fn line_clamp<U>(self, value: impl Res<U>) -> Self
Sets the max number of .
Sourcefn text_decoration_line<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<TextDecorationLine>,
fn text_decoration_line<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<TextDecorationLine>,
Sets the max number of .
Sourcefn text_stroke_width<U>(self, value: impl Res<U>) -> Self
fn text_stroke_width<U>(self, value: impl Res<U>) -> Self
Sets the width of the text stroke.
This sets Skia’s skia_safe::textlayout::TextStyle
’s foreground skia_safe::Paint
to
draw a stroke on the text.
See also Self::text_stroke_style
.
Sourcefn text_stroke_style<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<TextStrokeStyle>,
fn text_stroke_style<U>(self, value: impl Res<U>) -> Selfwhere
U: Into<TextStrokeStyle>,
Sets the paint style of the text stroke. You can either draw text with a stroke, or just the stroke outline.
If you desire to paint the text stroke in a separate colour to the fill property, Skia does not seem to support this (see the discussion on the PR to add text stroke).
A workaround would involve a ZStack
to overlay two copies of the
same text, one with a stroke and one without. These can have two
different colours. See also the Flutter documentation
on achieving this.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.