Skip to content

Flet MaterialState in ButtonStyle throws a TypeError #685

Closed
@rohitsathish

Description

@rohitsathish

When setting the style properties for a TextButton,MaterialState throws a type error. I was able to replicate the same with example provided in the docs.

app.py

style = ft.ButtonStyle(
    color = {
        ft.MaterialState.DEFAULT: ft.colors.WHITE,
        ft.MaterialState.HOVERED: ft.colors.LIGHT_BLUE,
    },
    bgcolor = {
        ft.MaterialState.FOCUSED: ft.colors.LIGHT_BLUE
    }
)

error

TypeError: keys must be str, int, float, bool or None, not MaterialState

Flet 0.2.4
Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions