2020-04-09 20:01:22 +08:00
|
|
|
|
2020-04-11 19:10:56 +08:00
|
|
|
import { Group, Panel, text, gravity, Color, LayoutSpec, vlayout, hlayout, scroller, IVLayout, IHLayout, layoutConfig, stack, Gravity, flexlayout, image, ScaleType } from "doric";
|
2020-04-10 20:41:43 +08:00
|
|
|
import { FlexDirection, Wrap, Justify, Align, FlexTypedValue, OverFlow } from "doric/lib/src/util/flexbox";
|
2020-04-13 14:43:01 +08:00
|
|
|
import { icon_refresh } from "./utils";
|
2020-04-11 19:10:56 +08:00
|
|
|
|
2020-04-09 20:01:22 +08:00
|
|
|
@Entry
|
|
|
|
class LayoutDemo extends Panel {
|
|
|
|
build(root: Group) {
|
2020-04-13 14:30:14 +08:00
|
|
|
scroller(
|
|
|
|
flexlayout(
|
|
|
|
[
|
|
|
|
image({
|
2020-04-13 14:43:01 +08:00
|
|
|
imageBase64: icon_refresh,
|
2020-04-13 14:30:14 +08:00
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
|
|
|
backgroundColor: Color.GRAY,
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
|
|
|
},
|
|
|
|
flexConfig: {
|
2020-04-13 14:43:01 +08:00
|
|
|
marginRight: 10,
|
2020-04-13 14:30:14 +08:00
|
|
|
},
|
2020-04-13 14:43:01 +08:00
|
|
|
height: 16,
|
2020-04-13 14:30:14 +08:00
|
|
|
}),
|
|
|
|
image({
|
2020-04-13 14:43:01 +08:00
|
|
|
imageBase64: icon_refresh,
|
2020-04-13 14:30:14 +08:00
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
2020-04-13 14:43:01 +08:00
|
|
|
backgroundColor: Color.GRAY,
|
2020-04-13 14:30:14 +08:00
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
|
|
|
},
|
2020-04-13 14:43:01 +08:00
|
|
|
flexConfig: {
|
|
|
|
alignSelf: Align.CENTER,
|
|
|
|
|
|
|
|
},
|
|
|
|
height: 16,
|
2020-04-13 14:30:14 +08:00
|
|
|
}),
|
|
|
|
image({
|
2020-04-13 14:43:01 +08:00
|
|
|
imageBase64: icon_refresh,
|
2020-04-13 14:30:14 +08:00
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
2020-04-13 14:43:01 +08:00
|
|
|
backgroundColor: Color.GRAY,
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
2020-04-13 14:30:14 +08:00
|
|
|
},
|
2020-04-13 14:43:01 +08:00
|
|
|
height: 50,
|
|
|
|
}),
|
2020-04-13 17:41:17 +08:00
|
|
|
image({
|
|
|
|
imageBase64: icon_refresh,
|
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
|
|
|
backgroundColor: Color.GRAY,
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
|
|
|
},
|
|
|
|
height: 50,
|
|
|
|
}),
|
|
|
|
image({
|
|
|
|
imageBase64: icon_refresh,
|
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
|
|
|
backgroundColor: Color.GRAY,
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
|
|
|
},
|
|
|
|
height: 50,
|
|
|
|
}),
|
|
|
|
image({
|
|
|
|
imageBase64: icon_refresh,
|
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
|
|
|
backgroundColor: Color.GRAY,
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
|
|
|
},
|
|
|
|
height: 50,
|
|
|
|
}),
|
2020-04-13 14:43:01 +08:00
|
|
|
image({
|
|
|
|
imageBase64: icon_refresh,
|
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
2020-04-13 14:30:14 +08:00
|
|
|
backgroundColor: Color.GRAY,
|
2020-04-13 14:43:01 +08:00
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
|
|
|
},
|
|
|
|
height: 16,
|
2020-04-13 14:30:14 +08:00
|
|
|
}),
|
|
|
|
image({
|
2020-04-13 14:43:01 +08:00
|
|
|
imageBase64: icon_refresh,
|
2020-04-13 14:30:14 +08:00
|
|
|
scaleType: ScaleType.ScaleAspectFit,
|
2020-04-13 14:43:01 +08:00
|
|
|
backgroundColor: Color.GRAY,
|
|
|
|
layoutConfig: {
|
|
|
|
widthSpec: LayoutSpec.FIT,
|
|
|
|
heightSpec: LayoutSpec.JUST,
|
|
|
|
},
|
2020-04-13 14:30:14 +08:00
|
|
|
flexConfig: {
|
2020-04-13 14:43:01 +08:00
|
|
|
marginTop: 20,
|
|
|
|
alignContent: Align.CENTER,
|
2020-04-13 14:30:14 +08:00
|
|
|
},
|
2020-04-13 14:43:01 +08:00
|
|
|
height: 16,
|
2020-04-13 14:30:14 +08:00
|
|
|
}),
|
|
|
|
],
|
|
|
|
{
|
2020-04-11 19:10:56 +08:00
|
|
|
flexConfig: {
|
2020-04-13 14:30:14 +08:00
|
|
|
flexDirection: FlexDirection.ROW,
|
2020-04-13 14:43:01 +08:00
|
|
|
width: 200,
|
2020-04-13 17:41:17 +08:00
|
|
|
height: 200,
|
2020-04-13 14:43:01 +08:00
|
|
|
flexWrap: Wrap.WRAP,
|
2020-04-13 17:41:17 +08:00
|
|
|
alignContent: Align.FLEX_END,
|
|
|
|
alignItems: Align.FLEX_START,
|
2020-04-11 19:10:56 +08:00
|
|
|
},
|
2020-04-13 14:30:14 +08:00
|
|
|
backgroundColor: Color.GRAY.alpha(0.1),
|
|
|
|
}
|
|
|
|
),
|
2020-04-09 20:01:22 +08:00
|
|
|
{
|
2020-04-13 14:30:14 +08:00
|
|
|
layoutConfig: layoutConfig().most()
|
2020-04-09 20:01:22 +08:00
|
|
|
}
|
2020-04-11 12:20:43 +08:00
|
|
|
).in(root)
|
2020-04-11 19:10:56 +08:00
|
|
|
|
2020-04-13 14:30:14 +08:00
|
|
|
// image({
|
|
|
|
// imageBase64: ICON_GENDER_MAN,
|
|
|
|
// backgroundColor: Color.GRAY,
|
|
|
|
// layoutConfig: {
|
|
|
|
// widthSpec: LayoutSpec.FIT,
|
|
|
|
// heightSpec: LayoutSpec.JUST,
|
|
|
|
// alignment: Gravity.Center,
|
|
|
|
// },
|
|
|
|
// height: 30,
|
|
|
|
// }).in(root)
|
2020-04-09 20:01:22 +08:00
|
|
|
}
|
|
|
|
}
|