0

I Try to make deffrent class for appbar in flet. as you know in main function we can change property after page.appbar= change property here ( writing code ).

I want create diffrent class for appbar properties , something like that

class Header(ft.UserControl):


def build(self):

    header_f = ft.AppBar(
        leading=ft.Icon(ft.icons.PALETTE),
        leading_width=40,
        title=ft.Text("AppBar Example"),)
    return header_f 

and make object in main function like this

def main(page: ft.page):

heder = Header()
page.appbar = heder

page.update()

but it's not work. Any one can tell me it's possible ?

1 Answers1

0

Finally I Solve my problem

I just Edit this line

heder = Header() to >>>>> heder = Header().build()