flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.5k stars 449 forks source link

fix: prevent button `style` from being modified in `before_update()` #4181

Closed ndonkoHenri closed 1 month ago

ndonkoHenri commented 1 month ago

Test Code

import flet as ft

def main(page: ft.Page):

    page.add(
        button := ft.ElevatedButton(
            "Button",
            style=ft.ButtonStyle(
                bgcolor=ft.colors.GREEN,
                color=ft.colors.RED,
                elevation=10,
                shape=ft.RoundedRectangleBorder(4),
                text_style=ft.TextStyle(
                    color=ft.colors.BLUE,
                ),
            ),
        )
    )
    print(button.style.shape)
    print(button.style.text_style)

ft.app(main)