flet

Trying to change color of the border while hovering


It doesn't seem to be working. Is anything wrong with it?

def showb(e):
    b.border = ft.border.all(1,ft.colors.WHITE)

b= ft.Container(
    content=a,border=ft.border.all(1,ft.colors.GREY_700),
    border_radius=20,
    width=446,
    on_hover=showb)

Please check if the code written is right. also check for scops


Solution

  • you should try adding b.update() in showb(e) to force re-render like this:

    def showb(e):
    b.border = ft.border.all(1, ft.colors.WHITE)
    b.update()