pub struct StackContainer { /* private fields */ }
👎Deprecated: Use tui-framework-experiment instead
Expand description
A container that stacks widgets in a given direction
§Examples
use ratatui::prelude::*;
use ratatui::widgets::*;
use ratatui_widgets::StackContainer;
let mut stack = StackContainer::horizontal();
stack.push(Box::new(Paragraph::new("Left")), Constraint::Fill(1));
stack.push(Box::new(Paragraph::new("Center")), Constraint::Fill(2));
stack.push(Box::new(Paragraph::new("Right")), Constraint::Fill(1));
// or
let stack = StackContainer::horizontal().with_widgets(vec![
(Box::new(Paragraph::new("Left")), Constraint::Fill(1)),
(Box::new(Paragraph::new("Center")), Constraint::Fill(2)),
(Box::new(Paragraph::new("Right")), Constraint::Fill(1)),
]);
Implementations§
Source§impl StackContainer
impl StackContainer
pub fn new(direction: Direction) -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn horizontal() -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn vertical() -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn with_margin(self, margin: u16) -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn with_spacing(self, spacing: u16) -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn with_flex(self, flex: Flex) -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn with_widget( self, widget: Box<dyn WidgetRef>, constraint: Constraint, ) -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn with_widgets( self, widgets: Vec<(Box<dyn WidgetRef>, Constraint)>, ) -> Self
👎Deprecated: Use tui-framework-experiment instead
pub fn push(&mut self, widget: Box<dyn WidgetRef>, constraint: Constraint)
👎Deprecated: Use tui-framework-experiment instead
pub fn remove(&mut self, index: usize)
👎Deprecated: Use tui-framework-experiment instead
Trait Implementations§
Source§impl Debug for StackContainer
impl Debug for StackContainer
Source§impl Default for StackContainer
impl Default for StackContainer
Source§fn default() -> StackContainer
fn default() -> StackContainer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StackContainer
impl !RefUnwindSafe for StackContainer
impl !Send for StackContainer
impl !Sync for StackContainer
impl Unpin for StackContainer
impl !UnwindSafe for StackContainer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more