BoxShadow
Properties
-
blur_radius(Number) –The standard deviation of the Gaussian to convolve with the shadow's shape.
-
blur_style(BlurStyle) – -
color(ColorValue) –Color used to draw the shadow.
-
offset(OffsetValue) –The displacement of the shadow from the casting
-
spread_radius(Number) –The amount the box should be inflated prior to applying the blur.
Methods
-
copy–Returns a copy of this object with the specified properties overridden.
Properties#
blur_radius
class-attribute
instance-attribute
#
blur_radius: Number = 0.0
The standard deviation of the Gaussian to convolve with the shadow's shape.
offset
class-attribute
instance-attribute
#
offset: OffsetValue = field(
default_factory=lambda: Offset()
)
The displacement of the shadow from the casting element. Positive x/y offsets will shift the shadow to the right and down, while negative offsets shift the shadow to the left and up. The offsets are relative to the position of the element that is casting it.
spread_radius
class-attribute
instance-attribute
#
spread_radius: Number = 0.0
The amount the box should be inflated prior to applying the blur.
Methods#
copy
#
copy(
*,
spread_radius: Number | None = None,
blur_radius: Number | None = None,
color: ColorValue | None = None,
offset: OffsetValue | None = None,
blur_style: BlurStyle | None = None,
) -> BoxShadow
Returns a copy of this object with the specified properties overridden.
Examples#
Example 1#
import flet as ft
def main(page: ft.Page):
page.add(
ft.Container(
bgcolor=ft.Colors.YELLOW,
width=100,
height=100,
border_radius=50,
shadow=[
ft.BoxShadow(
spread_radius=1,
blur_radius=15,
color=ft.Colors.WHITE,
offset=ft.Offset(-5, -5),
),
ft.BoxShadow(
spread_radius=1,
blur_radius=15,
color=ft.Colors.GREY_600,
offset=ft.Offset(5, 5),
),
],
),
ft.Container(
# bgcolor=ft.Colors.WHITE,
border_radius=10,
width=100,
height=100,
shadow=ft.BoxShadow(
spread_radius=1,
blur_radius=15,
color=ft.Colors.BLUE_GREY_300,
offset=ft.Offset(0, 0),
blur_style=ft.BlurStyle.OUTER,
),
),
)
ft.run(main)