how to use the AppBar in the Column, is it possible for the python class #1151
              
                Unanswered
              
          
                  
                    
                      bobwatcherx
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment
-
| Create your own custom appbarimport flet as ft
from time import sleep
import threading
class CostomAppbar(ft.UserControl):
    def __init__(self,ref:ft.Ref | None = None, go_back: str = "", title: str = ""):
        super().__init__(ref)
        self.go_back = go_back
        self.title = title
        self.main_container = ft.Container(
            expand=True,
            height=560,
            bgcolor="#6e44ff",
            content=ft.Container(
                expand=True,
                height=10,
                bgcolor="#f0edff",
                border_radius=ft.border_radius.BorderRadius(
                        topLeft=60, topRight=60, bottomLeft=0, bottomRight=0),
            ),
            alignment=ft.alignment.bottom_center,
            animate=ft.Animation(duration=360, curve="decelerate"),
        )
        self.stack_list = [
            self.main_container,
            ft.Text(
                self.title,
                size=20,
                weight=30,
                color=ft.colors.WHITE,
                top=10,
                left=35,
            )
        ]
        if self.go_back != "":
            self.stack_list.append(
                ft.IconButton(
                    icon=ft.icons.ARROW_BACK_IOS,
                    icon_color=ft.colors.WHITE,
                    on_click=lambda e: self.page.go(self.go_back),
                    top=5,
                    left=5
                ),
            )
        self.main_stack = ft.Stack(
            self.stack_list,
            expand=True,
            animate_scale=ft.Animation(duration=350, curve="develerate")
        )
        animation_thread = threading.Thread(target=self.start_animation)
        animation_thread.start()
    def start_animation(self):
        sleep(0.1)
        if self._is_isolated():
            self.main_container.height = 60
            self.update()
    def build(self):
        return self.main_stack
 | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Question
i want to use appbar inside usercontrol class but how to use it
Code sample
Error message
can't use appbar inside column------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions