1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use Deref;
/// Control how much each child of a stack component grows.
///
/// For example:
/// ```rust
/// # use intuitive::{component, components::{Section, VStack}, render};
/// #
/// #[component(Root)]
/// fn render() {
/// render! {
/// VStack(flex: [1, 2, 3]) {
/// Section(title: "small")
/// Section(title: "medium")
/// Section(title: "large")
/// }
/// }
/// }
/// ```
/// will render a vertical stack of three [`Section`] components. The bottom one
/// will be 3 times the height of the top one, and the middle one will be 2 times the height
/// of the top one, as shown in the [`VStack`] docs.
///
/// When using the `flex` parameter to [`VStack`] and [`HStack`], providing a value
/// of type `[u16; N]`, will assume that [`Flex::Grow`] is intended, therefore making
/// all dimensions relative. In order to have absolute height or width for a child, provide a
/// value of type `[Flex; N]` to the `flex` parameter. For example,
/// ```rust
/// # use intuitive::{component, components::{Section, VStack, stack::Flex::*}, render};
/// #
/// #[component(Root)]
/// fn render() {
/// render! {
/// VStack(flex: [Block(3), Grow(1), Block(3)]) {
/// Section(title: "absolute")
/// Section(title: "relative")
/// Section(title: "absolute")
/// }
/// }
/// }
/// ```
///
/// [`HStack`]: ../struct.HStack.html
/// [`Section`]: ../struct.Section.html
/// [`VStack`]: ../struct.VStack.html
/// [`Flex::Grow`]: #variant.Grow
/// An array of [`Flex`] values.
///
/// This struct exists in order to implement `From<[Flex; N]>` and
/// `From<[u16; N]>`.
///
/// [`Flex`]: enum.Flex.html