vizia_core/views/
stack.rs
1use crate::prelude::*;
2
3pub struct VStack {}
7
8impl VStack {
9 pub fn new<F>(cx: &mut Context, content: F) -> Handle<Self>
11 where
12 F: FnOnce(&mut Context),
13 {
14 Self {}
15 .build(cx, |cx| {
16 (content)(cx);
17 })
18 .role(Role::GenericContainer)
19 }
20}
21
22impl View for VStack {
23 fn element(&self) -> Option<&'static str> {
24 Some("vstack")
25 }
26}
27
28pub struct HStack {}
30
31impl HStack {
32 pub fn new<F>(cx: &mut Context, content: F) -> Handle<Self>
34 where
35 F: FnOnce(&mut Context),
36 {
37 Self {}
38 .build(cx, |cx| {
39 (content)(cx);
40 })
41 .layout_type(LayoutType::Row)
42 .role(Role::GenericContainer)
43 }
44}
45
46impl View for HStack {
47 fn element(&self) -> Option<&'static str> {
48 Some("hstack")
49 }
50}
51
52pub struct ZStack {}
54
55impl ZStack {
56 pub fn new<F>(cx: &mut Context, content: F) -> Handle<Self>
58 where
59 F: FnOnce(&mut Context),
60 {
61 Self {}.build(cx, |cx| {
62 (content)(cx);
63 })
64 }
65}
66
67impl View for ZStack {
68 fn element(&self) -> Option<&'static str> {
69 Some("zstack")
70 }
71}