mirror of https://github.com/linebender/xilem
Pair image with copyright notice in http_cats example. (#895)
While on slow internet connection I noticed that copyright notice is conflicting with the spinner:  So I paired the image with the copyright notice to display it only when image is loaded. I hope this is not complicating the example code. --------- Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
This commit is contained in:
parent
6d1d6b9217
commit
e1907a242a
|
@ -182,17 +182,8 @@ impl Status {
|
||||||
),
|
),
|
||||||
ImageState::Pending => OneOf3::B(sized_box(spinner()).width(80.).height(80.)),
|
ImageState::Pending => OneOf3::B(sized_box(spinner()).width(80.).height(80.)),
|
||||||
// TODO: Alt text?
|
// TODO: Alt text?
|
||||||
ImageState::Available(image_data) => OneOf3::C(image(image_data)),
|
ImageState::Available(image_data) => {
|
||||||
};
|
let attribution = sized_box(
|
||||||
flex((
|
|
||||||
prose(format!("HTTP Status Code: {}", self.code)).alignment(TextAlignment::Middle),
|
|
||||||
prose(self.message)
|
|
||||||
.text_size(20.)
|
|
||||||
.alignment(TextAlignment::Middle),
|
|
||||||
FlexSpacer::Fixed(10.),
|
|
||||||
zstack((
|
|
||||||
image,
|
|
||||||
sized_box(
|
|
||||||
sized_box(
|
sized_box(
|
||||||
prose("Copyright ©️ https://http.cat")
|
prose("Copyright ©️ https://http.cat")
|
||||||
.line_break_mode(LineBreaking::Clip)
|
.line_break_mode(LineBreaking::Clip)
|
||||||
|
@ -202,9 +193,20 @@ impl Status {
|
||||||
.rounded(4.)
|
.rounded(4.)
|
||||||
.background(palette::css::BLACK.multiply_alpha(0.5)),
|
.background(palette::css::BLACK.multiply_alpha(0.5)),
|
||||||
)
|
)
|
||||||
.padding((30., 42., 0., 0.))
|
.padding((30., 42., 0., 0.));
|
||||||
.alignment(Alignment::TopTrailing),
|
OneOf3::C(zstack((
|
||||||
)),
|
image(image_data),
|
||||||
|
attribution.alignment(Alignment::TopTrailing),
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
flex((
|
||||||
|
prose(format!("HTTP Status Code: {}", self.code)).alignment(TextAlignment::Middle),
|
||||||
|
prose(self.message)
|
||||||
|
.text_size(20.)
|
||||||
|
.alignment(TextAlignment::Middle),
|
||||||
|
FlexSpacer::Fixed(10.),
|
||||||
|
image,
|
||||||
))
|
))
|
||||||
.main_axis_alignment(xilem::view::MainAxisAlignment::Start)
|
.main_axis_alignment(xilem::view::MainAxisAlignment::Start)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue