rat_widget/layout/layout_middle.rs
1use ratatui::layout::{Constraint, Layout, Rect};
2
3/// Calculate the middle Rect inside a given area.
4pub fn layout_middle(
5 area: Rect,
6 left: Constraint,
7 right: Constraint,
8 top: Constraint,
9 bottom: Constraint,
10) -> Rect {
11 let h_layout = Layout::horizontal([
12 left, //
13 Constraint::Fill(1),
14 right,
15 ])
16 .split(area);
17 let v_layout = Layout::vertical([
18 top, //
19 Constraint::Fill(1),
20 bottom,
21 ])
22 .split(h_layout[1]);
23 v_layout[1]
24}