update block example; add BorderType to exposed widgets API

This commit is contained in:
Matthew Stevenson 2019-12-15 15:52:11 -08:00 committed by Florian Dehau
parent a72389b28c
commit 682349c03e
2 changed files with 4 additions and 3 deletions

View file

@ -9,7 +9,7 @@ use termion::screen::AlternateScreen;
use tui::backend::TermionBackend;
use tui::layout::{Constraint, Direction, Layout};
use tui::style::{Color, Modifier, Style};
use tui::widgets::{Block, Borders, Widget};
use tui::widgets::{Block, BorderType, Borders, Widget};
use tui::Terminal;
use crate::util::event::{Event, Events};
@ -35,7 +35,7 @@ fn main() -> Result<(), failure::Error> {
Block::default()
.borders(Borders::ALL)
.title("Main block with round corners")
.rounded()
.set_border_type(BorderType::Rounded)
.render(&mut f, size);
let chunks = Layout::default()
.direction(Direction::Vertical)
@ -75,7 +75,7 @@ fn main() -> Result<(), failure::Error> {
.title("With styled and double borders")
.border_style(Style::default().fg(Color::Cyan))
.borders(Borders::LEFT | Borders::RIGHT)
.double_border()
.set_border_type(BorderType::Double)
.render(&mut f, chunks[1]);
}
})?;

View file

@ -15,6 +15,7 @@ mod tabs;
pub use self::barchart::BarChart;
pub use self::block::Block;
pub use self::block::BorderType;
pub use self::chart::{Axis, Chart, Dataset, Marker};
pub use self::gauge::Gauge;
pub use self::list::{List, SelectableList};