pub struct Text {
pub text: String,
pub color: Option<Color>,
pub size: f32,
pub align: TextAlign,
pub weight: FontWeight,
pub max_lines: Option<usize>,
/* private fields */
}Expand description
A plain text leaf widget.
Color defaults to the theme’s on_surface — no explicit color needed.
Fields§
§text: String§color: Option<Color>None = use theme.colors.on_surface. Some(c) = explicit override.
size: f32§align: TextAlign§weight: FontWeight§max_lines: Option<usize>Implementations§
Source§impl Text
impl Text
pub fn new(text: impl Into<String>) -> Self
Sourcepub fn rich(spans: RichText) -> Self
pub fn rich(spans: RichText) -> Self
A paragraph of mixed-style spans (bold/italic/color/underline changes
mid-paragraph) — see rosace_text::RichText’s builder
(.text(...)/.bold(...)/.push(...)). Wrapping/alignment/color
still apply; .size()/.weight()/.color() on this widget do NOT
(each span carries its own).
pub fn color(self, c: Color) -> Self
pub fn size(self, s: f32) -> Self
pub fn align(self, a: TextAlign) -> Self
pub fn weight(self, w: FontWeight) -> Self
pub fn max_lines(self, n: usize) -> Self
Trait Implementations§
Source§impl Widget for Text
impl Widget for Text
Source§fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
Measure under
ctx.constraints and return a size within them. Read moreSource§fn children(&self) -> Children<'_>
fn children(&self) -> Children<'_>
Declare this widget’s children. Drives every default below.
Source§fn flex_factor(&self) -> f32
fn flex_factor(&self) -> f32
Flex weight inside Row/Column. Wrappers are transparent by default.
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnsafeUnpin for Text
impl UnwindSafe for Text
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<W> FocusApi for W
impl<W> FocusApi for W
Source§fn focus_node(self, node: FocusNode) -> WithFocus<Self>
fn focus_node(self, node: FocusNode) -> WithFocus<Self>
Attach a focus node. This enables focus-ring rendering and explicit
neighbor wiring.