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 53-78)
50fn fabs(state: &Showcase) -> material::Element<'_, Message> {
51 use material::widget::button::{self, FabSize, FabVariant};
52
53 page::stack([
54 page::row(button::enabled_actions(
55 state.enabled,
56 Message::Increment,
57 [
58 button::fab("add", FabVariant::Surface, FabSize::Small),
59 button::fab("add", FabVariant::Surface, FabSize::Standard),
60 button::fab("add", FabVariant::Surface, FabSize::Large),
61 button::fab("add", FabVariant::Primary, FabSize::Standard),
62 button::fab("add", FabVariant::Secondary, FabSize::Standard),
63 button::fab("add", FabVariant::Tertiary, FabSize::Standard),
64 ],
65 ))
66 .into(),
67 page::row(button::enabled_actions(
68 state.enabled,
69 Message::Increment,
70 [
71 button::extended_fab_with_icon("add", "Create", FabVariant::Primary),
72 button::extended_fab_with_icon("share", "Share", FabVariant::Secondary),
73 button::extended_fab_with_icon("add", "Add", FabVariant::Tertiary),
74 button::extended_fab("Reroute", FabVariant::Surface),
75 ],
76 ))
77 .into(),
78 ])
79 .into()
80}More 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}