Skip to content

V1: When a TextStyle is provided through Theme.button_theme.style.text_style, the app throws a Flutter-side exception (only reproducible in debug mode) #5620

@InesaFitsner

Description

@InesaFitsner

Duplicate Check

Describe the bug

When a TextStyle is provided through Theme.button_theme.style.text_style, the app throws a Flutter-side exception (only reproducible in debug mode). The same text_style applied directly on a ButtonStyle for individual buttons does not crash.

Also, when using button_theme, there is a visible delay before the style is applied to the button, maybe 1 second. It doesn't happen when the style is applied directly in button.

Code sample

Code
import flet as ft


def main(page: ft.Page):
    page.title = "Basic elevated buttons"
    page.theme = ft.Theme(
        button_theme=ft.ButtonTheme(
            style=ft.ButtonStyle(
                text_style=ft.TextStyle(
                    size=20,
                    italic=True,
                    # bgcolor=ft.Colors.PURPLE,
                    # color=ft.Colors.ORANGE,
                ),
            ),
        )
    )
    page.add(
        ft.Button(
            "Button",
        ),
    )


ft.run(main)

To reproduce

  1. run repro code uv run flet run -w -p 8550 playground/button_theme_example.py
  2. fvm flutter run macos -d

Expected behavior

No response

Screenshots / Videos

Captures

[Upload media here]

Operating System

macOS

Operating system details

macOS

Flet version

0.69.0

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions