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