2020-04-09 20:01:22 +08:00
|
|
|
|
2020-04-11 11:02:51 +08:00
|
|
|
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout, flexScroller } from "doric";
|
2020-04-10 20:41:43 +08:00
|
|
|
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue, OverFlow } from "doric/lib/src/util/flexbox";
|
2020-04-10 16:14:27 +08:00
|
|
|
import { colors } from "./utils";
|
2020-04-09 20:01:22 +08:00
|
|
|
|
|
|
|
@Entry
|
|
|
|
class LayoutDemo extends Panel {
|
|
|
|
build(root: Group) {
|
2020-04-10 20:41:43 +08:00
|
|
|
stack(
|
2020-04-09 20:01:22 +08:00
|
|
|
[
|
2020-04-10 20:41:43 +08:00
|
|
|
scroller(
|
|
|
|
flexlayout(
|
|
|
|
[
|
|
|
|
stack([],
|
|
|
|
{
|
|
|
|
backgroundColor: colors[1],
|
|
|
|
flexConfig: {
|
2020-04-11 12:20:43 +08:00
|
|
|
width: 500,
|
2020-04-10 20:41:43 +08:00
|
|
|
height: 100,
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
stack([],
|
|
|
|
{
|
|
|
|
backgroundColor: colors[2],
|
|
|
|
flexConfig: {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
{
|
|
|
|
flexConfig: {
|
|
|
|
flexDirection: FlexDirection.COLUMN,
|
|
|
|
},
|
2020-04-11 12:20:43 +08:00
|
|
|
backgroundColor: colors[4].alpha(0.1)
|
2020-04-10 20:41:43 +08:00
|
|
|
}),
|
|
|
|
{
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
2020-04-11 12:20:43 +08:00
|
|
|
heightSpec: LayoutSpec.FIT,
|
2020-04-11 12:56:05 +08:00
|
|
|
minHeight: 200,
|
|
|
|
maxHeight: 400,
|
2020-04-10 20:41:43 +08:00
|
|
|
},
|
2020-04-11 12:20:43 +08:00
|
|
|
backgroundColor: colors[0].alpha(0.3),
|
2020-04-10 20:41:43 +08:00
|
|
|
})
|
2020-04-09 20:01:22 +08:00
|
|
|
],
|
|
|
|
{
|
2020-04-11 12:20:43 +08:00
|
|
|
layoutConfig: layoutConfig().fit(),
|
2020-04-09 20:01:22 +08:00
|
|
|
}
|
2020-04-11 12:20:43 +08:00
|
|
|
).in(root)
|
|
|
|
// flexScroller(
|
|
|
|
// [
|
|
|
|
// stack([],
|
|
|
|
// {
|
|
|
|
// backgroundColor: colors[1],
|
|
|
|
// flexConfig: {
|
|
|
|
// width: 500,
|
|
|
|
// height: 100,
|
|
|
|
// }
|
|
|
|
// }),
|
|
|
|
// stack([],
|
|
|
|
// {
|
|
|
|
// backgroundColor: colors[2],
|
|
|
|
// flexConfig: {
|
|
|
|
// width: 100,
|
|
|
|
// height: 300,
|
|
|
|
// }
|
|
|
|
// }),
|
|
|
|
// stack([],
|
|
|
|
// {
|
|
|
|
// backgroundColor: colors[3],
|
|
|
|
// flexConfig: {
|
|
|
|
// width: 100,
|
|
|
|
// height: 100,
|
|
|
|
// }
|
|
|
|
// }),
|
|
|
|
// ],
|
|
|
|
// {
|
|
|
|
// backgroundColor: Color.GRAY.alpha(0.3),
|
|
|
|
// layoutConfig: layoutConfig().fit(),
|
|
|
|
// flexConfig: {
|
|
|
|
// maxWidth: 300,
|
|
|
|
// maxHeight: 300,
|
|
|
|
// },
|
|
|
|
// })//.in(root)
|
2020-04-09 20:01:22 +08:00
|
|
|
}
|
|
|
|
}
|