flet icon indicating copy to clipboard operation
flet copied to clipboard

Badge code Error

Open Youssef3082004 opened this issue 2 years ago • 0 comments

Duplicate Check

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

Describe the bug

in this code, I copied this from Flet.dev website and ran it on my machine but when I run it generated an error the "content" argument does not exist in init

I remember in the felt version 0.24.1 is run with no error

so what is the problem?

Code sample

import flet as ft

def main(page: ft.Page): page.title = "Badge on a NavigationBar destination icon" page.navigation_bar = ft.NavigationBar( destinations=[ ft.NavigationBarDestination( icon_content=ft.Badge( content=ft.Icon(ft.Icons.EXPLORE), small_size=10, ), label="Explore", ), ft.NavigationBarDestination(icon=ft.Icons.COMMUTE, label="Commute"), ft.NavigationBarDestination( icon_content=ft.Badge(content=ft.Icon(ft.Icons.PHONE), text="10") ), ] ) page.add(ft.Text("Body!"))

ft.app(main)

To reproduce

  1. run the code
  2. generete erro

Expected behavior

my expectations that will appear number 10 as a badge in icon expectation

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

windows 10 pro

Flet version

0.25.1

Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

Suggestions

No response

Logs

Unhandled error processing page session : Traceback (most recent call last): File "C:\Users\Computec\AppData\Local\Programs\Python\Python313\Lib\site-packages\flet\app.py", line 247, in on_session_created await asyncio.get_running_loop().run_in_executor( executor, session_handler, page ) File "C:\Users\Computec\AppData\Local\Programs\Python\Python313\Lib\concurrent\futures\thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "d:\Python\Flet - Cross Platform\test.py", line 8, in main icon_content=ft.Badge( ~~~~~~~~^ content=ft.Icon(ft.Icons.EXPLORE), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ small_size=10, ^^^^^^^^^^^^^^ ), ^ TypeError: Badge.init() got an unexpected keyword argument 'content'

Additional details

No response

Youssef3082004 avatar Dec 03 '24 19:12 Youssef3082004