2020-04-09 20:01:22 +08:00
|
|
|
|
|
|
|
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout } from "doric";
|
2020-04-10 10:15:13 +08:00
|
|
|
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue } 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) {
|
|
|
|
flexlayout(
|
|
|
|
[
|
2020-04-10 16:14:27 +08:00
|
|
|
stack([], {
|
|
|
|
flexConfig: {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
|
|
|
},
|
|
|
|
backgroundColor: colors[0]
|
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
flexConfig: {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
|
|
|
},
|
|
|
|
backgroundColor: colors[1],
|
|
|
|
}),
|
|
|
|
stack([], {
|
|
|
|
flexConfig: {
|
|
|
|
width: 100,
|
|
|
|
height: 100,
|
|
|
|
},
|
|
|
|
backgroundColor: colors[2],
|
|
|
|
}),
|
2020-04-09 20:01:22 +08:00
|
|
|
],
|
|
|
|
{
|
2020-04-10 10:15:13 +08:00
|
|
|
layoutConfig: layoutConfig().fit(),
|
2020-04-09 20:01:22 +08:00
|
|
|
backgroundColor: Color.GRAY,
|
|
|
|
flexConfig: {
|
2020-04-10 10:15:13 +08:00
|
|
|
flexDirection: FlexDirection.COLUMN,
|
|
|
|
justifyContent: Justify.SPACE_EVENLY,
|
2020-04-09 20:01:22 +08:00
|
|
|
alignContent: Align.CENTER,
|
|
|
|
flexWrap: Wrap.WRAP,
|
2020-04-10 10:15:13 +08:00
|
|
|
width: FlexTypedValue.Auto,
|
|
|
|
height: FlexTypedValue.Auto,
|
2020-04-09 20:01:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
.in(root)
|
|
|
|
}
|
|
|
|
}
|