Multi-step wizard templates for Flet apps — auth, profile, and gallery showcase
Project description
flet-wizards
Coleção de templates de wizard multi-step prontos para reutilizar em apps Flet. Cada template é uma @ft.component autocontida com estado reativo (@ft.observable), sistema de temas (Slate / Emerald / Rose / Azure), validação de plataforma e callback on_complete tipado. O repositório inclui um gallery showcase estilo Microsoft Store para visualizar todos os templates ao vivo durante o desenvolvimento.
Templates disponíveis
| Categoria | Template | Steps | Descrição | Docs |
|---|---|---|---|---|
auth |
AuthLoginWizard |
2 | Login clássico com e-mail e senha. | docs/auth/login.md |
auth |
AuthRegisterWizard |
3 | Cadastro com conta, perfil e revisão. | docs/auth/register.md |
auth |
AuthRecoveryWizard |
3 | Recuperação de senha com código de 6 dígitos e força animada. | docs/auth/recovery.md |
profile |
ProfileSetupWizard |
3 | Onboarding com identidade, bio, interesses e preferências (tema ao vivo). | docs/profile/setup.md |
profile |
ProfileEditWizard |
3 | Edição com diff visual destacando apenas campos alterados. | docs/profile/edit.md |
profile |
ProfileAvatarWizard |
3 | Configuração de avatar via arquivo, URL ou iniciais com preview. | docs/profile/avatar.md |
Instalação
pip install flet-wizards
Ou com uv:
uv add flet-wizards
Requer Python 3.12+ e Flet 0.85+.
Uso rápido
import flet as ft
from flet_wizards import AuthLoginWizard, WizardTheme
@ft.component
def App() -> ft.Control:
async def on_login(data: dict) -> None:
print("Login:", data)
# data == {"email": "..."}
return AuthLoginWizard(
theme=WizardTheme.SLATE,
on_complete=on_login,
)
async def main(page: ft.Page) -> None:
page.title = "Meu app"
page.padding = 0
page.bgcolor = "#0B0B0F"
page.render(App)
ft.run(main)
Os 4 temas built-in são acessados via WizardTheme.SLATE, WizardTheme.EMERALD, WizardTheme.ROSE e WizardTheme.AZURE. Quem precisar de uma paleta customizada constrói uma WizardTheme(...) própria — todos os campos são strings hex.
Gallery
O repositório vem com um app de demonstração que renderiza todos os templates lado a lado, com seletor de tema e navegação por categoria:
git clone https://github.com/Alisonsantos77/flet-wizards
cd flet-wizards
uv sync
uv run flet run
A janela abre em 1280×820 com sidebar por categoria (Auth / Profile), header com 4 swatches de tema e área principal mostrando o template selecionado em modo mock=True (já preenchido com dados de exemplo, abrindo direto no último step de dados como preview rápido).
Contribuindo
1. Setup local
git clone https://github.com/Alisonsantos77/flet-wizards
cd flet-wizards
uv sync
uv run flet run
2. Estrutura
src/flet_wizards/— pacote distribuído via PyPI (o que vai no wheel).src/gallery/— showcase de desenvolvimento, fora do wheel.src/main.py— entrypoint doflet runpara o gallery, fora do wheel.docs/— documentação técnica de cada template (escrita manualmente, lendo o código fonte).
3. Adicionar um novo template
-
Criar o módulo em
src/flet_wizards/<categoria>/<nome>.py. Decidir a categoria (existentes:auth,profile; novas categorias podem ser criadas livremente — o gallery descobre automaticamente via registry). -
Declarar o
WizardMetano topo do módulo, registrando-o no índice global:from flet_wizards.core import WizardMeta, register META = register( WizardMeta( id="categoria.nome", # ID único, ex.: "auth.magic_link" name="Nome do Template", # exibido no card do gallery category="categoria", # bucket no sidebar description="Descrição curta para o card.", steps=["Step 1", "Step 2"], # labels do Sidebar interno platforms=[ # plataformas suportadas ft.PagePlatform.WINDOWS, ft.PagePlatform.MACOS, ft.PagePlatform.LINUX, ft.PagePlatform.ANDROID, ft.PagePlatform.IOS, ], on_complete_schema={"campo": "str"}, # documenta o payload ) )
-
Definir o state reativo estendendo
BaseWizardState:from dataclasses import dataclass from typing import ClassVar import flet as ft from flet_wizards.core import BaseWizardState @ft.observable @dataclass class MeuState(BaseWizardState): TOTAL_STEPS: ClassVar[int] = 2 # número de steps de DADOS (sucesso é o N+1) campo: str = "" def reset(self) -> None: super().reset() self.campo = ""
-
Criar os step components em escopo de módulo (nunca aninhados — o registro de hooks quebra). Cada um decorado com
@ft.componente recebestatecomo parâmetro. -
Construir o wizard público com
WizardFrame, passandostate,step_labels,step_hints,steps(lista de componentes incluindo o de sucesso) eon_complete. Aceitarmock: bool = Falsepara ativar o preview do gallery. -
Adicionar mock data em
src/flet_wizards/core/mock_data.pyse o template precisar:MEU_TEMPLATE = {"campo": "valor de exemplo"}
-
Re-exportar no
src/flet_wizards/__init__.py:from flet_wizards.<categoria>.<nome> import MeuWizard __all__ = [..., "MeuWizard"]
-
Registrar no gallery importando o módulo em
src/gallery/app.py(basta o import —register()é idempotente e oWizardCardé renderizado a partir do registry). -
Documentar criando
docs/<categoria>/<nome>.mdcom as seções: descrição, steps, campos por step, plataformas, retorno doon_complete, exemplo de uso e mock no gallery. -
Atualizar a tabela de templates neste README e a entrada no
CHANGELOG.md.
4. Convenções
- Sem
page.update()em nenhuma circunstância — Flet 0.85+ tem auto-update. - Apenas docstrings como documentação inline; sem comentários de linha.
- Logs com
loguru, semprint(). - Feedback visual sempre via helpers de
flet_wizards.core.snack(show_success,show_error,show_info), nuncapage.show_dialog()direto.
Licença
MIT © Alison Santos.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flet_wizards-0.1.1.tar.gz.
File metadata
- Download URL: flet_wizards-0.1.1.tar.gz
- Upload date:
- Size: 28.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c56873b18da4c732c500c768e97546ff810e6e6ef3312ec1de28e6a61873ab9
|
|
| MD5 |
1620c8d74ea865d7c0a7d0d8b1bfc8be
|
|
| BLAKE2b-256 |
6100f97c7da1b4ffc74f7e86d1fa00134f476c224f6f1f962c056b71d9749d64
|
Provenance
The following attestation bundles were made for flet_wizards-0.1.1.tar.gz:
Publisher:
publish.yml on Alisonsantos77/flet-wizards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flet_wizards-0.1.1.tar.gz -
Subject digest:
6c56873b18da4c732c500c768e97546ff810e6e6ef3312ec1de28e6a61873ab9 - Sigstore transparency entry: 1489468948
- Sigstore integration time:
-
Permalink:
Alisonsantos77/flet-wizards@0c948a0bef89984e00d03aafa8f0a878eabcad9d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Alisonsantos77
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c948a0bef89984e00d03aafa8f0a878eabcad9d -
Trigger Event:
push
-
Statement type:
File details
Details for the file flet_wizards-0.1.1-py3-none-any.whl.
File metadata
- Download URL: flet_wizards-0.1.1-py3-none-any.whl
- Upload date:
- Size: 38.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0f53d4c651938656cc972c2c02ca0619bb7ddd23b9a042971aa1b3302d78741
|
|
| MD5 |
fd9d6ba548e4489fc42cde3dd0383f85
|
|
| BLAKE2b-256 |
0e35bccd10c3b43a2142abc3c60d800fa49ea3ba3000941bbb84203feb759816
|
Provenance
The following attestation bundles were made for flet_wizards-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on Alisonsantos77/flet-wizards
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flet_wizards-0.1.1-py3-none-any.whl -
Subject digest:
f0f53d4c651938656cc972c2c02ca0619bb7ddd23b9a042971aa1b3302d78741 - Sigstore transparency entry: 1489468995
- Sigstore integration time:
-
Permalink:
Alisonsantos77/flet-wizards@0c948a0bef89984e00d03aafa8f0a878eabcad9d -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/Alisonsantos77
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0c948a0bef89984e00d03aafa8f0a878eabcad9d -
Trigger Event:
push
-
Statement type: