Glitch Appears During Container Collapse Animation in Flet #4861
-
QuestionI’m not sure if this issue is caused by my code or if it’s a problem with Flet’s animation itself. When I press the This becomes a problem in my actual project because there is text at the glitchy area, and it behaves unexpectedly during the animation. Has anyone encountered this issue before? Any suggestions on how to fix it? video example: 2025-02-09.16-50-00.mp4Code sampleimport flet as ft
def main(page: ft.Page):
anim = ft.animation.Animation(400, 'decelerate')
alert = ft.Container(
bgcolor=ft.Colors.BLUE,
height=500,
width=500,
animate=anim,
animate_size=anim,
)
panel = ft.Container(
bgcolor='green',
height=75, padding=0, margin=0,
animate=anim,
animate_size=anim,
)
sub_panel = ft.Container(
bgcolor='grey',
height=500,
padding=0, margin=0,
animate=anim,
animate_size=anim,
animate_opacity=anim,
)
total_panel = ft.Column(
spacing=0, run_spacing=0, expand=True,
controls=[panel, sub_panel],
)
def toggle(e):
sub_panel.height = 500 if sub_panel.height == 0 else 0
sub_panel.update()
c1 = ft.Container(
border=ft.border.all(10, color=ft.Colors.random()),
content=alert,
)
page.add(
total_panel, ft.TextButton('Click', on_click=toggle)
)
ft.app(main) Error messageNope ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I also noticed that when I run the code I uploaded, it creates this in the project structure. I don't understand what this is |
Beta Was this translation helpful? Give feedback.
-
It occurs as a result of you having both Try commenting them out one after the other to see which behavior you want to see in your app. |
Beta Was this translation helpful? Give feedback.
It occurs as a result of you having both
animate
andanimate_size
defined in yoursub_panel
container. They then both play a role in your container animation, but differently, causing the glitch.Try commenting them out one after the other to see which behavior you want to see in your app.