add colors property in GradientColor

This commit is contained in:
王劲鹏 2020-05-09 10:50:07 +08:00 committed by osborn
parent 1c314bdb21
commit bcc66b51b9
4 changed files with 182 additions and 6 deletions

View File

@ -604,6 +604,179 @@ class EffectsDemo extends Panel {
], ],
{ space: 20 } { space: 20 }
), ),
hlayout(
[
vlayout(
[
label("Multi-Grad TOP_BOTTOM"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.TOP_BOTTOM
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
vlayout(
[
label("Gradient TR_BL"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.TR_BL
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
vlayout(
[
label("Multi-Grad RIGHT_LEFT"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.RIGHT_LEFT
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
vlayout(
[
label("Multi-Grad BR_TL"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.BR_TL
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
vlayout(
[
label("Multi-Grad BOTTOM_TOP"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.BOTTOM_TOP
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
vlayout(
[
label("Multi-Grad BL_TR"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.BL_TR
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
vlayout(
[
label("Gradient LEFT_RIGHT"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.LEFT_RIGHT
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
vlayout(
[
label("Multi-Grad TL_BR"),
box().apply({
width: 100,
height: 100,
backgroundColor: {
colors: [colors[0], Color.WHITE, colors[1]],
orientation: GradientOrientation.TL_BR
},
layoutConfig: layoutConfig().just().configMargin({
left: 5,
right: 5,
bottom: 5,
})
}),
],
{
gravity: Gravity.Center,
space: 10,
}),
],
{ space: 20 }
),
], ],
{ {
space: 20 space: 20

5
doric-js/index.d.ts vendored
View File

@ -956,8 +956,9 @@ declare module 'doric/lib/src/util/color' {
TL_BR = 7 TL_BR = 7
} }
export interface GradientColor { export interface GradientColor {
start: Color; start?: Color;
end: Color; end?: Color;
colors?: Array<Color>;
orientation: GradientOrientation; orientation: GradientOrientation;
} }
} }

View File

@ -41,7 +41,8 @@ export declare enum GradientOrientation {
TL_BR = 7 TL_BR = 7
} }
export interface GradientColor { export interface GradientColor {
start: Color; start?: Color;
end: Color; end?: Color;
colors?: Array<Color>;
orientation: GradientOrientation; orientation: GradientOrientation;
} }

View File

@ -91,8 +91,9 @@ export enum GradientOrientation {
} }
export interface GradientColor { export interface GradientColor {
start: Color start?: Color
end: Color end?: Color
colors?: Array<Color>
orientation: GradientOrientation orientation: GradientOrientation
} }