Incular logoIncular
API ReferenceLayout Widgets

Baseline

Position a child at an explicit alphabetic baseline offset.

Baseline places the child's baseline at the given vertical offset, clamped to max(0.0) in both the setter and new.

Props

Prop

Type

use incular::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let app = Application::new(|_cx| {
        Container::builder()
            .padding(EdgeInsets::all(24.0))
            .alignment(Alignment::CENTER)
            .child(
                Row::builder()
                    .cross_axis_alignment(CrossAxisAlignment::Baseline)
                    .children(Vec::<Widget>::from([
                        Baseline::new(32.0, Text::new("Big")).into(),
                        Text::new("small").into(),
                    ]))
                    .build(),
            )
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

Methods

pub fn new(baseline: f32, child: impl Into<Widget>) -> Self

Use with CrossAxisAlignment::Baseline in flex layouts to align mixed-size text rows.

Related: Row.

On this page