2020-04-23 19:54:25 +08:00
|
|
|
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,
|
|
|
|
}),
|
2021-05-07 18:11:54 +08:00
|
|
|
stack(
|
|
|
|
[
|
|
|
|
stack(
|
|
|
|
[
|
|
|
|
|
|
|
|
text({
|
|
|
|
text: "This is a stack content xxxxx",
|
|
|
|
textSize: 20,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
{
|
|
|
|
layoutConfig: layoutConfig().most(),
|
|
|
|
backgroundColor: Color.BLUE
|
|
|
|
}
|
|
|
|
),
|
|
|
|
stack(
|
|
|
|
[
|
|
|
|
|
|
|
|
text({
|
|
|
|
text: "This is a stack content 000000000",
|
|
|
|
textSize: 20,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
{
|
|
|
|
layoutConfig: layoutConfig().most(),
|
|
|
|
backgroundColor: Color.YELLOW,
|
|
|
|
alpha: 0.1
|
|
|
|
}
|
|
|
|
),
|
|
|
|
text({
|
|
|
|
text: "This is a stack content",
|
|
|
|
textSize: 20,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
{
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.FIT,
|
|
|
|
},
|
|
|
|
backgroundColor: Color.RED
|
|
|
|
}),
|
2020-04-23 19:54:25 +08:00
|
|
|
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({
|
2021-05-07 18:11:54 +08:00
|
|
|
text: "This is a vlayout content",
|
2020-04-23 19:54:25 +08:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|