Skip to content

Commit

Permalink
Add background to copyright text in http_cats
Browse files Browse the repository at this point in the history
to make it more readable and to demonstrate more use cases of sized_box.
  • Loading branch information
viktorstrate committed Nov 22, 2024
1 parent 6b75fb0 commit bac2180
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions xilem/examples/http_cats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use std::sync::Arc;

use masonry::widget::Alignment;
use masonry::widget::{Alignment, LineBreaking};
use vello::peniko::{Blob, Image};
use winit::dpi::LogicalSize;
use winit::error::EventLoopError;
Expand Down Expand Up @@ -200,9 +200,18 @@ impl Status {
FlexSpacer::Fixed(10.),
zstack((
image,
sized_box(
sized_box(
prose("Copyright ©️ https://http.cat")
.line_break_mode(LineBreaking::Clip)
.alignment(TextAlignment::End),
)
.padding(4.)
.rounded(4.)
.background(Color::BLACK.multiply_alpha(0.5)),
)
// HACK: Trailing padding workaround scrollbar covering content
sized_box(prose("Copyright ©️ https://http.cat").alignment(TextAlignment::End))
.padding((30., 40., 0., 0.)),
.padding((30., 42., 0., 0.)),
))
.alignment(Alignment::TopTrailing),
))
Expand Down

0 comments on commit bac2180

Please sign in to comment.