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

86 lines
2.8 KiB
TypeScript
Raw Normal View History

2021-03-01 18:59:09 +08:00
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, layoutConfig, stack, Gravity } from "doric";
@Entry
class LayoutDemo extends Panel {
build(rootView: Group) {
2021-03-01 20:22:32 +08:00
hlayout([
2021-03-01 20:26:41 +08:00
vlayout([
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.RED,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
}),
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.GREEN,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
}),
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.BLUE,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
})
], {
2021-03-01 18:59:09 +08:00
width: 100,
2021-03-01 20:26:41 +08:00
height: 300,
2021-03-15 15:56:35 +08:00
layoutConfig: layoutConfig().just()
2021-03-01 18:59:09 +08:00
}),
2021-03-01 20:26:41 +08:00
vlayout([
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.GREEN,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
}),
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.BLUE,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
}),
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.RED,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
})
], {
2021-03-01 18:59:09 +08:00
width: 100,
2021-03-01 20:26:41 +08:00
height: 300,
2021-03-15 15:56:35 +08:00
layoutConfig: layoutConfig().just()
2021-03-01 18:59:09 +08:00
}),
2021-03-01 20:26:41 +08:00
vlayout([
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.BLUE,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
}),
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.RED,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
}),
stack([], {
width: 100,
height: 100,
2021-03-15 15:56:35 +08:00
backgroundColor: Color.GREEN,
layoutConfig: layoutConfig().just()
2021-03-01 20:26:41 +08:00
})
], {
2021-03-01 18:59:09 +08:00
width: 100,
2021-03-01 20:26:41 +08:00
height: 300,
2021-03-15 15:56:35 +08:00
layoutConfig: layoutConfig().just()
2021-03-01 18:59:09 +08:00
})
], {
2021-03-02 10:13:16 +08:00
width: 400,
2021-03-01 18:59:09 +08:00
height: 300,
2021-03-15 15:56:35 +08:00
layoutConfig: layoutConfig().just(),
2021-03-01 18:59:09 +08:00
backgroundColor: Color.BLACK
}).in(rootView)
}
}