Skip to main content

stack

Function stack 

Source
pub fn stack<'a, Message, Renderer>(
    children: impl IntoIterator<Item = Element<'a, Message, Theme, Renderer>>,
) -> Column<'a, Message, Theme, Renderer>
where Message: 'a, Renderer: Renderer + 'a,
Expand description

Creates a full-width vertical stack for page content.

Examples found in repository?
examples/showcase/pages/controls.rs (lines 45-70)
42fn fabs(state: &Showcase) -> material::Element<'_, Message> {
43    use material::widget::button;
44
45    page::stack([
46        page::row(button::enabled_actions(
47            state.enabled,
48            Message::Increment,
49            [
50                button::surface_small_fab("add"),
51                button::surface_fab("add"),
52                button::surface_large_fab("add"),
53                button::primary_fab("add"),
54                button::secondary_fab("add"),
55                button::tertiary_fab("add"),
56            ],
57        ))
58        .into(),
59        page::row(button::enabled_actions(
60            state.enabled,
61            Message::Increment,
62            [
63                button::primary_extended_fab_with_icon("add", "Create"),
64                button::secondary_extended_fab_with_icon("share", "Share"),
65                button::tertiary_extended_fab_with_icon("add", "Add"),
66                button::surface_extended_fab("Reroute"),
67            ],
68        ))
69        .into(),
70    ])
71    .into()
72}
More examples
Hide additional examples
examples/showcase/pages/inputs.rs (line 34)
6pub(super) fn view(state: &Showcase) -> material::Element<'_, Message> {
7    let input = material::widget::text_input::outlined("Write a note", &state.note)
8        .on_input(Message::TextChanged);
9
10    let editor = material::widget::text_editor::outlined_area(&state.editor_content)
11        .placeholder("Write details")
12        .on_action(Message::EditorAction);
13
14    let select_options = ["Assist", "Suggestion", "Filter"];
15    let select = material::widget::select::outlined(
16        select_options,
17        state.select_choice,
18        Message::SelectChanged,
19    )
20    .placeholder("Choose a chip")
21    .label("Chip type");
22
23    let combobox = material::widget::combobox::outlined_with_input(
24        &state.combobox_options,
25        "Search a chip",
26        &state.combobox_input,
27        state.combobox_choice.as_ref(),
28        Message::ComboboxSelected,
29    )
30    .label("Searchable chip")
31    .on_input(Message::ComboboxInputChanged);
32
33    page::sections([
34        page::section("Text fields", page::stack([input.into(), editor.into()])).into(),
35        page::section(
36            "Selection fields",
37            page::stack([select.into(), combobox.into()]),
38        )
39        .into(),
40        page::section("Pickers", pickers(state)).into(),
41        page::section("Search", search_bar(state)).into(),
42        page::section("Dividers", dividers()).into(),
43    ])
44    .into()
45}
46
47fn pickers(state: &Showcase) -> material::Element<'_, Message> {
48    page::stack([
49        material::widget::picker::date_picker(&state.date_picker, Message::DatePickerChanged),
50        material::widget::picker::date_range_picker(
51            &state.date_range_picker,
52            Message::DateRangePickerChanged,
53        ),
54        material::widget::picker::time_picker(&state.time_picker, Message::TimePickerChanged),
55    ])
56    .into()
57}