-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolumn.v
34 lines (32 loc) · 1001 Bytes
/
column.v
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
// Copyright (c) 2020-2021 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by a GPL license
// that can be found in the LICENSE file.
module ui
pub struct ColumnConfig {
width int // To remove soon
height int // To remove soon
alignment HorizontalAlignment
spacing Spacing = Spacing(0) // int
stretch bool
margin MarginConfig
// children related
widths Size //[]f64 // children sizes
heights Size //[]f64
alignments HorizontalAlignments
align Alignments
}
pub fn column(c ColumnConfig, children []Widget) &Stack {
return stack({
height: c.height
width: c.width
horizontal_alignment: c.alignment
spacing: c.spacing.as_int_array(children.len - 1)
stretch: c.stretch
direction: .column
margin: c.margin.as_margin()
heights: c.heights.as_f32_array(children.len) //.map(f32(it))
widths: c.widths.as_f32_array(children.len) //.map(f32(it))
horizontal_alignments: c.alignments
align: c.align
}, children)
}