interface
from corio import interface
interface is a thin base for Flet UI apps with lifecycle hooks and typed context wiring.
Main pieces:
Context: typed runtime container aroundflet.PageBase:ft.Columnsubclass with async constructor (new), routing hooks, and launch helper- decorators
updateandprogressfor post-action page refresh/progress display
Install:
pip install "corio[interface]" --upgrade
Typical Base Pattern
import flet as ft
from corio import interface
class App(interface.Base[interface.Context]):
TITLE = "Example Interface"
def __init__(self):
super().__init__(controls=[ft.Text(self.TITLE)])
App.launch()
Advanced Pattern (seen in sibling repos)
- Override
async def new(cls, page)for async setup (database/session/bootstrap). - Configure
PATH_ASSETSandPATH_UPLOADSfor static/upload handling. - Use tabs/views and route hooks (
route,pop) for multi-view apps. Baseauto-managesFLET_SECRET_KEYwhen missing.
@classmethod
async def new(cls, page):
# async startup work here
self = await super().new(page)
return self
update and progress decorators are useful for callback methods that need guaranteed page refresh and spinner visibility.