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

60 lines
2.3 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 20:41:43 +08:00
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue, OverFlow } 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) {
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: {
width: 300,
height: 100,
}
}),
stack([],
{
backgroundColor: colors[2],
flexConfig: {
width: 100,
height: 100,
}
}),
stack([],
{
backgroundColor: colors[3],
flexConfig: {
width: 100,
height: 100,
}
}),
],
{
flexConfig: {
flexDirection: FlexDirection.COLUMN,
},
backgroundColor: colors[4]
}),
{
layoutConfig: {
widthSpec: LayoutSpec.FIT,
heightSpec: LayoutSpec.FIT
},
backgroundColor: colors[0],
})
2020-04-09 20:01:22 +08:00
],
{
2020-04-10 20:41:43 +08:00
layoutConfig: layoutConfig().just(),
width: 250,
height: 250,
2020-04-09 20:01:22 +08:00
}
2020-04-10 20:41:43 +08:00
).in(root)
2020-04-09 20:01:22 +08:00
}
}