taskwarrior-tui/src/ui.rs
Dheepak Krishnamurthy 594d982bc9 fix: cargo fmt 🐛
2023-05-30 11:47:41 -04:00

37 lines
970 B
Rust

use tui::{
backend::Backend,
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
symbols,
text::{Line, Span},
widgets::{Block, BorderType, Borders, Cell, LineGauge, Paragraph, Row, Table},
Frame,
};
use crate::app::TaskwarriorTui;
pub fn draw<B>(rect: &mut Frame<B>, app: &TaskwarriorTui)
where
B: Backend,
{
let size = rect.size();
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([Constraint::Length(3), Constraint::Min(10), Constraint::Length(3)].as_ref())
.split(size);
let title = draw_title();
rect.render_widget(title, chunks[0]);
}
fn draw_title<'a>() -> Paragraph<'a> {
Paragraph::new("Taskwarrior TUI")
.style(Style::default().fg(Color::LightCyan))
.alignment(Alignment::Center)
.block(
Block::default()
.borders(Borders::ALL)
.style(Style::default().fg(Color::White))
.border_type(BorderType::Plain),
)
}