feat:fix alignmnet typo
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { text, vlayout, Image, ViewHolder, VMPanel, ViewModel, Gravity, NativeCall, Text, Color, log, logw, loge, Group, LayoutSpec, } from "doric"
|
||||
import { text, vlayout, ViewHolder, VMPanel, ViewModel, Gravity, NativeCall, Text, Color, log, logw, loge, Group, LayoutSpec, layoutConfig, IVLayout, } from "doric"
|
||||
|
||||
interface CountModel {
|
||||
count: number
|
||||
@@ -7,72 +7,20 @@ class CounterView extends ViewHolder {
|
||||
number!: Text
|
||||
counter!: Text
|
||||
build(root: Group) {
|
||||
root.addChild(vlayout([
|
||||
text({
|
||||
vlayout([
|
||||
this.number = text({
|
||||
textSize: 40,
|
||||
layoutConfig: {
|
||||
alignment: Gravity.Center,
|
||||
widthSpec: LayoutSpec.FIT,
|
||||
heightSpec: LayoutSpec.FIT,
|
||||
},
|
||||
}).also(it => { this.number = it }),
|
||||
text({
|
||||
text: "点击计数",
|
||||
textSize: 20,
|
||||
border: {
|
||||
width: 1,
|
||||
color: Color.parse('#000000'),
|
||||
},
|
||||
corners: 5,
|
||||
layoutConfig: {
|
||||
alignment: Gravity.Center,
|
||||
widthSpec: LayoutSpec.FIT,
|
||||
heightSpec: LayoutSpec.FIT,
|
||||
},
|
||||
padding: {
|
||||
left: 10,
|
||||
right: 10,
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
},
|
||||
shadow: {
|
||||
color: Color.parse("#00ff00"),
|
||||
opacity: 0.5,
|
||||
radius: 20,
|
||||
offsetX: 10,
|
||||
offsetY: 10,
|
||||
}
|
||||
}).also(it => { this.counter = it }),
|
||||
]).also(it => {
|
||||
it.width = 200
|
||||
it.height = 200
|
||||
it.space = 20
|
||||
it.gravity = Gravity.Center
|
||||
it.layoutConfig = {
|
||||
alignment: Gravity.Center
|
||||
}
|
||||
it.border = {
|
||||
width: 1,
|
||||
color: Color.parse("#000000"),
|
||||
}
|
||||
it.shadow = {
|
||||
color: Color.parse("#ffff00"),
|
||||
opacity: 0.5,
|
||||
radius: 20,
|
||||
offsetX: 10,
|
||||
offsetY: 10,
|
||||
}
|
||||
it.corners = 20
|
||||
it.backgroundColor = Color.parse('#ff00ff')
|
||||
}))
|
||||
}),
|
||||
|
||||
root.addChild((new Image).also(iv => {
|
||||
iv.imageUrl = "https://misc.aotu.io/ONE-SUNDAY/SteamEngine.png"
|
||||
iv.layoutConfig = {
|
||||
widthSpec: LayoutSpec.FIT,
|
||||
heightSpec: LayoutSpec.FIT,
|
||||
}
|
||||
}))
|
||||
this.counter = text({
|
||||
text: "Click To Count",
|
||||
textSize: 20,
|
||||
}),
|
||||
]).apply({
|
||||
layoutConfig: layoutConfig().most(),
|
||||
gravity: Gravity.Center,
|
||||
space: 20,
|
||||
} as IVLayout).in(root)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,15 +54,4 @@ class MyPage extends VMPanel<CountModel, CounterView>{
|
||||
count: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NativeCall
|
||||
log() {
|
||||
log("Hello.HEGO")
|
||||
logw("Hello.HEGO")
|
||||
loge("Hello.HEGO")
|
||||
context.modal.toast('This is a toast.').then((r) => {
|
||||
loge(r)
|
||||
})
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
import { Group, Panel, flowlayout, layoutConfig, FlowLayoutItem, text, Color, IFlowLayout, LayoutSpec, Gravity } from "doric";
|
||||
import { Group, Panel, flowlayout, layoutConfig, FlowLayoutItem, text, Color, IFlowLayout, LayoutSpec, Gravity, flowItem } from "doric";
|
||||
import { colors, label } from "./utils";
|
||||
|
||||
const imageUrls = [
|
||||
@@ -22,17 +22,15 @@ class FlowDemo extends Panel {
|
||||
columnSpace: 10,
|
||||
rowSpace: 10,
|
||||
renderItem: (idx) => {
|
||||
return new FlowLayoutItem().apply({
|
||||
return flowItem(text({
|
||||
text: `${idx}`,
|
||||
textColor: Color.WHITE,
|
||||
textSize: 20,
|
||||
layoutConfig: layoutConfig().fit().configAlignment(Gravity.Center)
|
||||
})).apply({
|
||||
backgroundColor: colors[idx % colors.length],
|
||||
height: 50 + (idx % 3) * 20,
|
||||
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST),
|
||||
}).also(it => {
|
||||
it.addChild(text({
|
||||
text: `${idx}`,
|
||||
textColor: Color.WHITE,
|
||||
textSize: 20,
|
||||
layoutConfig: layoutConfig().fit().configAlignmnet(Gravity.Center)
|
||||
}))
|
||||
})
|
||||
},
|
||||
}).also(it => {
|
||||
@@ -51,7 +49,7 @@ class FlowDemo extends Panel {
|
||||
text: 'load more',
|
||||
textColor: Color.WHITE,
|
||||
textSize: 20,
|
||||
layoutConfig: layoutConfig().fit().configAlignmnet(Gravity.Center)
|
||||
layoutConfig: layoutConfig().fit().configAlignment(Gravity.Center)
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log } from "doric";
|
||||
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, input } from "doric";
|
||||
import { title, colors } from "./utils";
|
||||
@Entry
|
||||
class InputDemo extends Panel {
|
||||
|
@@ -33,7 +33,7 @@ class ListPanel extends Panel {
|
||||
}
|
||||
it.loadMoreView = listItem(text({
|
||||
text: "Loading",
|
||||
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.JUST).configAlignmnet(Gravity.Center),
|
||||
layoutConfig: layoutConfig().most().configHeight(LayoutSpec.JUST).configAlignment(Gravity.Center),
|
||||
height: 50,
|
||||
}))
|
||||
it.renderItem = (idx: number) => {
|
||||
|
@@ -19,7 +19,7 @@ class PopoverDemo extends Panel {
|
||||
height: 50,
|
||||
backgroundColor: colors[0],
|
||||
textColor: Color.WHITE,
|
||||
layoutConfig: layoutConfig().just().configAlignmnet(Gravity.Center),
|
||||
layoutConfig: layoutConfig().just().configAlignment(Gravity.Center),
|
||||
text: "This is PopOver Window",
|
||||
}).also(v => {
|
||||
let idx = 0
|
||||
|
@@ -34,7 +34,7 @@ class SliderPanel extends Panel {
|
||||
return slideItem(image({
|
||||
imageUrl: imageUrls[idx % imageUrls.length],
|
||||
scaleType: ScaleType.ScaleAspectFit,
|
||||
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST).configHeight(LayoutSpec.MOST).configAlignmnet(gravity().center()),
|
||||
layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST).configHeight(LayoutSpec.MOST).configAlignment(gravity().center()),
|
||||
})).also(it => {
|
||||
let start = idx
|
||||
it.onClick = () => {
|
||||
|
@@ -83,7 +83,7 @@ class StickDemo extends Panel {
|
||||
text: `In Page ${idx},${itemIdx}`,
|
||||
textColor: Color.WHITE,
|
||||
textSize: 20,
|
||||
layoutConfig: layoutConfig().fit().configAlignmnet(Gravity.Center)
|
||||
layoutConfig: layoutConfig().fit().configAlignment(Gravity.Center)
|
||||
}).also(v => {
|
||||
v.onClick = () => {
|
||||
v.text = "Clicked"
|
||||
@@ -120,7 +120,7 @@ class StickDemo extends Panel {
|
||||
e.textColor = Color.BLACK
|
||||
}
|
||||
})
|
||||
this.indicator.layoutConfig = layoutConfig().just().configAlignmnet(Gravity.Bottom).configMargin({ bottom: 13 })
|
||||
this.indicator.layoutConfig = layoutConfig().just().configAlignment(Gravity.Bottom).configMargin({ bottom: 13 })
|
||||
animate(context)({
|
||||
animations: () => {
|
||||
this.indicator.centerX = this.getRootView().width / this.tabs.length * (page + 0.5)
|
||||
|
Reference in New Issue
Block a user