-
Notifications
You must be signed in to change notification settings - Fork 589
Description
Description
Official Tutorials page
https://flet.dev/docs/controls/elevatedbutton
use outdated code (import "flet.border", "flet.buttons")
Code example to reproduce the issue:
import flet as ft
from flet.border import BorderSide
from flet.buttons import RoundedRectangleBorder
def main(page: ft.Page):
page.add(
ft.ElevatedButton(
"Styled button 1",
style=ft.ButtonStyle(
color={
ft.MaterialState.HOVERED: ft.colors.WHITE,
ft.MaterialState.FOCUSED: ft.colors.BLUE,
ft.MaterialState.DEFAULT: ft.colors.BLACK,
},
bgcolor={ft.MaterialState.FOCUSED: ft.colors.PINK_200, "": ft.colors.YELLOW},
padding={ft.MaterialState.HOVERED: 20},
overlay_color=ft.colors.TRANSPARENT,
elevation={"pressed": 0, "": 1},
animation_duration=500,
side={
ft.MaterialState.DEFAULT: BorderSide(1, ft.colors.BLUE),
ft.MaterialState.HOVERED: BorderSide(2, ft.colors.BLUE),
},
shape={
ft.MaterialState.HOVERED: RoundedRectangleBorder(radius=20),
ft.MaterialState.DEFAULT: RoundedRectangleBorder(radius=2),
},
),
)
)
ft.app(target=main)Describe the results you received:
ModuleNotFoundError: No module named 'flet.border'
Describe the results you expected:
Should be:
from flet import BorderSide
from flet import RoundedRectangleBorder
Additional information you deem important (e.g. issue happens only occasionally):
I searched for old issues. It seems like in early versions we moved BorderSide and RoundedRectangleBorder one folder up. I am new to Flet. There might be other places in the official tutorials have problems like this.
Furthermore, I use this code, but could not make the button bgcolor pink by clicking other place. Clicking "TAB" on the keyboard can make the button bgcolor pink, but it keeps pink; cannot changed back to yellow anymore. Is there something else wrong with my setup?
Flet version (pip show flet):
0.74
Operating system:
Windows 10
Additional environment details:
PyCharm 2023.1.2 (Community Edition)
Build #PC-231.9011.38, built on May 16, 2023