2019-12-09 20:34:28 +08:00
|
|
|
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, IVLayout, Group, IText, navigator, modal } from "doric";
|
2019-12-04 14:07:14 +08:00
|
|
|
import { colors, label } from "./utils";
|
|
|
|
@Entry
|
|
|
|
class NaivgatorDemo extends Panel {
|
|
|
|
build(root: Group) {
|
2019-12-09 20:34:28 +08:00
|
|
|
if (this.getInitData()) {
|
|
|
|
modal(context).alert(`Init Data :${JSON.stringify(this.getInitData())}`)
|
|
|
|
}
|
2019-12-04 14:07:14 +08:00
|
|
|
scroller(vlayout([
|
|
|
|
text({
|
|
|
|
text: "Navigator Demo",
|
|
|
|
layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST),
|
|
|
|
textSize: 30,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
backgroundColor: colors[1],
|
|
|
|
textAlignment: gravity().center(),
|
|
|
|
height: 50,
|
|
|
|
}),
|
|
|
|
...[
|
|
|
|
'NavbarDemo',
|
|
|
|
'Counter', 'EffectsDemo', 'ImageDemo', 'LayoutDemo',
|
|
|
|
'ListDemo', 'ModalDemo', 'NavigatorDemo',
|
|
|
|
'NetworkDemo', 'ScrollerDemo', 'SliderDemo', 'Snake', 'StorageDemo'].map(e =>
|
|
|
|
label(e).apply({
|
|
|
|
height: 50,
|
|
|
|
backgroundColor: colors[0],
|
|
|
|
textSize: 30,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
layoutConfig: layoutConfig().exactly().w(LayoutSpec.AT_MOST),
|
|
|
|
onClick: () => {
|
2019-12-09 20:34:28 +08:00
|
|
|
navigator(context).push(`assets://demo/${e}.js`, {
|
|
|
|
alias: `${e}.js`,
|
|
|
|
extra: {
|
|
|
|
from: "navigatorDemo"
|
|
|
|
},
|
|
|
|
})
|
2019-12-04 14:07:14 +08:00
|
|
|
},
|
|
|
|
} as IText)
|
|
|
|
),
|
|
|
|
label('POP').apply({
|
|
|
|
width: 200,
|
|
|
|
height: 50,
|
|
|
|
backgroundColor: colors[0],
|
|
|
|
textSize: 30,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
layoutConfig: layoutConfig().exactly(),
|
|
|
|
onClick: () => {
|
|
|
|
navigator(context).pop()
|
|
|
|
},
|
|
|
|
} as IText),
|
|
|
|
]).apply({
|
|
|
|
layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT),
|
|
|
|
gravity: gravity().center(),
|
|
|
|
space: 10,
|
|
|
|
} as IVLayout)).apply({
|
|
|
|
layoutConfig: layoutConfig().atmost(),
|
|
|
|
}).in(root)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|