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

73 lines
2.1 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,
backgroundColor: Color.RED
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.GREEN
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.BLUE
})
], {
2021-03-01 18:59:09 +08:00
width: 100,
2021-03-01 20:26:41 +08:00
height: 300,
2021-03-01 18:59:09 +08:00
}),
2021-03-01 20:26:41 +08:00
vlayout([
stack([], {
width: 100,
height: 100,
backgroundColor: Color.GREEN
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.BLUE
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.RED
})
], {
2021-03-01 18:59:09 +08:00
width: 100,
2021-03-01 20:26:41 +08:00
height: 300,
2021-03-01 18:59:09 +08:00
}),
2021-03-01 20:26:41 +08:00
vlayout([
stack([], {
width: 100,
height: 100,
backgroundColor: Color.BLUE
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.RED
}),
stack([], {
width: 100,
height: 100,
backgroundColor: Color.GREEN
})
], {
2021-03-01 18:59:09 +08:00
width: 100,
2021-03-01 20:26:41 +08:00
height: 300,
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,
backgroundColor: Color.BLACK
}).in(rootView)
}
}