refactor: used FixedPortion for layout of the settings item
This makes sure that the control always has at least the specified portion of the available space
This commit is contained in:
parent
e154c2ef42
commit
fd7ddf7ff5
1 changed files with 10 additions and 3 deletions
|
|
@ -8,6 +8,8 @@ use crate::{
|
||||||
Element,
|
Element,
|
||||||
};
|
};
|
||||||
use derive_setters::Setters;
|
use derive_setters::Setters;
|
||||||
|
use iced_core::Length;
|
||||||
|
use iced_widget::container;
|
||||||
|
|
||||||
/// A settings item aligned in a row
|
/// A settings item aligned in a row
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
@ -70,15 +72,20 @@ impl<'a, Message: 'static> Item<'a, Message> {
|
||||||
let column = column::with_capacity(2)
|
let column = column::with_capacity(2)
|
||||||
.spacing(2)
|
.spacing(2)
|
||||||
.push(text(self.title))
|
.push(text(self.title))
|
||||||
.push(text(description).size(10));
|
.push(text(description).size(10))
|
||||||
|
.width(Length::FillPortion(12));
|
||||||
|
|
||||||
contents.push(column.into());
|
contents.push(column.into());
|
||||||
} else {
|
} else {
|
||||||
contents.push(text(self.title).into());
|
contents.push(text(self.title).into());
|
||||||
}
|
}
|
||||||
|
|
||||||
contents.push(horizontal_space(iced::Length::Fill).into());
|
contents.push(
|
||||||
contents.push(widget.into());
|
container(widget.into())
|
||||||
|
.width(Length::FillPortion(4))
|
||||||
|
.align_x(iced_core::alignment::Horizontal::Right)
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
|
|
||||||
item_row(contents)
|
item_row(contents)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue