47 lines
1015 B
TypeScript
47 lines
1015 B
TypeScript
import {
|
|
Panel,
|
|
Group,
|
|
vlayout,
|
|
layoutConfig,
|
|
Gravity,
|
|
text,
|
|
Color,
|
|
navbar,
|
|
modal,
|
|
AssetsResource,
|
|
image,
|
|
} from "doric";
|
|
import { demoPlugin } from "__$__";
|
|
|
|
@Entry
|
|
class Example extends Panel {
|
|
onShow() {
|
|
navbar(context).setTitle("Example");
|
|
}
|
|
build(rootView: Group) {
|
|
vlayout([
|
|
image({
|
|
image: new AssetsResource("logo_doric.png"),
|
|
}),
|
|
text({
|
|
text: "Click to call native plugin",
|
|
textSize: 20,
|
|
backgroundColor: Color.parse("#70a1ff"),
|
|
textColor: Color.WHITE,
|
|
onClick: async () => {
|
|
const result = await demoPlugin(this.context).call();
|
|
await modal(this.context).alert(result);
|
|
},
|
|
layoutConfig: layoutConfig().fit(),
|
|
padding: { left: 20, right: 20, top: 20, bottom: 20 },
|
|
}),
|
|
])
|
|
.apply({
|
|
layoutConfig: layoutConfig().fit().configAlignment(Gravity.Center),
|
|
space: 20,
|
|
gravity: Gravity.Center,
|
|
})
|
|
.in(rootView);
|
|
}
|
|
}
|