a better looking rich_text system

This commit is contained in:
Chris Cochrun 2025-01-14 11:39:26 -06:00
parent bbaa35cb46
commit 201e9dc925

View file

@ -496,34 +496,24 @@ impl Presenter {
let lines = slide_text.lines(); let lines = slide_text.lines();
// let line_size = lines.clone().count(); // let line_size = lines.clone().count();
// debug!(?lines); // debug!(?lines);
let text: Vec<Span<Message>> = lines let text: Vec<Element<Message>> = lines
.map(|t| { .map(|t| {
span(format!("{}\n", t.to_string())) rich_text([span(format!("{}\n", t.to_string()))
.background( .background(
Background::Color(Color::BLACK) Background::Color(Color::BLACK)
.scale_alpha(0.3), .scale_alpha(0.4),
) )
.padding(3) .padding(3)])
.size(font_size)
.font(font)
.center()
.into()
}) })
.collect(); .collect();
let text_container = let text = Column::with_children(text).spacing(6);
rich_text(text).size(font_size).font(font).center(); let text_container = Container::new(text)
// let text = text(slide.text()) .center(Length::Fill)
// .size(font_size) .align_x(Horizontal::Left);
// .font(font)
// .align_x(Horizontal::Center);
// let text_background = Container::new(Space::new(0, 0))
// .style(|_| {
// container::background(
// Background::Color(Color::BLACK)
// .scale_alpha(0.3),
// )
// })
// .width(size.width)
// .height(
// font_size * line_size as f32 * line_size as f32,
// );
// let text_stack = stack!(text_background, text);
let black = Container::new(Space::new(0, 0)) let black = Container::new(Space::new(0, 0))
.style(|_| { .style(|_| {
container::background(Background::Color( container::background(Background::Color(