Function rat_widget::layout::layout_grid
source ยท pub fn layout_grid<const X: usize, const Y: usize>(
area: Rect,
horizontal: Layout,
vertical: Layout,
) -> [[Rect; Y]; X]Expand description
Calculates a full grid of rects from the horizontal and vertical components.
use ratatui::layout::{Constraint, Layout, Rect};
use rat_widget::layout::layout_grid;
let area = Rect::new(0,0,100,100);
let layout = layout_grid::<3, 5>(area,
Layout::horizontal([
Constraint::Length(5),
Constraint::Fill(1),
Constraint::Length(5)
]),
Layout::vertical([
Constraint::Length(1),
Constraint::Length(3),
Constraint::Fill(1),
Constraint::Length(3),
Constraint::Length(1),
])
);
// middle column, second block
let a_1_2 = layout[1][2];