Display for Clock<T>

This commit is contained in:
jk
2024-12-04 15:28:06 +01:00
parent 6e6217bd21
commit b5f9147b45
3 changed files with 26 additions and 9 deletions

View File

@@ -45,7 +45,7 @@ impl StatefulWidget for &CountdownWidget {
type State = Countdown;
fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
let h = Paragraph::new(state.headline.clone()).centered();
let c = Paragraph::new(state.clock.format()).centered();
let c = Paragraph::new(format!("{}", state.clock)).centered();
let [v1, v2] = Layout::vertical([Constraint::Length(1), Constraint::Length(1)]).areas(area);
h.render(v1, buf);

View File

@@ -45,7 +45,7 @@ impl StatefulWidget for TimerWidget {
type State = Timer;
fn render(self, area: Rect, buf: &mut Buffer, state: &mut Self::State) {
let h = Paragraph::new(state.headline.clone()).centered();
let c = Paragraph::new(state.clock.format()).centered();
let c = Paragraph::new(format!("{}", state.clock)).centered();
let [v1, v2] = Layout::vertical([Constraint::Length(1), Constraint::Length(1)]).areas(area);
h.render(v1, buf);