Fix background leaking through popups

This commit is contained in:
Joscha 2022-07-24 22:24:07 +02:00
parent db19dbe818
commit c6b0193849
3 changed files with 13 additions and 8 deletions

View file

@ -95,7 +95,7 @@ impl EuphRoom {
State::Normal => chat,
State::ChooseNick(ed) => Layer::new(vec![
chat,
Float::new(Border::new(
Float::new(Border::new(Background::new(
Padding::new(VJoin::new(vec![
Segment::new(Text::new("Choose nick ")),
Segment::new(
@ -104,7 +104,7 @@ impl EuphRoom {
),
]))
.left(1),
))
)))
.horizontal(0.5)
.vertical(0.5)
.into(),
@ -207,7 +207,7 @@ impl EuphRoom {
list.add_sel(
id,
Text::new(normal),
Background::new(Text::new(selected), style_inv),
Background::new(Text::new(selected)).style(style_inv),
);
}

View file

@ -102,7 +102,7 @@ impl Rooms {
let room_style = ContentStyle::default().bold().blue();
Layer::new(vec![
self.rooms_widget().await,
Float::new(Border::new(
Float::new(Border::new(Background::new(
Padding::new(VJoin::new(vec![
Segment::new(Text::new("Connect to ")),
Segment::new(HJoin::new(vec![
@ -113,7 +113,7 @@ impl Rooms {
])),
]))
.left(1),
))
)))
.horizontal(0.5)
.vertical(0.5)
.into(),
@ -188,7 +188,7 @@ impl Rooms {
list.add_sel(
room,
Text::new(normal),
Background::new(Text::new(selected), bg_sel_style),
Background::new(Text::new(selected)).style(bg_sel_style),
);
}
}

View file

@ -10,12 +10,17 @@ pub struct Background {
}
impl Background {
pub fn new<W: Into<BoxedWidget>>(inner: W, style: ContentStyle) -> Self {
pub fn new<W: Into<BoxedWidget>>(inner: W) -> Self {
Self {
inner: inner.into(),
style,
style: ContentStyle::default(),
}
}
pub fn style(mut self, style: ContentStyle) -> Self {
self.style = style;
self
}
}
#[async_trait]