2020-04-16 19:21:24 +08:00
|
|
|
import { Panel, scroller, vlayout, text, layoutConfig, LayoutSpec, Color, gravity, Group, 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",
|
2019-12-14 16:32:04 +08:00
|
|
|
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
|
2019-12-04 14:07:14 +08:00
|
|
|
textSize: 30,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
backgroundColor: colors[1],
|
|
|
|
textAlignment: gravity().center(),
|
|
|
|
height: 50,
|
|
|
|
}),
|
|
|
|
...[
|
2021-04-14 17:46:58 +08:00
|
|
|
'NavbarDemo', "DraggableDemo",
|
|
|
|
"RefreshableDemo",
|
2019-12-04 14:07:14 +08:00
|
|
|
'Counter', 'EffectsDemo', 'ImageDemo', 'LayoutDemo',
|
|
|
|
'ListDemo', 'ModalDemo', 'NavigatorDemo',
|
2019-12-24 16:48:17 +08:00
|
|
|
'NetworkDemo', 'ScrollerDemo', 'SliderDemo', 'Snake', 'StorageDemo', 'PopoverDemo'].map(e =>
|
2019-12-04 14:07:14 +08:00
|
|
|
label(e).apply({
|
|
|
|
height: 50,
|
|
|
|
backgroundColor: colors[0],
|
|
|
|
textSize: 30,
|
|
|
|
textColor: Color.WHITE,
|
2019-12-14 16:32:04 +08:00
|
|
|
layoutConfig: layoutConfig().just().configWidth(LayoutSpec.MOST),
|
2019-12-04 14:07:14 +08:00
|
|
|
onClick: () => {
|
2019-12-24 16:48:17 +08:00
|
|
|
navigator(context).push(`assets://src/${e}.js`, {
|
2019-12-09 20:34:28 +08:00
|
|
|
alias: `${e}.js`,
|
|
|
|
extra: {
|
|
|
|
from: "navigatorDemo"
|
|
|
|
},
|
|
|
|
})
|
2019-12-04 14:07:14 +08:00
|
|
|
},
|
2020-04-16 19:21:24 +08:00
|
|
|
})
|
2019-12-04 14:07:14 +08:00
|
|
|
),
|
|
|
|
label('POP').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: () => {
|
|
|
|
navigator(context).pop()
|
|
|
|
},
|
2020-04-16 19:21:24 +08:00
|
|
|
}),
|
2020-04-01 15:19:37 +08:00
|
|
|
label('OpenURL').apply({
|
|
|
|
width: 200,
|
|
|
|
height: 50,
|
|
|
|
backgroundColor: colors[0],
|
|
|
|
textSize: 30,
|
|
|
|
textColor: Color.WHITE,
|
|
|
|
layoutConfig: layoutConfig().just(),
|
|
|
|
onClick: () => {
|
|
|
|
navigator(context).openUrl("https://doric.pub")
|
|
|
|
},
|
2020-04-16 19:21:24 +08:00
|
|
|
}),
|
2019-12-04 14:07:14 +08:00
|
|
|
]).apply({
|
2020-09-18 16:27:45 +08:00
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.MOST,
|
|
|
|
heightSpec: LayoutSpec.FIT
|
|
|
|
},
|
2020-05-06 15:19:08 +08:00
|
|
|
width: Environment.screenWidth,
|
2019-12-04 14:07:14 +08:00
|
|
|
gravity: gravity().center(),
|
|
|
|
space: 10,
|
2020-04-16 19:21:24 +08:00
|
|
|
})).apply({
|
2019-12-14 16:32:04 +08:00
|
|
|
layoutConfig: layoutConfig().most(),
|
2019-12-04 14:07:14 +08:00
|
|
|
}).in(root)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|