mirror of
https://github.com/ratatui/ratatui.git
synced 2025-10-02 07:21:24 +00:00
update block example; add BorderType to exposed widgets API
This commit is contained in:
parent
a72389b28c
commit
682349c03e
@ -9,7 +9,7 @@ use termion::screen::AlternateScreen;
|
|||||||
use tui::backend::TermionBackend;
|
use tui::backend::TermionBackend;
|
||||||
use tui::layout::{Constraint, Direction, Layout};
|
use tui::layout::{Constraint, Direction, Layout};
|
||||||
use tui::style::{Color, Modifier, Style};
|
use tui::style::{Color, Modifier, Style};
|
||||||
use tui::widgets::{Block, Borders, Widget};
|
use tui::widgets::{Block, BorderType, Borders, Widget};
|
||||||
use tui::Terminal;
|
use tui::Terminal;
|
||||||
|
|
||||||
use crate::util::event::{Event, Events};
|
use crate::util::event::{Event, Events};
|
||||||
@ -35,7 +35,7 @@ fn main() -> Result<(), failure::Error> {
|
|||||||
Block::default()
|
Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.title("Main block with round corners")
|
.title("Main block with round corners")
|
||||||
.rounded()
|
.set_border_type(BorderType::Rounded)
|
||||||
.render(&mut f, size);
|
.render(&mut f, size);
|
||||||
let chunks = Layout::default()
|
let chunks = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
@ -75,7 +75,7 @@ fn main() -> Result<(), failure::Error> {
|
|||||||
.title("With styled and double borders")
|
.title("With styled and double borders")
|
||||||
.border_style(Style::default().fg(Color::Cyan))
|
.border_style(Style::default().fg(Color::Cyan))
|
||||||
.borders(Borders::LEFT | Borders::RIGHT)
|
.borders(Borders::LEFT | Borders::RIGHT)
|
||||||
.double_border()
|
.set_border_type(BorderType::Double)
|
||||||
.render(&mut f, chunks[1]);
|
.render(&mut f, chunks[1]);
|
||||||
}
|
}
|
||||||
})?;
|
})?;
|
||||||
|
@ -15,6 +15,7 @@ mod tabs;
|
|||||||
|
|
||||||
pub use self::barchart::BarChart;
|
pub use self::barchart::BarChart;
|
||||||
pub use self::block::Block;
|
pub use self::block::Block;
|
||||||
|
pub use self::block::BorderType;
|
||||||
pub use self::chart::{Axis, Chart, Dataset, Marker};
|
pub use self::chart::{Axis, Chart, Dataset, Marker};
|
||||||
pub use self::gauge::Gauge;
|
pub use self::gauge::Gauge;
|
||||||
pub use self::list::{List, SelectableList};
|
pub use self::list::{List, SelectableList};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user