feat:fix Android weight props blend error
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout } from "doric";
|
||||
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout } from "doric";
|
||||
const colors = [
|
||||
"#f0932b",
|
||||
"#eb4d4b",
|
||||
@@ -26,23 +26,44 @@ class ListPanel extends Panel {
|
||||
list({
|
||||
itemCount: 1000,
|
||||
renderItem: (idx: number) => {
|
||||
return listItem(text({
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.AT_MOST,
|
||||
heightSpec: LayoutSpec.WRAP_CONTENT,
|
||||
margin: {
|
||||
left: 10,
|
||||
right: 50,
|
||||
top: 50,
|
||||
bottom: 10,
|
||||
},
|
||||
},
|
||||
text: `Cell At Line ${idx}`,
|
||||
textAlignment: gravity().center(),
|
||||
textColor: Color.parse("#ffffff"),
|
||||
textSize: 20,
|
||||
})).also(it => {
|
||||
it.gravity = gravity().center()
|
||||
return listItem(
|
||||
hlayout([
|
||||
text({
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.WRAP_CONTENT,
|
||||
heightSpec: LayoutSpec.EXACTLY,
|
||||
alignment: gravity().center(),
|
||||
},
|
||||
text: `Cell At Line ${idx}`,
|
||||
textAlignment: gravity().center(),
|
||||
textColor: Color.parse("#ffffff"),
|
||||
textSize: 20,
|
||||
height: 50,
|
||||
bgColor: Color.parse('#00ff00'),
|
||||
}),
|
||||
text({
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.EXACTLY,
|
||||
heightSpec: LayoutSpec.EXACTLY,
|
||||
alignment: gravity().center(),
|
||||
weight: 1,
|
||||
},
|
||||
text: `Right`,
|
||||
textAlignment: gravity().right(),
|
||||
textColor: Color.parse("#ffffff"),
|
||||
textSize: 20,
|
||||
height: 50,
|
||||
bgColor: Color.parse('#00ffff'),
|
||||
}),
|
||||
]).also(it => {
|
||||
it.layoutConfig = {
|
||||
widthSpec: LayoutSpec.AT_MOST,
|
||||
heightSpec: LayoutSpec.WRAP_CONTENT,
|
||||
alignment: gravity().center(),
|
||||
}
|
||||
it.bgColor = Color.parse('#ffffff')
|
||||
})
|
||||
).also(it => {
|
||||
it.bgColor = Color.parse(colors[idx % colors.length])
|
||||
it.layoutConfig = {
|
||||
widthSpec: LayoutSpec.AT_MOST,
|
||||
@@ -51,8 +72,7 @@ class ListPanel extends Panel {
|
||||
it.height = 100
|
||||
it.onClick = () => {
|
||||
log(`Click item at ${idx}`)
|
||||
it.bgColor = Color.parse('#000000')
|
||||
log(`bgcolor is ${Color.parse('#000000').toModel()}`)
|
||||
it.height += 10
|
||||
}
|
||||
})
|
||||
},
|
||||
|
Reference in New Issue
Block a user