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/StatusBarDemo.ts

83 lines
2.9 KiB
TypeScript
Raw Normal View History

import { Group, Panel, gravity, Color, LayoutSpec, vlayout, scroller, layoutConfig, statusbar, StatusBarMode } from "doric";
2020-01-14 10:59:42 +08:00
import { title, label, colors } from "./utils";
@Entry
class StatusBarDemo extends Panel {
build(rootView: Group): void {
scroller(vlayout([
title("StatusBar Demo"),
label('show').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just(),
onClick: () => {
statusbar(context).setHidden(false)
}
}),
2020-01-14 10:59:42 +08:00
label('hide').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just(),
onClick: () => {
statusbar(context).setHidden(true)
}
}),
2020-01-14 10:59:42 +08:00
label('light').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just().configMargin({ top: 30 }),
2020-01-14 10:59:42 +08:00
onClick: () => {
statusbar(context).setMode(StatusBarMode.LIGHT)
}
}),
2020-01-14 10:59:42 +08:00
label('dark').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just(),
onClick: () => {
statusbar(context).setMode(StatusBarMode.DARK)
}
}),
2020-01-14 10:59:42 +08:00
label('white').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just().configMargin({ top: 30 }),
2020-01-14 10:59:42 +08:00
onClick: () => {
statusbar(context).setColor(Color.parse("#ffffff"))
}
}),
2020-01-14 10:59:42 +08:00
label('black').apply({
width: 200,
height: 50,
backgroundColor: colors[0],
textSize: 30,
textColor: Color.WHITE,
layoutConfig: layoutConfig().just(),
onClick: () => {
statusbar(context).setColor(Color.parse("#000000"))
}
}),
2020-01-14 10:59:42 +08:00
]).apply({
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
gravity: gravity().center(),
space: 10,
})).apply({
2020-01-14 10:59:42 +08:00
layoutConfig: layoutConfig().most(),
}).in(rootView)
}
}