From fd94f1dfa6272585d8eb5c4623a0668018d29fe3 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 11 Aug 2025 05:57:33 -0500 Subject: [PATCH] basic text --- src/ui/presenter.rs | 103 +++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/src/ui/presenter.rs b/src/ui/presenter.rs index 73a359f..a1a8c73 100644 --- a/src/ui/presenter.rs +++ b/src/ui/presenter.rs @@ -561,74 +561,66 @@ pub(crate) fn slide_view( // text widget based let lines = slide_text.lines(); - let chars = lines - .map(|t| t.chars().map(|c| format!("{}\n", c))) - .collect(); - let mut spans = vec![]; - for c in chars { - spans.push( - span(format!("{}\n", c)) - .size(font_size) - .font(font) + let text: Vec> = lines + .map(|t| { + rich_text([span(format!("{}\n", t)) .background( Background::Color(Color::BLACK) .scale_alpha(0.4), ) .border(border::rounded(10)) - .padding(10), - ) - } - let text: Vec> = lines - .map(|t| { - let chars = t - .chars() - .map(|c| { - span(format!("{}\n", c)) - .size(font_size) - .font(font) - .background( - Background::Color(Color::BLACK) - .scale_alpha(0.4), - ) - .border(border::rounded(10)) - .padding(10) - }) - .collect(); - rich_text(chars).center().into() + .padding(10)]) + .size(font_size) + .font(font) + .center() + .into() + // let chars: Vec = t + // .chars() + // .map(|c| -> Span { + // let character: String = format!("{}/n", c); + // span(character) + // .size(font_size) + // .font(font) + // .background( + // Background::Color(Color::BLACK) + // .scale_alpha(0.4), + // ) + // .border(border::rounded(10)) + // .padding(10) }) .collect(); let text = Column::with_children(text).spacing(26); - let lines = slide_text.lines(); - let stroke_text: Vec> = lines - .map(|t| { - let mut stroke_font = font.clone(); - stroke_font.stretch = Stretch::Condensed; - stroke_font.weight = Weight::Bold; - rich_text([span(format!("{}\n", t)) - .size(font_size + 0.3) - .font(stroke_font) - .color(Color::BLACK) - .border(border::rounded(10)) - .padding(10)]) - .center() - .into() - }) - .collect(); - let stroke_text = - Column::with_children(stroke_text).spacing(26); + // let lines = slide_text.lines(); + // let stroke_text: Vec> = lines + // .map(|t| { + // let mut stroke_font = font.clone(); + // stroke_font.stretch = Stretch::Condensed; + // stroke_font.weight = Weight::Bold; + // rich_text([span(format!("{}\n", t)) + // .size(font_size + 0.3) + // .font(stroke_font) + // .color(Color::BLACK) + // .border(border::rounded(10)) + // .padding(10)]) + // .center() + // .into() + // }) + // .collect(); + // let stroke_text = + // Column::with_children(stroke_text).spacing(26); //Next let text_container = Container::new(text) .center(Length::Fill) .align_x(Horizontal::Left); - let stroke_text_container = Container::new(stroke_text) - .center(Length::Fill) - .align_x(Horizontal::Left); + // let stroke_text_container = Container::new(stroke_text) + // .center(Length::Fill) + // .align_x(Horizontal::Left); - let text_stack = - stack!(stroke_text_container, text_container); + // let text_stack = + // stack!(stroke_text_container, text_container); let black = Container::new(Space::new(0, 0)) .style(|_| { container::background(Background::Color(Color::BLACK)) @@ -685,8 +677,11 @@ pub(crate) fn slide_view( } } }; - let stack = - stack!(black, container.center(Length::Fill), text_stack); + let stack = stack!( + black, + container.center(Length::Fill), + text_container + ); Container::new(stack).center(Length::Fill).into() }) .into()