feat: demo update
This commit is contained in:
		| @@ -10,7 +10,7 @@ class ImageDemo extends Panel { | ||||
|                 layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), | ||||
|                 textSize: 30, | ||||
|                 textColor: Color.WHITE, | ||||
|                 bgColor: colors[1], | ||||
|                 bgColor: colors[5], | ||||
|                 textAlignment: gravity().center(), | ||||
|                 height: 50, | ||||
|             }), | ||||
| @@ -29,18 +29,6 @@ class ImageDemo extends Panel { | ||||
|                 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'), | ||||
|             image({ | ||||
|                 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"; | ||||
|  | ||||
| const imageUrls = [ | ||||
| @@ -33,7 +33,8 @@ class SliderPanel extends Panel { | ||||
|                 renderPage: (idx) => { | ||||
|                     return slideItem(image({ | ||||
|                         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 => { | ||||
|                         let start = idx | ||||
|                         it.onClick = () => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user