How to change the View's back button color (in material 2) #768
Answered
by
JorgeAlvarez21
ndonkoHenri
asked this question in
Q&A
-
I just want to know if this is a bug or a a default stuff when using Material 2. import flet as ft
def main(page: ft.Page):
page.title = "Routes Example"
page.theme_mode = "light"
page.theme = ft.Theme(
use_material3=False, # use material 2 to test this issue
)
def route_change(route):
page.views.clear()
page.views.append(
ft.View(
"/",
[
ft.AppBar(title=ft.Text("Flet app", color="black"), bgcolor=ft.colors.WHITE),
ft.ElevatedButton("Visit Store", on_click=lambda _: page.go("/store")),
],
)
)
if page.route == "/store":
page.views.append(
ft.View(
"/store",
[
ft.AppBar(title=ft.Text("Store", color="black"), bgcolor=ft.colors.WHITE),
ft.ElevatedButton("Go Home", on_click=lambda _: page.go("/")),
],
)
)
page.update()
def view_pop(view):
page.views.pop()
top_view = page.views[-1]
page.go(top_view.route)
page.on_route_change = route_change
page.on_view_pop = view_pop
page.go(page.route)
ft.app(target=main) When in Material 3(instead of 2), this issue goes away though. (but I need the m2 for a project using views --) |
Beta Was this translation helpful? Give feedback.
Answered by
JorgeAlvarez21
Dec 27, 2022
Replies: 1 comment 3 replies
-
The button in Material three is white by default, to make it black you can pass the parameter to |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
ndonkoHenri
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The button in Material three is white by default, to make it black you can pass the parameter to
ft.Appbar(color=ft.colors.BLACK)