fix when parent is fit ,child is most,resolve this situation

This commit is contained in:
pengfei.zhou
2020-04-23 19:54:25 +08:00
committed by osborn
parent 496c4c1838
commit 05927b33d5
3 changed files with 213 additions and 4 deletions

View File

@@ -0,0 +1,73 @@
import { Panel, Group, vlayout, LayoutSpec, text, Color, gravity, stack, layoutConfig } from "doric";
@Entry
class LayoutTest extends Panel {
build(root: Group) {
vlayout(
[
text({
text: "Fit -> Most",
layoutConfig: {
widthSpec: LayoutSpec.MOST,
heightSpec: LayoutSpec.JUST,
},
textSize: 30,
textColor: Color.parse("#535c68"),
backgroundColor: Color.parse("#dff9fb"),
textAlignment: gravity().center(),
height: 50,
}),
stack(
[
stack(
[],
{
layoutConfig: layoutConfig().most(),
backgroundColor: Color.BLUE
}
),
text({
text: "This is a stack content",
textSize: 20,
textColor: Color.WHITE,
}),
],
{
layoutConfig: {
widthSpec: LayoutSpec.FIT,
heightSpec: LayoutSpec.FIT,
},
backgroundColor: Color.RED
}),
vlayout(
[
stack(
[],
{
layoutConfig: layoutConfig().most(),
backgroundColor: Color.BLUE
}
),
text({
text: "This is a stack content",
textSize: 20,
textColor: Color.WHITE,
}),
],
{
layoutConfig: {
widthSpec: LayoutSpec.FIT,
heightSpec: LayoutSpec.FIT,
},
backgroundColor: Color.RED
})
],
{
layoutConfig: {
widthSpec: LayoutSpec.MOST,
heightSpec: LayoutSpec.FIT,
},
space: 20,
}).in(root)
}
}