import flet
def main(page: flet.Page):
page.add(
flet.IconButton(
icon="delete",
style=flet.ButtonStyle(
color={
flet.MaterialState.HOVERED: flet.colors.WHITE,
flet.MaterialState.DEFAULT: flet.colors.BLACK,
},
animation_duration=500,
),
)
)
flet.app(target=main)
This code generates a window with IconButton. There is two parameters: color (in hovered and default state) and animation_duration in it's ButtonStyle. Although animation_duration is used it's not working as needed.
import flet
def main(page: flet.Page):
page.add(
flet.TextButton(
"delete",
style=flet.ButtonStyle(
color={
flet.MaterialState.HOVERED: flet.colors.WHITE,
flet.MaterialState.DEFAULT: flet.colors.BLACK,
},
animation_duration=500,
),
)
)
flet.app(target=main)
This one is what I am aiming for. The same code, but instead IconButton used TextButton with text not an icon. The issue is smooth animation of changing color for text works fine, but for icon it don't work at all.