feat: demo update
This commit is contained in:
parent
5a042e9b76
commit
e220faa03a
@ -10,7 +10,7 @@ class ImageDemo extends Panel {
|
|||||||
layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST),
|
layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST),
|
||||||
textSize: 30,
|
textSize: 30,
|
||||||
textColor: Color.WHITE,
|
textColor: Color.WHITE,
|
||||||
bgColor: colors[1],
|
bgColor: colors[5],
|
||||||
textAlignment: gravity().center(),
|
textAlignment: gravity().center(),
|
||||||
height: 50,
|
height: 50,
|
||||||
}),
|
}),
|
||||||
@ -29,18 +29,6 @@ class ImageDemo extends Panel {
|
|||||||
loadCallback: (ret) => {
|
loadCallback: (ret) => {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
label('WebP'),
|
|
||||||
image({
|
|
||||||
imageUrl: "https://misc.aotu.io/ONE-SUNDAY/world_cup_2014_42.webp",
|
|
||||||
loadCallback: (ret) => {
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
label('Lossy WebP'),
|
|
||||||
image({
|
|
||||||
imageUrl: "https://misc.aotu.io/ONE-SUNDAY/world_cup_2014_42_lossy.webp",
|
|
||||||
loadCallback: (ret) => {
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
label('ScaleToFill'),
|
label('ScaleToFill'),
|
||||||
image({
|
image({
|
||||||
imageUrl,
|
imageUrl,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, slider, slideItem, image, layoutConfig } from "doric";
|
import { Group, Panel, List, text, gravity, Color, Stack, LayoutSpec, list, NativeCall, listItem, log, vlayout, Gravity, hlayout, slider, slideItem, image, layoutConfig, ScaleType } from "doric";
|
||||||
import { colors } from "./utils";
|
import { colors } from "./utils";
|
||||||
|
|
||||||
const imageUrls = [
|
const imageUrls = [
|
||||||
@ -33,7 +33,8 @@ class SliderPanel extends Panel {
|
|||||||
renderPage: (idx) => {
|
renderPage: (idx) => {
|
||||||
return slideItem(image({
|
return slideItem(image({
|
||||||
imageUrl: imageUrls[idx % imageUrls.length],
|
imageUrl: imageUrls[idx % imageUrls.length],
|
||||||
layoutConfig: layoutConfig().w(LayoutSpec.WRAP_CONTENT).h(LayoutSpec.WRAP_CONTENT).a(gravity().center()),
|
scaleType: ScaleType.ScaleAspectFit,
|
||||||
|
layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST).h(LayoutSpec.AT_MOST).a(gravity().center()),
|
||||||
})).also(it => {
|
})).also(it => {
|
||||||
let start = idx
|
let start = idx
|
||||||
it.onClick = () => {
|
it.onClick = () => {
|
||||||
|
Reference in New Issue
Block a user