feat: modular add test case
This commit is contained in:
@@ -27,12 +27,12 @@ class CounterView extends ViewHolder {
|
||||
build(root: Group) {
|
||||
vlayout(
|
||||
[
|
||||
text({
|
||||
this.number = text({
|
||||
textSize: 40,
|
||||
tag: "tvNumber",
|
||||
}),
|
||||
|
||||
text({
|
||||
this.counter = text({
|
||||
text: "Click To Count 1",
|
||||
textSize: 20,
|
||||
tag: "tvCounter",
|
||||
@@ -44,8 +44,6 @@ class CounterView extends ViewHolder {
|
||||
space: 20,
|
||||
}
|
||||
).in(root);
|
||||
this.number = root.findViewByTag("tvNumber")!;
|
||||
this.counter = root.findViewByTag("tvCounter")!;
|
||||
}
|
||||
}
|
||||
|
||||
|
81
doric-demo/src/ModularDemo.ts
Normal file
81
doric-demo/src/ModularDemo.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { Color, Gravity, Group, layoutConfig, LayoutSpec, ModularPanel, Panel, scroller, text, vlayout } from "doric";
|
||||
import { CounterPage } from "./Counter";
|
||||
|
||||
class Module1 extends Panel {
|
||||
build(root: Group) {
|
||||
vlayout(
|
||||
[
|
||||
text({
|
||||
text: "First Module",
|
||||
textColor: Color.WHITE,
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.MOST,
|
||||
heightSpec: LayoutSpec.FIT
|
||||
},
|
||||
padding: {
|
||||
top: 20,
|
||||
bottom: 20
|
||||
},
|
||||
gravity: Gravity.Center,
|
||||
backgroundColor: Color.parse("#3498db")
|
||||
}
|
||||
).in(root)
|
||||
}
|
||||
}
|
||||
|
||||
class Module2 extends Panel {
|
||||
build(root: Group) {
|
||||
vlayout(
|
||||
[
|
||||
text({
|
||||
text: "Second Module",
|
||||
textColor: Color.WHITE,
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.MOST,
|
||||
heightSpec: LayoutSpec.FIT
|
||||
},
|
||||
padding: {
|
||||
top: 20,
|
||||
bottom: 20
|
||||
},
|
||||
gravity: Gravity.Center,
|
||||
backgroundColor: Color.parse("#f39c12")
|
||||
}
|
||||
).in(root)
|
||||
}
|
||||
}
|
||||
|
||||
@Entry
|
||||
class ModularDemo extends ModularPanel {
|
||||
setupModules() {
|
||||
return [
|
||||
Module1,
|
||||
Module2,
|
||||
CounterPage,
|
||||
]
|
||||
}
|
||||
setupShelf(root: Group) {
|
||||
const shelf = vlayout(
|
||||
[],
|
||||
{
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.MOST,
|
||||
heightSpec: LayoutSpec.FIT
|
||||
}
|
||||
}
|
||||
)
|
||||
scroller(
|
||||
shelf,
|
||||
{
|
||||
layoutConfig: layoutConfig().most()
|
||||
}).in(root)
|
||||
return shelf
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user