MCPcopy Create free account
hub / github.com/Autoparallel/learner / draw_dialog

Method draw_dialog

crates/learnerd/src/tui/ui.rs:604–623  ·  view source on GitHub ↗

Draws a centered dialog box with the given content. # Arguments `title` - Dialog title `content` - Vector of lines to display `color` - Color theme for the dialog

(&mut self, title: &str, content: &[Line], color: Color)

Source from the content-addressed store, hash-verified

602 /// * `content` - Vector of lines to display
603 /// * `color` - Color theme for the dialog
604 fn draw_dialog(&mut self, title: &str, content: &[Line], color: Color) {
605 let area = self.frame.area();
606 let dialog_box = create_dialog_box(title, content, area);
607
608 self.frame.render_widget(Clear, dialog_box);
609 self.frame.render_widget(
610 Block::default().borders(Borders::ALL).border_style(Style::default().fg(color)).title(
611 Span::styled(
612 title,
613 Style::default().fg(color).add_modifier(ratatui::style::Modifier::BOLD),
614 ),
615 ),
616 dialog_box,
617 );
618
619 self.frame.render_widget(
620 Paragraph::new(content.to_vec()).alignment(Alignment::Center),
621 dialog_box.inner(Margin { vertical: 1, horizontal: 2 }),
622 );
623 }
624}
625
626/// Creates a centered dialog box with appropriate dimensions.

Callers 5

draw_success_dialogMethod · 0.80
draw_exit_dialogMethod · 0.80

Calls 1

create_dialog_boxFunction · 0.85

Tested by

no test coverage detected