add timer demo

This commit is contained in:
pengfei.zhou 2021-09-13 13:30:22 +08:00 committed by osborn
parent f16648c3d1
commit 3d3f646845

View File

@ -9,12 +9,19 @@ import {
Text, Text,
createRef, createRef,
Color, Color,
loge, statusbar,
navbar,
} from "doric"; } from "doric";
@Entry @Entry
class Counter extends Panel { class Timer extends Panel {
onShow() {
navbar(this.context).setHidden(true);
statusbar(this.context).setHidden(true);
}
build(root: Group) { build(root: Group) {
statusbar(this.context).setHidden(true);
root.backgroundColor = Color.BLACK; root.backgroundColor = Color.BLACK;
const hour1Ref = createRef<Text>(); const hour1Ref = createRef<Text>();
const hour2Ref = createRef<Text>(); const hour2Ref = createRef<Text>();
@ -36,7 +43,6 @@ class Counter extends Panel {
textSize={40} textSize={40}
ref={hour1Ref} ref={hour1Ref}
textColor={Color.WHITE} textColor={Color.WHITE}
border={{ width: 1, color: Color.BLUE }}
padding={{ left: 10, right: 10, top: 10, bottom: 10 }} padding={{ left: 10, right: 10, top: 10, bottom: 10 }}
> >
0 0
@ -45,7 +51,6 @@ class Counter extends Panel {
textSize={40} textSize={40}
ref={hour2Ref} ref={hour2Ref}
textColor={Color.WHITE} textColor={Color.WHITE}
border={{ width: 1, color: Color.BLUE }}
padding={{ left: 10, right: 10, top: 10, bottom: 10 }} padding={{ left: 10, right: 10, top: 10, bottom: 10 }}
> >
0 0
@ -62,7 +67,6 @@ class Counter extends Panel {
textSize={40} textSize={40}
ref={min1Ref} ref={min1Ref}
textColor={Color.WHITE} textColor={Color.WHITE}
border={{ width: 1, color: Color.BLUE }}
padding={{ left: 10, right: 10, top: 10, bottom: 10 }} padding={{ left: 10, right: 10, top: 10, bottom: 10 }}
> >
0 0
@ -71,7 +75,6 @@ class Counter extends Panel {
textSize={40} textSize={40}
ref={min2Ref} ref={min2Ref}
textColor={Color.WHITE} textColor={Color.WHITE}
border={{ width: 1, color: Color.BLUE }}
padding={{ left: 10, right: 10, top: 10, bottom: 10 }} padding={{ left: 10, right: 10, top: 10, bottom: 10 }}
> >
0 0
@ -88,7 +91,6 @@ class Counter extends Panel {
textSize={40} textSize={40}
ref={sec1Ref} ref={sec1Ref}
textColor={Color.WHITE} textColor={Color.WHITE}
border={{ width: 1, color: Color.BLUE }}
padding={{ left: 10, right: 10, top: 10, bottom: 10 }} padding={{ left: 10, right: 10, top: 10, bottom: 10 }}
> >
0 0
@ -97,7 +99,6 @@ class Counter extends Panel {
textSize={40} textSize={40}
ref={sec2Ref} ref={sec2Ref}
textColor={Color.WHITE} textColor={Color.WHITE}
border={{ width: 1, color: Color.BLUE }}
padding={{ left: 10, right: 10, top: 10, bottom: 10 }} padding={{ left: 10, right: 10, top: 10, bottom: 10 }}
> >
0 0
@ -118,7 +119,6 @@ class Counter extends Panel {
sec2Ref, sec2Ref,
].forEach((e) => { ].forEach((e) => {
e.current.apply({ e.current.apply({
border: undefined,
textSize: width / 10, textSize: width / 10,
}); });
}); });