cosmic::iced::widget

Function container

source
pub fn container<'a, Message, Theme, Renderer>(
    content: impl Into<Element<'a, Message, Theme, Renderer>>,
) -> Container<'a, Message, Theme, Renderer>
where Theme: Catalog + 'a, Renderer: Renderer,
Expand description

Creates a new Container with the provided content.

Containers let you align a widget inside their boundaries.

ยงExample

use iced::widget::container;

enum Message {
    // ...
}

fn view(state: &State) -> Element<'_, Message> {
    container("This text is centered inside a rounded box!")
        .padding(10)
        .center(800)
        .style(container::rounded_box)
        .into()
}