Use Container::Box in screenshot example
This commit is contained in:
parent
233196eb14
commit
5ed9452877
1 changed files with 1 additions and 17 deletions
|
|
@ -154,7 +154,7 @@ impl Application for Example {
|
||||||
|
|
||||||
let image = container(image)
|
let image = container(image)
|
||||||
.padding(10)
|
.padding(10)
|
||||||
.style(Container::Custom(Box::new(ScreenshotDisplayContainer)))
|
.style(Container::Box)
|
||||||
.width(Length::FillPortion(2))
|
.width(Length::FillPortion(2))
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.center_x()
|
.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> {
|
async fn save_to_png(screenshot: Screenshot) -> Result<String, PngError> {
|
||||||
let path = "screenshot.png".to_string();
|
let path = "screenshot.png".to_string();
|
||||||
img::save_buffer(
|
img::save_buffer(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue