Replies: 2 comments
-
theme1 = ft.Theme(
navigation_drawer_theme=ft.NavigationDrawerTheme(
label_text_style={
ft.ControlState.HOVERED: ft.TextStyle(color=ft.colors.WHITE),
ft.ControlState.FOCUSED: ft.TextStyle(color=ft.colors.YELLOW),
ft.ControlState.DEFAULT: ft.TextStyle(color=ft.colors.BLUE),
},
bgcolor=ft.colors.GREEN,
shadow_color=ft.colors.BLUE_ACCENT_700,
elevation=16,
indicator_color=ft.colors.RED,
indicator_shape=ft.RoundedRectangleBorder(radius=10),
surface_tint_color=ft.colors.AMBER,
tile_height=120
)
)
page.theme = theme1 It should work like this but it doesn't! Delete the label_text_style property, other properties and their assigned values always work. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Workaround, another way: import flet as ft
def home(page: ft.Page):
theme1 = ft.Theme(
navigation_drawer_theme=ft.NavigationDrawerTheme(
# label_text_style={
# ft.ControlState.HOVERED: ft.TextStyle(color=ft.colors.WHITE),
# ft.ControlState.FOCUSED: ft.TextStyle(color=ft.colors.YELLOW),
# ft.ControlState.DEFAULT: ft.TextStyle(color=ft.colors.BLUE),
# },
bgcolor=ft.colors.GREEN,
shadow_color=ft.colors.BLUE_ACCENT_700,
elevation=16,
indicator_color=ft.colors.RED,
indicator_shape=ft.RoundedRectangleBorder(radius=10),
surface_tint_color=ft.colors.AMBER,
tile_height=120
),
navigation_bar_theme=ft.NavigationBarTheme(
label_text_style=ft.TextStyle(color=ft.colors.YELLOW),
)
)
page.theme = theme1
page.update()
drawer = ft.NavigationDrawer(
surface_tint_color=ft.colors.WHITE,
controls=[
ft.Container(height=12),
ft.Container(
padding=15,
margin=ft.margin.only(left=13,top=5,right=13,bottom=5),
border_radius=11,
bgcolor=ft.colors.RED,
content=ft.Row(
controls=[
ft.Icon(ft.icons.ADD),
ft.Text("Deneme",color=ft.colors.WHITE)
]
),
on_click=lambda _:{},
ink=True
),
ft.Divider(thickness=2),
ft.NavigationDrawerDestination(
icon_content=ft.Icon(ft.icons.MAIL_OUTLINED),
label="Item-2",
selected_icon=ft.icons.MAIL,
),
ft.NavigationDrawerDestination(
icon_content=ft.Icon(ft.icons.PHONE_OUTLINED),
label="Item-3",
selected_icon=ft.icons.PHONE,
),
],
)
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Container(
content=ft.Row(
controls=[
ft.IconButton(
icon=ft.icons.MENU,
on_click=lambda e: page.open(drawer),
),
ft.Text(
"Casa del Rey de la Gloria",
),
ft.IconButton(
icon=ft.icons.SEARCH,
# on_pressed=lambda: page.open_drawer(),
),
],
alignment=ft.MainAxisAlignment.SPACE_BETWEEN,
expand=True
),
),
ft.Container()
],
alignment=ft.MainAxisAlignment.CENTER,
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
spacing=20,
expand=True
),
)
)
if __name__ == "__main__":
ft.app(target=home, assets_dir="assets") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
no puedo usar el drawer usando ft.views, cabe destacar que quiero usarlo en una sola vista.
import flet as ft
def home(page: ft.Page):
drawer = ft.NavigationDrawer(
controls=[
ft.Container(height=12),
ft.NavigationDrawerDestination(
label="Item 1",
icon=ft.icons.DOOR_BACK_DOOR_OUTLINED,
selected_icon_content=ft.Icon(ft.icons.DOOR_BACK_DOOR),
),
ft.Divider(thickness=2),
ft.NavigationDrawerDestination(
icon_content=ft.Icon(ft.icons.MAIL_OUTLINED),
label="Item 2",
selected_icon=ft.icons.MAIL,
),
ft.NavigationDrawerDestination(
icon_content=ft.Icon(ft.icons.PHONE_OUTLINED),
label="Item 3",
selected_icon=ft.icons.PHONE,
),
],
)
if name == "main":
ft.app(target=home,assets_dir="assets")
Beta Was this translation helpful? Give feedback.
All reactions