flet icon indicating copy to clipboard operation
flet copied to clipboard

DeprecationWarning: Call to __init__()

Open Philip-Leron opened this issue 10 months ago • 6 comments

DeprecationWarning: Call to init() is deprecated since version 0.21.0 and will be removed in version 1.0. UserControl is deprecated. See https://flet.dev/docs/getting-started/custom-controls. super().init()

Philip-Leron avatar Apr 16 '24 21:04 Philip-Leron

meanwhile i cant see anything in the https://flet.dev/docs/getting-started/custom-controls and my app is not running too

Philip-Leron avatar Apr 16 '24 21:04 Philip-Leron

Please fill up all details as required by the issue template. As the message says, UserControl is deprecated and will be removed in the future.

ndonkoHenri avatar Apr 17 '24 02:04 ndonkoHenri

error is coming fro this class Main(UserControl): def init(self, page:Page,): super().init().. code was working until i upgraded flet... old flet version doent have some properties i required....and this error shows up when i try running my app

Philip-Leron avatar Apr 17 '24 03:04 Philip-Leron

this is what i have...... from pages.forgotpassword import ForgotPassword from pages.login import Login from pages.signup import SignUp from pages.home import Home from flet import * class Main(UserControl): def init(self, page:Page): super().init() self.page = page self.page.title="Portal" self.page.horizontal_alignment=MainAxisAlignment.CENTER self.page.vertical_alignment=CrossAxisAlignment.CENTER #self.page.alignment=MainAxisAlignment.CENTER self.page.window_width=1800 self.page.window_height=1000 self.page.window_center=True self.page.padding=30

    self.init_helper()
def init_helper(self,):
    self.page.on_route_change = self.on_route_change
    self.page.go('/')
    
def on_route_change(self, route):
    newpage ={
        "/":Home,
        "/login":Login,
        "/signup":SignUp,
        "/forgotpassword":ForgotPassword
        

    }[self.page.route](self.page)
    self.page.views.clear()
    self.page.views.append(
        View(
            route,
            [newpage]

        )

    )

app(target=Main,assets_dir='assets')

Philip-Leron avatar Apr 17 '24 04:04 Philip-Leron

Please build some reproducible code so we can test.

ndonkoHenri avatar Apr 17 '24 08:04 ndonkoHenri

https://github.com/Philip-Leron/flet_portal

Philip-Leron avatar Apr 17 '24 14:04 Philip-Leron