Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/1/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import asyncio
import flet as ft
from fletx.app import FletXApp
from routes import routes
from routes import MyAppRouter

def main(page: ft.Page):
# Configuration de la page
Expand All @@ -24,7 +24,6 @@ def main(page: ft.Page):

# Initialisation de l'application FletX
app = FletXApp(
routes = routes,
initial_route = "/login",
debug = True
)
Expand Down
2 changes: 0 additions & 2 deletions fletx/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class FletXApp:

def __init__(
self,
routes: Optional[Dict[str, Type[FletXPage]]] = None,
initial_route: str = "/",
theme_mode: ft.ThemeMode = ft.ThemeMode.SYSTEM,
debug: bool = False
Expand All @@ -34,7 +33,6 @@ def __init__(
debug: Debug mode
"""

self.routing_module = routes or {}
self.initial_route = initial_route
self.theme_mode = theme_mode
self.debug = debug
Expand Down
2 changes: 1 addition & 1 deletion fletx/cli/templates/project/README.md.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# {{ project_name }}
# {{ project_name | pascal_case }}

{{ description }}

Expand Down
2 changes: 1 addition & 1 deletion fletx/cli/templates/project/app/__init__.py.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
{{ project_name }} - A FletX Application
{{ project_name | pascal_case }} - A FletX Application

This package contains the main application components.
"""
Expand Down
2 changes: 1 addition & 1 deletion fletx/cli/templates/project/app/components/__init__.py.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
{{ project_name }} Application Components module.
{{ project_name | pascal_case }} Application Components module.

This module contains reusable widgets and components
Version: {{ version }}
Expand Down
4 changes: 2 additions & 2 deletions fletx/cli/templates/project/app/controllers/__init__.py.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Controllers package for {{ project_name }}.
Controllers package for {{ project_name | pascal_case }}.

Controllers contain the business logic and manage application state.
"""

from counter import CounterController
from .counter import CounterController

__all__ = [
'CounterController'
Expand Down
2 changes: 1 addition & 1 deletion fletx/cli/templates/project/app/models/__ini__.py.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
{{ project_name }} Application Models module.
{{ project_name | pascal_case }} Application Models module.

This module contains data models.
Version: {{ version }}
Expand Down
4 changes: 2 additions & 2 deletions fletx/cli/templates/project/app/pages/__init__.py.tpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
{{ project_name }} Application Pages module.
{{ project_name | pascal_case }} Application Pages module.

This module contains the application Pages.
Version: {{ version }}
"""

from counter import CounterPage
from .counter import CounterPage

__all__ = [
'CounterPage'
Expand Down
2 changes: 1 addition & 1 deletion fletx/cli/templates/project/app/pages/counter.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CounterPage(FletXPage):
horizontal_alignment = ft.CrossAxisAlignment.CENTER,
controls = [
ft.Text(
"{{ project_name }} Counter",
"{{ project_name | pascal_case }} Counter",
size = 20,
weight = ft.FontWeight.BOLD
),
Expand Down
26 changes: 22 additions & 4 deletions fletx/cli/templates/project/app/routes.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,27 @@ Version: {{ version }}


# Import your pages here
from fletx.navigation import (
ModuleRouter, TransitionType, RouteTransition
)
from fletx.decorators import register_router

from .pages.counter import CounterPage

# Define {{ project_name }} routes here
routes = {
'/': CounterPage
}
# Define {{ project_name | pascal_case }} routes here
routes = [
{
'path': '/',
'component': CounterPage,
},
]

@register_router
class {{ project_name | pascal_case }}Router(ModuleRouter):
"""{{ project_name }} Routing Module."""

name = '{{ project_name }}'
base_path = '/'
is_root = True
routes = routes
sub_routers = []
3 changes: 1 addition & 2 deletions fletx/cli/templates/project/main.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Version: {{ version }}

import flet as ft
from fletx.app import FletXApp
from app.routes import routes
from app.routes import {{ project_name | pascal_case }}Router

def main(page: ft.Page):
"""Main entry point for the Flet application."""
Expand All @@ -32,7 +32,6 @@ def main(page: ft.Page):

# FletX Application Initialization
app = FletXApp(
routes = routes,
initial_route = "/",
debug = True
)
Expand Down