"shadow" property of View
The "shadow" property allows you to set shadows for the View. There may be several shadows.The shadow is described using the ViewShadow interface extending the Properties interface (see above).The shadow has the following properties:
Property | Constant | Type | Description |
---|---|---|---|
"color" | ColorTag | Color | Shadow color |
"inset" | Inset | bool | true - the shadow inside the View, false - outside |
"x-offset" | XOffset | SizeUnit | Offset the shadow along the X axis |
"y-offset" | YOffset | SizeUnit | Offset the shadow along the Y axis |
"blur" | BlurRadius | float | Shadow blur radius. The value must be >= 0 |
"spread-radius" | SpreadRadius | float | Increase the shadow. Value > 0 increases shadow, < 0 decreases shadow |
Three functions are used to create a ViewShadow:
func NewViewShadow(offsetX, offsetY, blurRadius, spread-radius SizeUnit, color Color) ViewShadow func NewInsetViewShadow(offsetX, offsetY, blurRadius, spread-radius SizeUnit, color Color) ViewShadow func NewShadowWithParams(params Params) ViewShadow
The NewViewShadow function creates an outer shadow (Inset == false),NewInsetViewShadow - an inner one (Inset == true).The NewShadowWithParams function is used when constants must be used as parameters.For example:
shadow := NewShadowWithParams(rui.Params{ rui.ColorTag : "@shadowColor", rui.BlurRadius: 8.0, rui.Dilation : 16.0, })
ViewShadow, ViewShadow array, and ViewShadow textual representation can be assigned as a value to the "shadow" property.
The ViewShadow text representation has the following format:
_{ color =[, x-offset = ] [, y-offset = ] [, blur = ] [, spread-radius = ] [, inset = ] }
You can get the value of "shadow" property using the function
func GetViewShadows(view View, subviewID ...string) []ViewShadow
If no shadow is specified, then this function will return an empty array