Add WidgetExt and AsyncWidgetExt traits
This commit is contained in:
parent
dbafc40700
commit
bcc07dc9ba
2 changed files with 30 additions and 4 deletions
|
|
@ -2,18 +2,19 @@ use std::convert::Infallible;
|
|||
|
||||
use crossterm::event::Event;
|
||||
use crossterm::style::{ContentStyle, Stylize};
|
||||
use toss::widgets::{Border, BorderLook, Text};
|
||||
use toss::{Styled, Terminal, Widget};
|
||||
use toss::widgets::{BorderLook, Text};
|
||||
use toss::{Styled, Terminal, Widget, WidgetExt};
|
||||
|
||||
fn widget() -> impl Widget<Infallible> {
|
||||
Border::new(Text::new(
|
||||
Text::new(
|
||||
Styled::new("Hello world!", ContentStyle::default().green())
|
||||
.then_plain("\n")
|
||||
.then(
|
||||
"Press any key to exit",
|
||||
ContentStyle::default().on_dark_blue(),
|
||||
),
|
||||
))
|
||||
)
|
||||
.border()
|
||||
.look(BorderLook::LINE_DOUBLE)
|
||||
.style(ContentStyle::default().dark_red())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue