From 90a36913627f768fc13f889cc8e21e7edbbd2d1a Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 22 Jun 2020 15:11:36 +0800 Subject: [PATCH] feat:fix complicatedDemo --- doric-demo/src/ComplicatedDemo.ts | 93 ++++++++++++++++--------------- 1 file changed, 49 insertions(+), 44 deletions(-) diff --git a/doric-demo/src/ComplicatedDemo.ts b/doric-demo/src/ComplicatedDemo.ts index 1de1bbac..1a94ab16 100644 --- a/doric-demo/src/ComplicatedDemo.ts +++ b/doric-demo/src/ComplicatedDemo.ts @@ -6,53 +6,58 @@ class MyDemo extends Panel { build(root: Group) { let refreshed: Refreshable let headerImage: Image - stack([ - refreshed = refreshable({ - onRefresh: () => { - refreshed.setRefreshing(context, false) - }, - header: pullable( - stack([]).apply({ - backgroundColor: Color.RED, - layoutConfig: layoutConfig().just(), - width: 100, - height: 30, - }), - { - startAnimation: () => { - }, - stopAnimation: () => { - }, - setPullingDistance: (distance: number) => { - headerImage.scaleX = headerImage.scaleY = (headerImage.height + distance * 2) / headerImage.height - }, - }), - content: list({ - itemCount: 20, - renderItem: (idx) => { - return listItem(text({ - text: `Item :${idx}`, - layoutConfig: layoutConfig().just(), - width: root.width, - height: 50, - textColor: Color.WHITE, - backgroundColor: colors[idx % colors.length], - })) + stack( + [ + refreshed = refreshable({ + onRefresh: () => { + refreshed.setRefreshing(context, false) }, + header: pullable( + stack([]).apply({ + backgroundColor: Color.RED, + layoutConfig: layoutConfig().just(), + width: 100, + height: 30, + }), + { + startAnimation: () => { + }, + stopAnimation: () => { + }, + setPullingDistance: (distance: number) => { + headerImage.scaleX = headerImage.scaleY = (headerImage.height + distance * 2) / headerImage.height + }, + }), + content: list({ + itemCount: 20, + renderItem: (idx) => { + return listItem(text({ + text: `Item :${idx}`, + layoutConfig: layoutConfig().just(), + width: root.width, + height: 50, + textColor: Color.WHITE, + backgroundColor: colors[idx % colors.length], + })) + }, + layoutConfig: layoutConfig().most(), + }), layoutConfig: layoutConfig().most(), + }).also(v => { + v.top = 200 }), - layoutConfig: layoutConfig().most(), - }).also(v => { - v.top = 200 - }), - headerImage = image({ - imageUrl: "https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg", - layoutConfig: layoutConfig().just(), - width: root.width, - height: 200, - scaleType: ScaleType.ScaleAspectFill, - }), - ]).in(root) + headerImage = image({ + imageUrl: "https://img.zcool.cn/community/01e75b5da933daa801209e1ffa4649.jpg@1280w_1l_2o_100sh.jpg", + layoutConfig: layoutConfig().just(), + width: root.width, + height: 200, + scaleType: ScaleType.ScaleAspectFill, + }), + ], + { + layoutConfig: layoutConfig().most() + } + ).in(root) } } \ No newline at end of file