Skip to content

Commit

Permalink
Use Container::Box in screenshot example
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Jun 6, 2023
1 parent 233196e commit 5ed9452
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions examples/screenshot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 5ed9452

Please sign in to comment.