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

47 lines
1.8 KiB
TypeScript
Raw Normal View History

import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, layoutConfig } from "doric";
import { colors } from "./utils";
2021-03-01 18:59:09 +08:00
@Entry
class LayoutDemo extends Panel {
build(rootView: Group) {
scroller(
vlayout(
[
text({
text: "五子棋",
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
textSize: 30,
textColor: Color.WHITE,
backgroundColor: colors[0],
textAlignment: gravity().center(),
height: 50,
}),
hlayout(
[
text({
text: "当前:",
textSize: 20,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just().configWeight(1),
height: 50,
backgroundColor: colors[1],
}),
text({
text: "获胜方:",
textSize: 20,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just().configWeight(1),
height: 50,
backgroundColor: colors[2],
}),
],
{
layoutConfig: layoutConfig().fit().configWidth(LayoutSpec.MOST),
}),
2021-03-01 20:26:41 +08:00
], {
layoutConfig: layoutConfig().most(),
backgroundColor: Color.parse('#ecf0f1'),
2021-03-01 18:59:09 +08:00
})
).in(rootView)
2021-03-01 18:59:09 +08:00
}
}