flet icon indicating copy to clipboard operation
flet copied to clipboard

SnackBar not working in Flet 0.26.0 (works in 0.25.2)

Open jonasreyes opened this issue 1 year ago • 2 comments

Duplicate Check

  • [x] I have searched the opened issues and there are no duplicates

Describe the bug

The SnackBar widget does not appear when triggered in Flet version 0.26.0. The same code works correctly in version 0.25.2. The issue occurs both in desktop mode and web mode.

Code sample

Code
import flet as ft

def main(page: ft.Page):
    page.title = "SnackBar Test"

    page.snack_bar = ft.SnackBar(
        content=ft.Text("This is a SnackBar!"),
        action="OK",
    )

    def show_snack(event):
        page.snack_bar.open = True
        page.update()

    page.add(
        ft.ElevatedButton("Show SnackBar", on_click=show_snack)
    )

ft.app(target=main)

To reproduce

Run the script using Flet version 0.26.0. 

Click the "Show SnackBar" button. 

Observe that the SnackBar does not appear. 

Expected behavior

The SnackBar should appear when the button is clicked, as it does in Flet version 0.25.2. Actual Behavior :

The SnackBar does not appear in Flet version 0.26.0, regardless of whether the application is run in desktop mode or web mode. Environment Details :

Python Version : 3.13.1
Browsers Tested : Firefox, Chrome, Yandex Browser

Screenshots / Videos

Captures

[Upload media here]

Operating System

macOS

Operating system details

Operating System : macOS, ArchLinux and Canaima GNU/Linux

Flet version

Flet Version : 0.26.0 (issue occurs), 0.25.2 (works fine)

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

The issue was reproduced on both macOS and Linux systems.
Downgrading to Flet version 0.25.2 resolves the issue.
No error messages are displayed in the terminal or browser console.

jonasreyes avatar Feb 04 '25 23:02 jonasreyes

from version Flet 0.26.0 use page.overlay.append(page.snack_bar)

Alexukg avatar Feb 05 '25 08:02 Alexukg

Doc example has been updated: https://flet.dev/docs/controls/snackbar#snackbar-with-dynamic-message

ndonkoHenri avatar Feb 19 '25 03:02 ndonkoHenri