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

47 lines
1.7 KiB
TypeScript
Raw Normal View History

2020-01-03 13:35:40 +08:00
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, input } from "doric";
2019-12-07 15:50:37 +08:00
import { title, colors } from "./utils";
@Entry
class InputDemo extends Panel {
build(root: Group) {
scroller(
vlayout([
title("Input Demo"),
(new Input).also(it => {
2019-12-14 16:32:04 +08:00
it.layoutConfig = layoutConfig().just().configHeight(LayoutSpec.FIT)
2019-12-07 15:50:37 +08:00
it.width = 300
it.multiline = false
it.hintText = "HintText"
it.textAlignment = Gravity.Left
it.onTextChange = (s) => {
log(`onTextChange:${s}`)
}
it.onFocusChange = (f) => {
log(`onFocusChange:${f}`)
}
}),
(new Input).also(it => {
2019-12-14 16:32:04 +08:00
it.layoutConfig = layoutConfig().fit()
2019-12-07 15:50:37 +08:00
it.hintText = "HintText"
it.hintTextColor = colors[2]
it.textAlignment = Gravity.Left
it.textColor = colors[3]
it.onTextChange = (s) => {
log(`onTextChange:${s}`)
}
it.onFocusChange = (f) => {
log(`onFocusChange:${f}`)
}
it.backgroundColor = colors[1].alpha(0.3)
}),
])
.also(it => {
it.space = 10
2019-12-14 16:32:04 +08:00
it.layoutConfig = layoutConfig().most().configHeight(LayoutSpec.FIT)
2019-12-07 15:50:37 +08:00
}))
.apply({
2019-12-14 16:32:04 +08:00
layoutConfig: layoutConfig().most()
2019-12-07 15:50:37 +08:00
})
.in(root)
}
}