1use agui_core::{
2 context::WidgetContext,
3 layout::Layout,
4 unit::{LayoutType, Units},
5 widget::{BuildResult, WidgetBuilder, WidgetRef},
6 Ref,
7};
8use agui_macros::Widget;
9
10#[derive(Default, Widget)]
11pub struct Row {
12 pub layout: Ref<Layout>,
13
14 pub spacing: Units,
15
16 pub children: Vec<WidgetRef>,
17}
18
19impl WidgetBuilder for Row {
20 fn build(&self, ctx: &WidgetContext) -> BuildResult {
21 ctx.set_layout_type(
22 LayoutType::Row {
23 spacing: self.spacing,
24 }
25 .into(),
26 );
27
28 ctx.set_layout(Ref::clone(&self.layout));
29
30 (&self.children).into()
31 }
32}