~tm85/lintuini

ref: a247719c2c965a261e1571fbe45cff8d2ab6175c lintuini/examples/empty_container.rs -rw-r--r-- 859 bytes
a247719cTerraMaster85 feat: rapid development 28 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
extern crate lintuini;
use lintuini::elements::Element;
use lintuini::elements::Container;

use ratatui::style::{Color, Style};
use ratatui::widgets::BorderType;

use crossterm::event;

fn main() -> std::io::Result<()> {
    let fill = Style::default().bg(Color::Blue);
    let bord_style = Style::default().bg(Color::Green).fg(Color::Black);
    let bord_type = BorderType::Double;
    let cont = lintuini::elements::ContainerBuilder::new()
        .fill(fill)
        .border_style(bord_style)
        .border_type(bord_type)
        .build();

    ratatui::run(|mut terminal| {
        loop {
            terminal.draw(|mut frame| {
                let area = frame.area();
                cont.render(&mut frame, area).unwrap()
            })?;
            if event::read()?.is_key_press() {
                break Ok(());
            }
        }
    })
}