Skip to content

Posting notifications on ft.IconButton #2750

Answered by InesaFitsner
Aidar1983 asked this question in Q&A
Discussion options

You must be logged in to vote

To display Badge on the IconButton you need to do the opposite: use IconButton as the content for the Badge:

import flet as ft


def main(page: ft.Page):
    page.appbar = ft.CupertinoAppBar(
        leading=ft.IconButton(ft.icons.ASSIGNMENT_IND, icon_color="white"),
        bgcolor=ft.colors.DEEP_ORANGE_ACCENT_200,
        trailing=ft.Badge(
            content=ft.IconButton(
                ft.icons.DOORBELL,
                icon_color="white",
            ),
            text="1",
        ),
    )
    page.update()


ft.app(target=main)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by InesaFitsner
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants