Wrap spacers in scrollable as well.
This commit is contained in:
parent
1041af65d6
commit
21efe1546c
1 changed files with 89 additions and 89 deletions
|
|
@ -20,7 +20,7 @@ use cosmic::{
|
||||||
radio,
|
radio,
|
||||||
row,
|
row,
|
||||||
slider,
|
slider,
|
||||||
text,
|
text,
|
||||||
scrollable,
|
scrollable,
|
||||||
},
|
},
|
||||||
iced_lazy::responsive,
|
iced_lazy::responsive,
|
||||||
|
|
@ -120,101 +120,101 @@ impl Sandbox for Window {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let content: Element<_> = scrollable(
|
let content: Element<_> = list_view!(
|
||||||
list_view!(
|
list_section!(
|
||||||
list_section!(
|
"Debug",
|
||||||
"Debug",
|
choose_theme,
|
||||||
choose_theme,
|
toggler(
|
||||||
toggler(
|
String::from("Debug layout"),
|
||||||
String::from("Debug layout"),
|
self.debug,
|
||||||
self.debug,
|
Message::Debug,
|
||||||
Message::Debug,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
list_section!(
|
|
||||||
"Buttons",
|
|
||||||
list_row!(
|
|
||||||
button!("Primary")
|
|
||||||
.style(theme::Button::Primary)
|
|
||||||
.on_press(Message::ButtonPressed)
|
|
||||||
,
|
|
||||||
button!("Secondary")
|
|
||||||
.style(theme::Button::Secondary)
|
|
||||||
.on_press(Message::ButtonPressed)
|
|
||||||
,
|
|
||||||
button!("Positive")
|
|
||||||
.style(theme::Button::Positive)
|
|
||||||
.on_press(Message::ButtonPressed)
|
|
||||||
,
|
|
||||||
button!("Destructive")
|
|
||||||
.style(theme::Button::Destructive)
|
|
||||||
.on_press(Message::ButtonPressed)
|
|
||||||
,
|
|
||||||
button!("Text")
|
|
||||||
.style(theme::Button::Text)
|
|
||||||
.on_press(Message::ButtonPressed)
|
|
||||||
,
|
|
||||||
),
|
|
||||||
list_row!(
|
|
||||||
button!("Primary")
|
|
||||||
.style(theme::Button::Primary)
|
|
||||||
,
|
|
||||||
button!("Secondary")
|
|
||||||
.style(theme::Button::Secondary)
|
|
||||||
,
|
|
||||||
button!("Positive")
|
|
||||||
.style(theme::Button::Positive)
|
|
||||||
,
|
|
||||||
button!("Destructive")
|
|
||||||
.style(theme::Button::Destructive)
|
|
||||||
,
|
|
||||||
button!("Text")
|
|
||||||
.style(theme::Button::Text)
|
|
||||||
,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
list_section!(
|
|
||||||
"Controls",
|
|
||||||
list_item!(
|
|
||||||
"Toggler",
|
|
||||||
toggler(None, self.toggler_value, Message::TogglerToggled)
|
|
||||||
),
|
|
||||||
list_item!(
|
|
||||||
"Pick List (TODO)",
|
|
||||||
pick_list(
|
|
||||||
vec![
|
|
||||||
"Option 1",
|
|
||||||
"Option 2",
|
|
||||||
"Option 3",
|
|
||||||
"Option 4",
|
|
||||||
],
|
|
||||||
self.pick_list_selected,
|
|
||||||
Message::PickListSelected
|
|
||||||
)
|
|
||||||
.padding([8, 0, 8, 16])
|
|
||||||
),
|
|
||||||
list_item!(
|
|
||||||
"Slider",
|
|
||||||
slider(0.0..=100.0, self.slider_value, Message::SliderChanged)
|
|
||||||
.width(Length::Units(250))
|
|
||||||
),
|
|
||||||
list_item!(
|
|
||||||
"Progress",
|
|
||||||
progress_bar(0.0..=100.0, self.slider_value)
|
|
||||||
.width(Length::Units(250))
|
|
||||||
.height(Length::Units(4))
|
|
||||||
),
|
|
||||||
checkbox("Checkbox", self.checkbox_value, Message::CheckboxToggled),
|
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
list_section!(
|
||||||
|
"Buttons",
|
||||||
|
list_row!(
|
||||||
|
button!("Primary")
|
||||||
|
.style(theme::Button::Primary)
|
||||||
|
.on_press(Message::ButtonPressed)
|
||||||
|
,
|
||||||
|
button!("Secondary")
|
||||||
|
.style(theme::Button::Secondary)
|
||||||
|
.on_press(Message::ButtonPressed)
|
||||||
|
,
|
||||||
|
button!("Positive")
|
||||||
|
.style(theme::Button::Positive)
|
||||||
|
.on_press(Message::ButtonPressed)
|
||||||
|
,
|
||||||
|
button!("Destructive")
|
||||||
|
.style(theme::Button::Destructive)
|
||||||
|
.on_press(Message::ButtonPressed)
|
||||||
|
,
|
||||||
|
button!("Text")
|
||||||
|
.style(theme::Button::Text)
|
||||||
|
.on_press(Message::ButtonPressed)
|
||||||
|
,
|
||||||
|
),
|
||||||
|
list_row!(
|
||||||
|
button!("Primary")
|
||||||
|
.style(theme::Button::Primary)
|
||||||
|
,
|
||||||
|
button!("Secondary")
|
||||||
|
.style(theme::Button::Secondary)
|
||||||
|
,
|
||||||
|
button!("Positive")
|
||||||
|
.style(theme::Button::Positive)
|
||||||
|
,
|
||||||
|
button!("Destructive")
|
||||||
|
.style(theme::Button::Destructive)
|
||||||
|
,
|
||||||
|
button!("Text")
|
||||||
|
.style(theme::Button::Text)
|
||||||
|
,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
list_section!(
|
||||||
|
"Controls",
|
||||||
|
list_item!(
|
||||||
|
"Toggler",
|
||||||
|
toggler(None, self.toggler_value, Message::TogglerToggled)
|
||||||
|
),
|
||||||
|
list_item!(
|
||||||
|
"Pick List (TODO)",
|
||||||
|
pick_list(
|
||||||
|
vec![
|
||||||
|
"Option 1",
|
||||||
|
"Option 2",
|
||||||
|
"Option 3",
|
||||||
|
"Option 4",
|
||||||
|
],
|
||||||
|
self.pick_list_selected,
|
||||||
|
Message::PickListSelected
|
||||||
|
)
|
||||||
|
.padding([8, 0, 8, 16])
|
||||||
|
),
|
||||||
|
list_item!(
|
||||||
|
"Slider",
|
||||||
|
slider(0.0..=100.0, self.slider_value, Message::SliderChanged)
|
||||||
|
.width(Length::Units(250))
|
||||||
|
),
|
||||||
|
list_item!(
|
||||||
|
"Progress",
|
||||||
|
progress_bar(0.0..=100.0, self.slider_value)
|
||||||
|
.width(Length::Units(250))
|
||||||
|
.height(Length::Units(4))
|
||||||
|
),
|
||||||
|
checkbox("Checkbox", self.checkbox_value, Message::CheckboxToggled),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
container(row![
|
container(row![
|
||||||
if self.debug { sidebar.explain(Color::WHITE) } else { sidebar },
|
if self.debug { sidebar.explain(Color::WHITE) } else { sidebar },
|
||||||
horizontal_space(Length::Fill),
|
scrollable(row![
|
||||||
if self.debug { content.explain(Color::WHITE) } else { content },
|
horizontal_space(Length::Fill),
|
||||||
horizontal_space(Length::Fill),
|
if self.debug { content.explain(Color::WHITE) } else { content },
|
||||||
|
horizontal_space(Length::Fill),
|
||||||
|
])
|
||||||
])
|
])
|
||||||
.padding([16, 8])
|
.padding([16, 8])
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue