2019-12-04 14:07:14 +08:00
|
|
|
import { Group, Panel, popover, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, Text, scroller, layoutConfig, image, IView, IVLayout, ScaleType, modal, IText, network } from "doric";
|
|
|
|
import { title, label, colors } from "./utils";
|
|
|
|
|
|
|
|
@Entry
|
|
|
|
class PopoverDemo extends Panel {
|
|
|
|
build(rootView: Group): void {
|
|
|
|
scroller(vlayout([
|
|
|
|
title("Popover Demo"),
|
|
|
|
label('Popover').apply({
|
|
|
|
width: 200,
|
|
|
|
height: 50,
|
|
|
|
backgroundColor: colors[0],
|
|
|
|
textSize: 30,
|
|
|
|
textColor: Color.WHITE,
|
2019-12-14 16:32:04 +08:00
|
|
|
layoutConfig: layoutConfig().just(),
|
2019-12-04 14:07:14 +08:00
|
|
|
onClick: () => {
|
|
|
|
popover(context).show(text({
|
|
|
|
width: 200,
|
|
|
|
height: 50,
|
|
|
|
backgroundColor: colors[0],
|
|
|
|
textColor: Color.WHITE,
|
2019-12-14 16:32:04 +08:00
|
|
|
layoutConfig: layoutConfig().just().configAligmnet(Gravity.Center),
|
2019-12-04 14:07:14 +08:00
|
|
|
text: "This is PopOver Window",
|
|
|
|
}).also(v => {
|
|
|
|
let idx = 0
|
|
|
|
v.onClick = () => {
|
|
|
|
v.backgroundColor = colors[(++idx) % colors.length]
|
|
|
|
}
|
|
|
|
modal(context).toast('Dismissed after 3 seconds')
|
|
|
|
setTimeout(() => {
|
|
|
|
popover(context).dismiss()
|
|
|
|
}, 3000)
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
} as IText),
|
|
|
|
]).apply({
|
2019-12-14 16:32:04 +08:00
|
|
|
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT),
|
2019-12-04 14:07:14 +08:00
|
|
|
gravity: gravity().center(),
|
|
|
|
space: 10,
|
|
|
|
} as IVLayout)).apply({
|
2019-12-14 16:32:04 +08:00
|
|
|
layoutConfig: layoutConfig().most(),
|
2019-12-04 14:07:14 +08:00
|
|
|
}).in(rootView)
|
|
|
|
}
|
|
|
|
}
|