2021-03-01 18:59:09 +08:00
|
|
|
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, layoutConfig, stack, Gravity } from "doric";
|
|
|
|
|
|
|
|
@Entry
|
|
|
|
class LayoutDemo extends Panel {
|
|
|
|
build(rootView: Group) {
|
2021-03-01 20:22:32 +08:00
|
|
|
hlayout([
|
2021-03-01 20:26:41 +08:00
|
|
|
vlayout([
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.RED,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.GREEN,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.BLUE,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
})
|
|
|
|
], {
|
2021-03-01 18:59:09 +08:00
|
|
|
width: 100,
|
2021-03-01 20:26:41 +08:00
|
|
|
height: 300,
|
2021-03-15 15:56:35 +08:00
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 18:59:09 +08:00
|
|
|
}),
|
2021-03-01 20:26:41 +08:00
|
|
|
vlayout([
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.GREEN,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.BLUE,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.RED,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
})
|
|
|
|
], {
|
2021-03-01 18:59:09 +08:00
|
|
|
width: 100,
|
2021-03-01 20:26:41 +08:00
|
|
|
height: 300,
|
2021-03-15 15:56:35 +08:00
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 18:59:09 +08:00
|
|
|
}),
|
2021-03-01 20:26:41 +08:00
|
|
|
vlayout([
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.BLUE,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.RED,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
2021-03-15 15:56:35 +08:00
|
|
|
backgroundColor: Color.GREEN,
|
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 20:26:41 +08:00
|
|
|
})
|
|
|
|
], {
|
2021-03-01 18:59:09 +08:00
|
|
|
width: 100,
|
2021-03-01 20:26:41 +08:00
|
|
|
height: 300,
|
2021-03-15 15:56:35 +08:00
|
|
|
layoutConfig: layoutConfig().just()
|
2021-03-01 18:59:09 +08:00
|
|
|
})
|
|
|
|
], {
|
2021-03-02 10:13:16 +08:00
|
|
|
width: 400,
|
2021-03-01 18:59:09 +08:00
|
|
|
height: 300,
|
2021-03-15 15:56:35 +08:00
|
|
|
layoutConfig: layoutConfig().just(),
|
2021-03-01 18:59:09 +08:00
|
|
|
backgroundColor: Color.BLACK
|
|
|
|
}).in(rootView)
|
|
|
|
}
|
|
|
|
}
|