forked from joejulian/gio
layout: make Flexed weight a weight, not a ratio
It's more intuitive to specify the weight as a ratio of the total weight of all Flexed children than to specify the ratio of the flexable space. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -69,10 +69,13 @@ func ExampleFlex() {
|
||||
return layoutWidget(gtx, 10, 10)
|
||||
}),
|
||||
// Child with 50% space allowance.
|
||||
layout.Flexed(0.5, func(gtx layout.Context) layout.Dimensions {
|
||||
layout.Flexed(1, func(gtx layout.Context) layout.Dimensions {
|
||||
fmt.Printf("50%%: %v\n", gtx.Constraints)
|
||||
return layoutWidget(gtx, 10, 10)
|
||||
}),
|
||||
layout.Flexed(1, func(gtx layout.Context) layout.Dimensions {
|
||||
return layout.Dimensions{}
|
||||
}),
|
||||
)
|
||||
|
||||
// Output:
|
||||
|
||||
Reference in New Issue
Block a user