[Question] Can someone explain me about styling the disabled ElevatedButtons #4783
-
Questionhelp teach me about styling disabled ElevatedButtons Code sampleElevatedButton(disabled = True) Error messageNo response ------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
Answered by
ndonkoHenri
Jan 27, 2025
Replies: 1 comment 1 reply
-
Below is a simple example, in which the text style of the button's text depends on it's state (whether disabled or not). import flet as ft
def main(page: ft.Page):
def handle_switch_change(e):
my_button.disabled = e.control.value
page.update()
my_button = ft.ElevatedButton(
text="Toggle the switch to see my text style change",
style=ft.ButtonStyle(
text_style={
ft.ControlState.DISABLED: ft.TextStyle(
size=20, weight=ft.FontWeight.BOLD
),
ft.ControlState.DEFAULT: ft.TextStyle(size=10, italic=True),
}
),
)
page.add(
my_button,
ft.Switch("Disable Button", value=False, on_change=handle_switch_change),
)
ft.app(main) Checkout the |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Kiueeukou
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Below is a simple example, in which the text style of the button's text depends on it's state (whether disabled or not).