Improve layout of ferris example 🦀
This commit is contained in:
parent
fa9e1d96ea
commit
afb4cb99b9
1 changed files with 16 additions and 16 deletions
|
|
@ -110,7 +110,7 @@ impl Image {
|
||||||
.spacing(20)
|
.spacing(20)
|
||||||
.align_items(Alignment::Center);
|
.align_items(Alignment::Center);
|
||||||
|
|
||||||
let sizing = row![
|
let fit = row![
|
||||||
pick_list(
|
pick_list(
|
||||||
[
|
[
|
||||||
ContentFit::Contain,
|
ContentFit::Contain,
|
||||||
|
|
@ -123,20 +123,6 @@ impl Image {
|
||||||
Message::ContentFitChanged
|
Message::ContentFitChanged
|
||||||
)
|
)
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
with_value(
|
|
||||||
slider(100.0..=500.0, self.width, Message::WidthChanged),
|
|
||||||
format!("Width: {}px", self.width)
|
|
||||||
),
|
|
||||||
with_value(
|
|
||||||
slider(0.0..=1.0, self.opacity, Message::OpacityChanged)
|
|
||||||
.step(0.01),
|
|
||||||
format!("Opacity: {:.2}", self.opacity)
|
|
||||||
)
|
|
||||||
]
|
|
||||||
.spacing(10)
|
|
||||||
.align_items(Alignment::End);
|
|
||||||
|
|
||||||
let rotation = row![
|
|
||||||
pick_list(
|
pick_list(
|
||||||
[RotationStrategy::Floating, RotationStrategy::Solid],
|
[RotationStrategy::Floating, RotationStrategy::Solid],
|
||||||
Some(match self.rotation {
|
Some(match self.rotation {
|
||||||
|
|
@ -146,6 +132,20 @@ impl Image {
|
||||||
Message::RotationStrategyChanged,
|
Message::RotationStrategyChanged,
|
||||||
)
|
)
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
|
]
|
||||||
|
.spacing(10)
|
||||||
|
.align_items(Alignment::End);
|
||||||
|
|
||||||
|
let properties = row![
|
||||||
|
with_value(
|
||||||
|
slider(100.0..=500.0, self.width, Message::WidthChanged),
|
||||||
|
format!("Width: {}px", self.width)
|
||||||
|
),
|
||||||
|
with_value(
|
||||||
|
slider(0.0..=1.0, self.opacity, Message::OpacityChanged)
|
||||||
|
.step(0.01),
|
||||||
|
format!("Opacity: {:.2}", self.opacity)
|
||||||
|
),
|
||||||
with_value(
|
with_value(
|
||||||
row![
|
row![
|
||||||
slider(
|
slider(
|
||||||
|
|
@ -166,7 +166,7 @@ impl Image {
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
.align_items(Alignment::End);
|
.align_items(Alignment::End);
|
||||||
|
|
||||||
container(column![center(i_am_ferris), sizing, rotation].spacing(10))
|
container(column![fit, center(i_am_ferris), properties].spacing(10))
|
||||||
.padding(10)
|
.padding(10)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue