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/SimpleDemo.ts
2021-05-20 18:27:45 +08:00

86 lines
2.8 KiB
TypeScript

import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, layoutConfig, stack, Gravity } from "doric";
@Entry
class LayoutDemo extends Panel {
build(rootView: Group) {
hlayout([
vlayout([
stack([], {
width: 100,
height: 100,
backgroundColor: Color.RED,
layoutConfig: layoutConfig().just()
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.GREEN,
layoutConfig: layoutConfig().just()
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.BLUE,
layoutConfig: layoutConfig().just()
})
], {
width: 100,
height: 300,
layoutConfig: layoutConfig().just()
}),
vlayout([
stack([], {
width: 100,
height: 100,
backgroundColor: Color.GREEN,
layoutConfig: layoutConfig().just()
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.BLUE,
layoutConfig: layoutConfig().just()
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.RED,
layoutConfig: layoutConfig().just()
})
], {
width: 100,
height: 300,
layoutConfig: layoutConfig().just()
}),
vlayout([
stack([], {
width: 100,
height: 100,
backgroundColor: Color.BLUE,
layoutConfig: layoutConfig().just()
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.RED,
layoutConfig: layoutConfig().just()
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.GREEN,
layoutConfig: layoutConfig().just()
})
], {
width: 100,
height: 300,
layoutConfig: layoutConfig().just()
})
], {
width: 400,
height: 300,
layoutConfig: layoutConfig().just(),
backgroundColor: Color.BLACK
}).in(rootView)
}
}