diff --git a/src/AnimatorDemo.ts b/src/AnimatorDemo.ts index 723c9776..d5335d0c 100644 --- a/src/AnimatorDemo.ts +++ b/src/AnimatorDemo.ts @@ -9,7 +9,7 @@ function thisLabel(str: string) { backgroundColor: colors[0], textSize: 15, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), }) } @@ -173,11 +173,11 @@ class AnimatorDemo extends Panel { stack([ view, ]).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), backgroundColor: colors[1].alpha(0.3 * 255), }), ]).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), gravity: gravity().center(), space: 10, } as IVLayout).in(rootView) diff --git a/src/ComplicatedAnimations.ts b/src/ComplicatedAnimations.ts index bc477830..bf437b59 100644 --- a/src/ComplicatedAnimations.ts +++ b/src/ComplicatedAnimations.ts @@ -9,7 +9,7 @@ function thisLabel(str: string) { backgroundColor: colors[0], textSize: 10, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), }) } @@ -190,11 +190,11 @@ class AnimationDemo extends Panel { v.scaleX = 1.5 }) ]).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), backgroundColor: colors[1].alpha(0.3 * 255), }), ]).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), gravity: gravity().center(), space: 10, } as IVLayout).in(rootView) diff --git a/src/ComplicatedDemo.ts b/src/ComplicatedDemo.ts index 203f2878..e5620aaf 100644 --- a/src/ComplicatedDemo.ts +++ b/src/ComplicatedDemo.ts @@ -14,7 +14,7 @@ class MyDemo extends Panel { header: pullable( stack([]).apply({ backgroundColor: Color.RED, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), width: 100, height: 30, }), @@ -32,7 +32,7 @@ class MyDemo extends Panel { renderItem: (idx) => { return listItem(text({ text: `Item :${idx}`, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), width: root.width, height: 50, textColor: Color.WHITE, @@ -42,14 +42,14 @@ class MyDemo extends Panel { }).apply({ }), }).apply({ - layoutConfig: layoutConfig().atmost(), + 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().exactly(), + layoutConfig: layoutConfig().just(), width: root.width, height: 200, scaleType: ScaleType.ScaleAspectFill, diff --git a/src/Counter.ts b/src/Counter.ts index 76f4852e..96e9876e 100644 --- a/src/Counter.ts +++ b/src/Counter.ts @@ -12,8 +12,8 @@ class CounterView extends ViewHolder { textSize: 40, layoutConfig: { alignment: Gravity.Center, - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, }, }).also(it => { this.number = it }), text({ @@ -26,8 +26,8 @@ class CounterView extends ViewHolder { corners: 5, layoutConfig: { alignment: Gravity.Center, - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, }, padding: { left: 10, @@ -69,8 +69,8 @@ class CounterView extends ViewHolder { root.addChild((new Image).also(iv => { iv.imageUrl = "https://misc.aotu.io/ONE-SUNDAY/SteamEngine.png" iv.layoutConfig = { - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, } })) } diff --git a/src/EffectsDemo.ts b/src/EffectsDemo.ts index 126d6728..1914e360 100644 --- a/src/EffectsDemo.ts +++ b/src/EffectsDemo.ts @@ -50,7 +50,7 @@ class EffectsDemo extends Panel { width: 5, color: colors[3] }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -65,7 +65,7 @@ class EffectsDemo extends Panel { width: 100, height: 100, corners: 10, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ bottom: 10 }) }),]).apply({ @@ -84,7 +84,7 @@ class EffectsDemo extends Panel { offsetY: 3, radius: 5, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ bottom: 10 }) }),]).apply({ @@ -103,7 +103,7 @@ class EffectsDemo extends Panel { color: colors[3] }, corners: 10, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -128,7 +128,7 @@ class EffectsDemo extends Panel { offsetY: 3, radius: 5, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ bottom: 10 }) }),]).apply({ @@ -148,7 +148,7 @@ class EffectsDemo extends Panel { offsetY: 3, radius: 5, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ bottom: 10 }) }),]).apply({ @@ -172,7 +172,7 @@ class EffectsDemo extends Panel { offsetY: 3, radius: 5, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -196,7 +196,7 @@ class EffectsDemo extends Panel { offsetY: 0, radius: 10, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 10, right: 10, bottom: 10, @@ -218,7 +218,7 @@ class EffectsDemo extends Panel { offsetY: 5, radius: 5, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 10, right: 10, bottom: 10, @@ -240,7 +240,7 @@ class EffectsDemo extends Panel { offsetY: 5, radius: 5, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 10, right: 10, bottom: 10, @@ -262,7 +262,7 @@ class EffectsDemo extends Panel { offsetY: 5, radius: 5, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 10, right: 10, bottom: 10, @@ -279,7 +279,7 @@ class EffectsDemo extends Panel { width: 100, height: 100, corners: 50, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -296,7 +296,7 @@ class EffectsDemo extends Panel { corners: { leftTop: 50, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -313,7 +313,7 @@ class EffectsDemo extends Panel { corners: { rightTop: 50, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -330,7 +330,7 @@ class EffectsDemo extends Panel { corners: { leftBottom: 50, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -347,7 +347,7 @@ class EffectsDemo extends Panel { corners: { rightBottom: 50, }, - layoutConfig: layoutConfig().exactly().m({ + layoutConfig: layoutConfig().just().configMargin({ left: 5, right: 5, bottom: 5, @@ -361,7 +361,7 @@ class EffectsDemo extends Panel { it.space = 20 }), ).also(it => { - it.layoutConfig = layoutConfig().atmost() + it.layoutConfig = layoutConfig().most() }).in(rootView) } } \ No newline at end of file diff --git a/src/FlowLayoutDemo.ts b/src/FlowLayoutDemo.ts index 5bc11e37..25b6415b 100644 --- a/src/FlowLayoutDemo.ts +++ b/src/FlowLayoutDemo.ts @@ -16,7 +16,7 @@ const imageUrls = [ class FlowDemo extends Panel { build(rootView: Group): void { flowlayout({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), itemCount: 100, columnCount: 3, columnSpace: 10, @@ -25,13 +25,13 @@ class FlowDemo extends Panel { return new FlowLayoutItem().apply({ backgroundColor: colors[idx % colors.length], height: 50 + (idx % 3) * 20, - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), }).also(it => { it.addChild(text({ text: `${idx}`, textColor: Color.WHITE, textSize: 20, - layoutConfig: layoutConfig().wrap().a(Gravity.Center) + layoutConfig: layoutConfig().fit().configAligmnet(Gravity.Center) })) }) }, @@ -45,13 +45,13 @@ class FlowDemo extends Panel { it.loadMoreView = new FlowLayoutItem().apply({ backgroundColor: colors[500 % colors.length], height: 50, - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), }).also(it => { it.addChild(text({ text: 'load more', textColor: Color.WHITE, textSize: 20, - layoutConfig: layoutConfig().wrap().a(Gravity.Center) + layoutConfig: layoutConfig().fit().configAligmnet(Gravity.Center) })) }) }) diff --git a/src/ImageDemo.ts b/src/ImageDemo.ts index c1ca6830..513f5d6b 100644 --- a/src/ImageDemo.ts +++ b/src/ImageDemo.ts @@ -10,7 +10,7 @@ class ImageDemo extends Panel { scroller(vlayout([ text({ text: "Image Demo", - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[5], @@ -59,7 +59,7 @@ class ImageDemo extends Panel { color: Color.GRAY, }, scaleType: ScaleType.ScaleToFill, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), loadCallback: (ret) => { } }), @@ -73,7 +73,7 @@ class ImageDemo extends Panel { color: Color.GRAY, }, scaleType: ScaleType.ScaleAspectFit, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), }), label('ScaleAspectFill'), image({ @@ -85,7 +85,7 @@ class ImageDemo extends Panel { color: Color.GRAY, }, scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), }), label('ImageBase64'), image({ @@ -97,14 +97,14 @@ class ImageDemo extends Panel { color: Color.GRAY, }, scaleType: ScaleType.ScaleAspectFill, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), }), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().center(), space: 10, } as IVLayout)).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), }).in(rootView) } } \ No newline at end of file diff --git a/src/InputDemo.ts b/src/InputDemo.ts index e1222045..8b52c831 100644 --- a/src/InputDemo.ts +++ b/src/InputDemo.ts @@ -7,7 +7,7 @@ class InputDemo extends Panel { vlayout([ title("Input Demo"), (new Input).also(it => { - it.layoutConfig = layoutConfig().exactly().h(LayoutSpec.WRAP_CONTENT) + it.layoutConfig = layoutConfig().just().configHeight(LayoutSpec.FIT) it.width = 300 it.multiline = false it.hintText = "HintText" @@ -20,7 +20,7 @@ class InputDemo extends Panel { } }), (new Input).also(it => { - it.layoutConfig = layoutConfig().wrap() + it.layoutConfig = layoutConfig().fit() it.hintText = "HintText" it.hintTextColor = colors[2] it.textAlignment = Gravity.Left @@ -36,10 +36,10 @@ class InputDemo extends Panel { ]) .also(it => { it.space = 10 - it.layoutConfig = layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT) + it.layoutConfig = layoutConfig().most().configHeight(LayoutSpec.FIT) })) .apply({ - layoutConfig: layoutConfig().atmost() + layoutConfig: layoutConfig().most() }) .in(root) } diff --git a/src/LayoutDemo.ts b/src/LayoutDemo.ts index b4762dbb..6a08b068 100644 --- a/src/LayoutDemo.ts +++ b/src/LayoutDemo.ts @@ -103,8 +103,8 @@ class LayoutDemo extends Panel { hlayout([ boxStr('weight=1', 3).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), @@ -114,8 +114,8 @@ class LayoutDemo extends Panel { width: 200, height: 30, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -124,8 +124,8 @@ class LayoutDemo extends Panel { box(3), boxStr('weight=1', 2).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), @@ -134,8 +134,8 @@ class LayoutDemo extends Panel { width: 200, height: 30, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -145,8 +145,8 @@ class LayoutDemo extends Panel { box(2), boxStr('weight=1', 4).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), @@ -154,8 +154,8 @@ class LayoutDemo extends Panel { width: 200, height: 30, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -163,15 +163,15 @@ class LayoutDemo extends Panel { hlayout([ boxStr('weight=1', 3).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), boxStr('weight=1', 2).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), @@ -180,8 +180,8 @@ class LayoutDemo extends Panel { width: 200, height: 30, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -189,22 +189,22 @@ class LayoutDemo extends Panel { hlayout([ boxStr('weight=1', 3).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), boxStr('weight=1', 2).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), boxStr('weight=1', 4).apply({ layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), @@ -212,8 +212,8 @@ class LayoutDemo extends Panel { width: 200, height: 30, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -291,29 +291,29 @@ class LayoutDemo extends Panel { vlayout([ boxStr('weight=1', 3).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, }, }), box(2).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, } }), box(4).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, } }), ]).apply({ width: 100, height: 200, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -321,29 +321,29 @@ class LayoutDemo extends Panel { vlayout([ box(3).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, }, }), boxStr('weight=1', 2).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), box(4).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, } }), ]).apply({ width: 100, height: 200, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -351,20 +351,20 @@ class LayoutDemo extends Panel { vlayout([ box(3).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, }, }), box(2).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, }, }), boxStr('weight=1', 4).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), @@ -372,8 +372,8 @@ class LayoutDemo extends Panel { width: 100, height: 200, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -381,30 +381,30 @@ class LayoutDemo extends Panel { vlayout([ boxStr('weight=1', 3).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, }, }), boxStr('weight=1', 2).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), box(4).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, } }), ]).apply({ width: 100, height: 200, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -412,22 +412,22 @@ class LayoutDemo extends Panel { vlayout([ boxStr('weight=1', 3).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, }, }), boxStr('weight=1', 2).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), boxStr('weight=1', 4).apply({ layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, weight: 1, } }), @@ -435,8 +435,8 @@ class LayoutDemo extends Panel { width: 100, height: 200, layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, backgroundColor: Color.parse('#eeeeee'), gravity: gravity().center(), @@ -453,7 +453,7 @@ class LayoutDemo extends Panel { it.space = 20 }), ).also(it => { - it.layoutConfig = layoutConfig().atmost() + it.layoutConfig = layoutConfig().most() }) .in(rootView) } diff --git a/src/ListDemo.ts b/src/ListDemo.ts index b5ec9ee4..71d4066c 100644 --- a/src/ListDemo.ts +++ b/src/ListDemo.ts @@ -9,8 +9,8 @@ class ListPanel extends Panel { text({ text: "ListDemo", layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, }, textSize: 30, textColor: Color.parse("#535c68"), @@ -33,7 +33,7 @@ class ListPanel extends Panel { } it.loadMoreView = listItem(text({ text: "Loading", - layoutConfig: layoutConfig().atmost().h(LayoutSpec.EXACTLY).a(Gravity.Center), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.JUST).configAligmnet(Gravity.Center), height: 50, })) it.renderItem = (idx: number) => { @@ -42,8 +42,8 @@ class ListPanel extends Panel { hlayout([ text({ layoutConfig: { - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.JUST, alignment: gravity().center(), }, text: `Cell At Line ${idx}`, @@ -59,8 +59,8 @@ class ListPanel extends Panel { }).also(it => { counter = it it.layoutConfig = { - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, margin: { left: 10, } @@ -68,8 +68,8 @@ class ListPanel extends Panel { }) ]).also(it => { it.layoutConfig = { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.FIT, margin: { bottom: 2, } @@ -83,8 +83,8 @@ class ListPanel extends Panel { }) ).also(it => { it.layoutConfig = { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.FIT, } it.onClick = () => { log(`Click item at ${idx}`) @@ -107,16 +107,16 @@ class ListPanel extends Panel { itemCount: 0, renderItem: () => new ListItem, layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.AT_MOST, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.MOST, }, }), }), ]).also(it => { it.layoutConfig = { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.AT_MOST, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.MOST, } it.backgroundColor = Color.WHITE }).in(rootView) diff --git a/src/ModalDemo.ts b/src/ModalDemo.ts index 2086e1b0..f4756080 100644 --- a/src/ModalDemo.ts +++ b/src/ModalDemo.ts @@ -7,7 +7,7 @@ class ModalDemo extends Panel { scroller(vlayout([ text({ text: "Modal", - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[1], @@ -21,7 +21,7 @@ class ModalDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { modal(context).toast('This is a toast.') } @@ -33,7 +33,7 @@ class ModalDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { modal(context).toast('This is a toast.', Gravity.Top) } @@ -46,14 +46,14 @@ class ModalDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { modal(context).toast('This is a toast.', Gravity.Center) } } as IText), text({ text: "Alert", - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[2], @@ -66,7 +66,7 @@ class ModalDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { modal(context).alert({ msg: 'This is alert.', @@ -79,7 +79,7 @@ class ModalDemo extends Panel { } as IText), text({ text: "Confirm", - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[3], @@ -92,7 +92,7 @@ class ModalDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { modal(context).confirm({ msg: 'This is Confirm.', @@ -110,7 +110,7 @@ class ModalDemo extends Panel { } as IText), text({ text: "Prompt", - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[4], @@ -123,7 +123,7 @@ class ModalDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { modal(context).prompt({ msg: 'This is Prompt.', @@ -140,11 +140,11 @@ class ModalDemo extends Panel { } } as IText), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: Gravity.Center, space: 10, } as IVLayout)).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), }).in(rootView) } } \ No newline at end of file diff --git a/src/NavbarDemo.ts b/src/NavbarDemo.ts index 43b743ca..b88fdc7e 100644 --- a/src/NavbarDemo.ts +++ b/src/NavbarDemo.ts @@ -12,7 +12,7 @@ class NavbarDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).isHidden().then(e => modal(context).alert(`Navbar isHidden:${e}`)).catch(e => { modal(context).alert(e) @@ -25,7 +25,7 @@ class NavbarDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).isHidden() .then(e => navbar(context).setHidden(!e)) @@ -40,7 +40,7 @@ class NavbarDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).setTitle('Setted Title') .catch(e => { @@ -54,7 +54,7 @@ class NavbarDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { navbar(context).setBgColor(Color.YELLOW) .catch(e => { @@ -68,17 +68,17 @@ class NavbarDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { navigator(context).pop() } } as IText), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().center(), space: 10, } as IVLayout)).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), }).in(rootView) } } \ No newline at end of file diff --git a/src/NavigatorDemo.ts b/src/NavigatorDemo.ts index b5ae7eca..3190be23 100644 --- a/src/NavigatorDemo.ts +++ b/src/NavigatorDemo.ts @@ -9,7 +9,7 @@ class NaivgatorDemo extends Panel { scroller(vlayout([ text({ text: "Navigator Demo", - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[1], @@ -26,7 +26,7 @@ class NaivgatorDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().just().configWidth(LayoutSpec.MOST), onClick: () => { navigator(context).push(`assets://demo/${e}.js`, { alias: `${e}.js`, @@ -43,17 +43,17 @@ class NaivgatorDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { navigator(context).pop() }, } as IText), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().center(), space: 10, } as IVLayout)).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), }).in(root) } diff --git a/src/NetworkDemo.ts b/src/NetworkDemo.ts index 851b5704..1515415a 100644 --- a/src/NetworkDemo.ts +++ b/src/NetworkDemo.ts @@ -12,7 +12,7 @@ class NetworkDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { network(context).get('https://m.baidu.com').then( e => { @@ -24,11 +24,11 @@ class NetworkDemo extends Panel { } } as IText), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().center(), space: 10, } as IVLayout)).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), }).in(rootView) } } \ No newline at end of file diff --git a/src/PopoverDemo.ts b/src/PopoverDemo.ts index fd0e4f99..8782578b 100644 --- a/src/PopoverDemo.ts +++ b/src/PopoverDemo.ts @@ -12,14 +12,14 @@ class PopoverDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { popover(context).show(text({ width: 200, height: 50, backgroundColor: colors[0], textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly().a(Gravity.Center), + layoutConfig: layoutConfig().just().configAligmnet(Gravity.Center), text: "This is PopOver Window", }).also(v => { let idx = 0 @@ -34,11 +34,11 @@ class PopoverDemo extends Panel { } } as IText), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().center(), space: 10, } as IVLayout)).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), }).in(rootView) } } \ No newline at end of file diff --git a/src/RefreshableDemo.ts b/src/RefreshableDemo.ts index 3d9d30c8..a9e012c8 100644 --- a/src/RefreshableDemo.ts +++ b/src/RefreshableDemo.ts @@ -6,7 +6,7 @@ class RefreshableDemo extends Panel { build(rootView: Group): void { let refreshImage: Image let refreshView = refreshable({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), onRefresh: () => { log('onRefresh') setTimeout(() => { @@ -16,7 +16,7 @@ class RefreshableDemo extends Panel { header: pullable( stack([ image({ - layoutConfig: layoutConfig().exactly().m({ top: 50, bottom: 10, }), + layoutConfig: layoutConfig().just().configMargin({ top: 50, bottom: 10, }), width: 30, height: 30, imageBase64: icon_refresh, @@ -43,7 +43,7 @@ class RefreshableDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { refreshView.setRefreshing(context, true) } @@ -54,7 +54,7 @@ class RefreshableDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { refreshView.setRefreshing(context, false) } @@ -66,7 +66,7 @@ class RefreshableDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { refreshView.setRefreshable(context, true) } @@ -78,13 +78,13 @@ class RefreshableDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { refreshView.setRefreshable(context, false) } } as IText), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().centerX(), space: 10, } as IVLayout)) diff --git a/src/ScrollerDemo.ts b/src/ScrollerDemo.ts index 9870d3d1..0f7a949d 100644 --- a/src/ScrollerDemo.ts +++ b/src/ScrollerDemo.ts @@ -9,7 +9,7 @@ class ScrollerPanel extends Panel { scroller( vlayout(new Array(100).fill(1).map(e => label('Scroll Content'))) ).apply({ - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), width: 300, height: 500, backgroundColor: Color.RED, @@ -17,7 +17,7 @@ class ScrollerPanel extends Panel { scroller( vlayout(new Array(100).fill(1).map(e => label('Scroll Content'))) ).apply({ - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), width: 300, height: 500, backgroundColor: Color.BLUE, @@ -25,7 +25,7 @@ class ScrollerPanel extends Panel { ]) ) .apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.EXACTLY), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.JUST), height: 500, backgroundColor: Color.YELLOW, }) diff --git a/src/SliderDemo.ts b/src/SliderDemo.ts index 6ab55c38..100ab458 100644 --- a/src/SliderDemo.ts +++ b/src/SliderDemo.ts @@ -19,8 +19,8 @@ class SliderPanel extends Panel { text({ text: "Gallery", layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.JUST, }, textSize: 30, textColor: Color.WHITE, @@ -34,7 +34,7 @@ class SliderPanel extends Panel { return slideItem(image({ imageUrl: imageUrls[idx % imageUrls.length], scaleType: ScaleType.ScaleAspectFit, - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST).h(LayoutSpec.AT_MOST).a(gravity().center()), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST).configHeight(LayoutSpec.MOST).configAligmnet(gravity().center()), })).also(it => { let start = idx it.onClick = () => { @@ -43,15 +43,15 @@ class SliderPanel extends Panel { }) }, layoutConfig: { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.FIT, weight: 1, }, }), ]).also(it => { it.layoutConfig = { - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.AT_MOST, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.MOST, } })) } diff --git a/src/Snake.ts b/src/Snake.ts index 962835c4..1998f217 100644 --- a/src/Snake.ts +++ b/src/Snake.ts @@ -155,8 +155,8 @@ class SnakeView extends ViewHolder { margin: { top: 20 }, - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, }, }), (new Stack).also(panel => { @@ -169,14 +169,14 @@ class SnakeView extends ViewHolder { textSize: 30, textColor: Color.parse("#ffffff"), layoutConfig: { - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, }, }).also(it => this.start = it), ]).also(it => { it.layoutConfig = { - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, } }), @@ -190,14 +190,14 @@ class SnakeView extends ViewHolder { textAlignment: new Gravity().center(), backgroundColor: Color.parse('#ffff00'), layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, }).also(it => this.up = it) ]).also(it => { it.layoutConfig = { - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, } }), hlayout([ @@ -209,8 +209,8 @@ class SnakeView extends ViewHolder { textAlignment: new Gravity().center(), backgroundColor: Color.parse('#ffff00'), layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, }).also(it => this.left = it), text({ @@ -221,8 +221,8 @@ class SnakeView extends ViewHolder { textAlignment: new Gravity().center(), backgroundColor: Color.parse('#ffff00'), layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, }).also(it => this.down = it), text({ @@ -233,14 +233,14 @@ class SnakeView extends ViewHolder { textAlignment: new Gravity().center(), backgroundColor: Color.parse('#ffff00'), layoutConfig: { - widthSpec: LayoutSpec.EXACTLY, - heightSpec: LayoutSpec.EXACTLY, + widthSpec: LayoutSpec.JUST, + heightSpec: LayoutSpec.JUST, }, }).also(it => this.right = it), ]).also(it => { it.layoutConfig = { - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, } it.space = 10 }), @@ -249,16 +249,16 @@ class SnakeView extends ViewHolder { controlArea.space = 10 controlArea.layoutConfig = { alignment: new Gravity().centerX(), - widthSpec: LayoutSpec.WRAP_CONTENT, - heightSpec: LayoutSpec.WRAP_CONTENT, + widthSpec: LayoutSpec.FIT, + heightSpec: LayoutSpec.FIT, } }), ]).also(it => { it.space = 20 it.layoutConfig = { alignment: new Gravity().centerX().top(), - widthSpec: LayoutSpec.AT_MOST, - heightSpec: LayoutSpec.AT_MOST, + widthSpec: LayoutSpec.MOST, + heightSpec: LayoutSpec.MOST, } it.gravity = new Gravity().centerX() }).in(root) diff --git a/src/StickDemo.ts b/src/StickDemo.ts index 3f74e083..3fc1b14c 100644 --- a/src/StickDemo.ts +++ b/src/StickDemo.ts @@ -4,7 +4,7 @@ import { title, colors } from "./utils"; function tab(idx: number, title: string, sliderView: Slider) { return text({ text: title, - layoutConfig: layoutConfig().exactly().wg(1), + layoutConfig: layoutConfig().just().configWeight(1), height: 41, onClick: () => { sliderView.slidePage(context, 0, true) @@ -27,13 +27,13 @@ class StickDemo extends Panel { vlayout([ stack([ image({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), imageUrl: "https://p.upyun.com/demo/webp/webp/jpg-0.webp", scaleType: ScaleType.ScaleAspectFill, }), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.EXACTLY), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.JUST), height: 200, backgroundColor: colors[0], }), @@ -42,7 +42,7 @@ class StickDemo extends Panel { ...this.tabs = [0, 1, 2].map(idx => { return text({ text: `Tab ${idx}`, - layoutConfig: layoutConfig().exactly().wg(1), + layoutConfig: layoutConfig().just().configWeight(1), height: 41, onClick: () => { this.sliderView.slidePage(context, idx, true) @@ -50,12 +50,12 @@ class StickDemo extends Panel { }) }) ]).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), gravity: Gravity.Center, } as IHLayout), this.indicator, ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.EXACTLY), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.JUST), height: 57, }), @@ -66,7 +66,7 @@ class StickDemo extends Panel { } [0, 1, 2].map(idx => { return flowlayout({ - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), width: root.width, height: root.height - 57, itemCount: 100, @@ -77,13 +77,13 @@ class StickDemo extends Panel { return new FlowLayoutItem().apply({ backgroundColor: colors[itemIdx % colors.length], height: 50, - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.JUST), }).also(it => { it.addChild(text({ text: `In Page ${idx},${itemIdx}`, textColor: Color.WHITE, textSize: 20, - layoutConfig: layoutConfig().wrap().a(Gravity.Center) + layoutConfig: layoutConfig().fit().configAligmnet(Gravity.Center) }).also(v => { v.onClick = () => { v.text = "Clicked" @@ -96,16 +96,16 @@ class StickDemo extends Panel { v.addSlideItem(e) }) }).apply({ - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), width: root.width, height: root.height - 57, }), ]) .also(it => { - it.layoutConfig = layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT) + it.layoutConfig = layoutConfig().most().configHeight(LayoutSpec.FIT) })) .apply({ - layoutConfig: layoutConfig().atmost() + layoutConfig: layoutConfig().most() }) .in(root) this.indicator.centerX = this.getRootView().width / this.tabs.length / 2 @@ -120,7 +120,7 @@ class StickDemo extends Panel { e.textColor = Color.BLACK } }) - this.indicator.layoutConfig = layoutConfig().exactly().a(Gravity.Bottom).m({ bottom: 13 }) + this.indicator.layoutConfig = layoutConfig().just().configAligmnet(Gravity.Bottom).configMargin({ bottom: 13 }) animate(context)({ animations: () => { this.indicator.centerX = this.getRootView().width / this.tabs.length * (page + 0.5) diff --git a/src/StorageDemo.ts b/src/StorageDemo.ts index f13db93b..fa814397 100644 --- a/src/StorageDemo.ts +++ b/src/StorageDemo.ts @@ -17,7 +17,7 @@ class StorageDemo extends Panel { scroller(vlayout([ text({ text: "Storage Demo", - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[1], @@ -26,7 +26,7 @@ class StorageDemo extends Panel { }), label('Stored'), text({ - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 20, textColor: Color.WHITE, backgroundColor: colors[3], @@ -39,7 +39,7 @@ class StorageDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { storage(context).getItem(storedKey, zone).then(e => { modal(context).prompt({ @@ -60,7 +60,7 @@ class StorageDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { storage(context).remove(storedKey, zone).then(e => { this.update() @@ -73,7 +73,7 @@ class StorageDemo extends Panel { backgroundColor: colors[0], textSize: 30, textColor: Color.WHITE, - layoutConfig: layoutConfig().exactly(), + layoutConfig: layoutConfig().just(), onClick: () => { storage(context).clear(zone).then(e => { this.update() @@ -81,11 +81,11 @@ class StorageDemo extends Panel { }, } as IText), ]).apply({ - layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), + layoutConfig: layoutConfig().most().configHeight(LayoutSpec.FIT), gravity: gravity().center(), space: 10, } as IVLayout)).apply({ - layoutConfig: layoutConfig().atmost(), + layoutConfig: layoutConfig().most(), }).in(root) this.update() } diff --git a/src/utils.ts b/src/utils.ts index c8d98f37..96e1847d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -39,7 +39,7 @@ export function boxStr(str: string, idx = 0) { export function title(str: string) { return text({ text: str, - layoutConfig: layoutConfig().w(LayoutSpec.AT_MOST), + layoutConfig: layoutConfig().configWidth(LayoutSpec.MOST), textSize: 30, textColor: Color.WHITE, backgroundColor: colors[1], @@ -53,7 +53,7 @@ export function rotatedArrow() { return pullable( stack([ image({ - layoutConfig: layoutConfig().exactly().m({ top: 50, bottom: 10, }), + layoutConfig: layoutConfig().just().configMargin({ top: 50, bottom: 10, }), width: 30, height: 30, imageBase64: icon_refresh,