More work on partition stage.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
use iced::widget::{Row, container, text};
|
||||
use iced::{Alignment, Color, Element, Length};
|
||||
|
||||
// Assuming your Item struct or type implements Display or has a text representation
|
||||
pub fn color_bar<Message: 'static>(
|
||||
maybe_items: Option<Vec<(String, u16, Color)>>,
|
||||
bar_height: u32,
|
||||
) -> Element<'static, Message> {
|
||||
let mut c_b = Row::new().height(bar_height);
|
||||
|
||||
if let Some(items) = maybe_items {
|
||||
for (bar_text, bar_fill, bar_color) in items {
|
||||
c_b = c_b.push(
|
||||
container(text(bar_text).color(Color::BLACK).size(iced::Pixels(14.0)))
|
||||
.height(Length::Fill)
|
||||
.width(Length::FillPortion(bar_fill))
|
||||
.style(move |_| container::background(bar_color))
|
||||
.align_x(Alignment::Center)
|
||||
.align_y(Alignment::Center),
|
||||
);
|
||||
}
|
||||
}
|
||||
c_b.into()
|
||||
}
|
||||
Reference in New Issue
Block a user