BoxShadow
BoxShadow
#
blur_radius
#
blur_radius: Number = 0.0
The standard deviation of the Gaussian to convolve with the shadow's shape.
offset
#
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
#
spread_radius: Number = 0.0
The amount the box should be inflated prior to applying the blur.
copy_with
#
copy_with(
*,
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)