Incular logoIncular
API ReferenceLayout Widgets

Padding

Inset a child by EdgeInsets with convenience constructors.

Padding { padding, child } — both required, no defaults.

Props

Prop

Type

use incular::prelude::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let app = Application::new(|_cx| {
        Container::builder()
            .alignment(Alignment::CENTER)
            .child(
                Padding::symmetric(12.0, 6.0, Text::new("Padded")),
            )
            .build()
            .into()
    })?;
    incular::run(app)?;
    Ok(())
}

## Methods

```rust
pub fn new(padding: impl Into<EdgeInsets>, child: impl Into<Widget>) -> Self
pub fn all(value: f32, child: impl Into<Widget>) -> Self
pub fn symmetric(horizontal: f32, vertical: f32, child: impl Into<Widget>) -> Self
pub fn zero(child: impl Into<Widget>) -> Self

See EdgeInsets. For margin use Container.

Related: Align, Center.

On this page