Show Ferris at the end of the scrollable section
This commit is contained in:
parent
85dab04965
commit
022dc0139b
1 changed files with 17 additions and 14 deletions
|
|
@ -510,20 +510,7 @@ impl<'a> Step {
|
||||||
) -> Column<'a, StepMessage> {
|
) -> Column<'a, StepMessage> {
|
||||||
Self::container("Image")
|
Self::container("Image")
|
||||||
.push(Text::new("An image that tries to keep its aspect ratio."))
|
.push(Text::new("An image that tries to keep its aspect ratio."))
|
||||||
.push(
|
.push(ferris(width))
|
||||||
// This should go away once we unify resource loading on native
|
|
||||||
// platforms
|
|
||||||
if cfg!(target_arch = "wasm32") {
|
|
||||||
Image::new("resources/ferris.png")
|
|
||||||
} else {
|
|
||||||
Image::new(format!(
|
|
||||||
"{}/examples/resources/ferris.png",
|
|
||||||
env!("CARGO_MANIFEST_DIR")
|
|
||||||
))
|
|
||||||
}
|
|
||||||
.width(Length::Units(width))
|
|
||||||
.align_self(Align::Center),
|
|
||||||
)
|
|
||||||
.push(Slider::new(
|
.push(Slider::new(
|
||||||
slider,
|
slider,
|
||||||
100.0..=500.0,
|
100.0..=500.0,
|
||||||
|
|
@ -555,6 +542,7 @@ impl<'a> Step {
|
||||||
.horizontal_alignment(HorizontalAlignment::Center),
|
.horizontal_alignment(HorizontalAlignment::Center),
|
||||||
)
|
)
|
||||||
.push(Column::new().height(Length::Units(4096)))
|
.push(Column::new().height(Length::Units(4096)))
|
||||||
|
.push(ferris(300))
|
||||||
.push(
|
.push(
|
||||||
Text::new("You made it!")
|
Text::new("You made it!")
|
||||||
.size(50)
|
.size(50)
|
||||||
|
|
@ -589,6 +577,21 @@ impl<'a> Step {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ferris(width: u16) -> Image {
|
||||||
|
// This should go away once we unify resource loading on native
|
||||||
|
// platforms
|
||||||
|
if cfg!(target_arch = "wasm32") {
|
||||||
|
Image::new("resources/ferris.png")
|
||||||
|
} else {
|
||||||
|
Image::new(format!(
|
||||||
|
"{}/examples/resources/ferris.png",
|
||||||
|
env!("CARGO_MANIFEST_DIR")
|
||||||
|
))
|
||||||
|
}
|
||||||
|
.width(Length::Units(width))
|
||||||
|
.align_self(Align::Center)
|
||||||
|
}
|
||||||
|
|
||||||
fn button<'a, Message>(
|
fn button<'a, Message>(
|
||||||
state: &'a mut button::State,
|
state: &'a mut button::State,
|
||||||
label: &str,
|
label: &str,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue