This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-demo/src/FlexDemo.ts

48 lines
1.6 KiB
TypeScript
Raw Normal View History

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";
import { colors } from "./utils";
2020-04-09 20:01:22 +08:00
@Entry
class LayoutDemo extends Panel {
build(root: Group) {
flexlayout(
[
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)
}
}