Flet ```MaterialState``` in ```ButtonStyle``` throws a TypeError
See original GitHub issueWhen 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
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
What is MaterialStateProperty<Color>? - flutter - Stack Overflow
Interface for classes that resolve to a value of type T based on a widget's interactive "state", which is defined as a set...
Read more >ButtonStyle class - material library - Flutter - Dart API docs
Buttons and their themes have a ButtonStyle property which defines the visual properties whose default values are to be overridden.
Read more >ElevatedButton - Flet
ButtonStyle allows controling all visual aspects of a button, such as shape, foreground, background and shadow colors, content padding, border width and radius....
Read more >Flutter Skill of ButtonStyle And MaterialStateProperty - Medium
When Google makes the UI response of MaterialState to the Widget, it also follows the design specifications of Material Design, such as the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hum, Just had thesame issue. instead of
ft.MaterialState.DEFAULT
for example, you need to useft.MaterialState.DEFAULT.value
After this change it should work now…
Fixed here: https://pypi.org/project/flet/0.3.0.dev917/