how to run animation on page.overlay.append #898
Unanswered
bobwatcherx
asked this question in
Q&A
Replies: 1 comment
-
Hi there, According to the docs, the animated switcher "switches" between 2 containers, using an animation. In you case, you do not need that. See below for a makeshift solution that uses sleep to wait for the scale animation before popping the overlay. from flet import (
Page,
Container,
alignment,
animation,
Row,
Column,
Text,
IconButton,
ElevatedButton,
app)
from time import sleep
def main(page:Page):
page.padding = 20
page.horizontal_alignment = "center"
animation_duration = 3
animation_curve = "EASE_OUT_CUBIC"
def addmodal(e):
ct.scale = 1
page.overlay.append(ct)
page.update()
def dismissmodal(e):
ct.scale = 0
page.update()
sleep(animation_duration)
page.overlay.pop()
page.update()
ct = Container(
alignment=alignment.center,
bgcolor="grey",
scale=1,
height=200,
width=200,
animate_scale=animation.Animation(animation_duration*1000, animation_curve),
padding=10,
content=Column([
Row([
Text("Hello App",size=30),
IconButton(icon="close",icon_size=30,
on_click=dismissmodal
)
],
alignment="spaceBetween")
])
)
page.add(ElevatedButton("add new", on_click=addmodal))
app(target=main) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
i want to make dialog animated like SweetAlert .but the bounceIn animation is not working . is there a way to add animation when overlay.append section and is there a way to custom overlay color
my code
Beta Was this translation helpful? Give feedback.
All reactions