Use Container::Box in screenshot example

This commit is contained in:
Héctor Ramón Jiménez 2023-06-06 15:39:29 +02:00
parent 233196eb14
commit 5ed9452877
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -154,7 +154,7 @@ impl Application for Example {
let image = container(image)
.padding(10)
.style(Container::Custom(Box::new(ScreenshotDisplayContainer)))
.style(Container::Box)
.width(Length::FillPortion(2))
.height(Length::Fill)
.center_x()
@ -272,22 +272,6 @@ impl Application for Example {
}
}
struct ScreenshotDisplayContainer;
impl container::StyleSheet for ScreenshotDisplayContainer {
type Style = Theme;
fn appearance(&self, style: &Self::Style) -> container::Appearance {
container::Appearance {
text_color: None,
background: None,
border_radius: 5.0,
border_width: 4.0,
border_color: style.palette().primary,
}
}
}
async fn save_to_png(screenshot: Screenshot) -> Result<String, PngError> {
let path = "screenshot.png".to_string();
img::save_buffer(