|
1 | | -<h1 align="center">FletNavigator v2.2.5 Documentation.</h1> |
| 1 | +<h1 align="center">FletNavigator v2.3.5 Documentation.</h1> |
2 | 2 |
|
3 | 3 | <h4 align="center">Menu:</h4> |
4 | 4 |
|
@@ -34,11 +34,9 @@ Installation is quite easy: ```pip install flet_navigator``` |
34 | 34 |
|
35 | 35 | **FletNavigator TODO**: |
36 | 36 | - **Animations between page change. (50%).** |
37 | | - - **Fix bugs.** |
38 | 37 |
|
39 | 38 | **FletNavigator Known Bugs**: |
40 | | - - **Unable to trace previous page when manually updating URL in browser (`_nav_route_change_handler`). (Seems like fixed).** |
41 | | - - **Non-tested in real projects.** |
| 39 | + - **No known bugs...** |
42 | 40 |
|
43 | 41 | <hr> |
44 | 42 |
|
@@ -100,15 +98,16 @@ Homepage is main page, that you can set with `set_homepage`, and navigate with ` |
100 | 98 | - `routes_data: dict[str, Any] = {}` - Routes data. |
101 | 99 | - `homepage: str = '/'` - Homepage (main page). |
102 | 100 | - `fade_effect: bool = True` - Use fade effect when switching pages? BETA. |
| 101 | + - `appbars: dict[int, Control] = {}` - Dictionary of appbars for each page (ID). |
103 | 102 | - `route_changed_handler: RouteChangedHandler = None` - Route changed handler.<br><br> |
104 | 103 |
|
105 | 104 | - `__init__(routes: dict[str, Callable[[Page, 'VirtualFletNavigator', tuple[Any], str], None]], route_changed_handler: Callable[[str], None]=None) -> None` - Initialize Virtual Flet Navigator. |
106 | 105 | - `navigate(route: str, page: Page, args: tuple[Any]=None) -> None` - Navigate to specific route. Specify `args` to transfer arguments to other page. |
107 | 106 | - `navigate_homepage(page: Page, args: tuple[Any]=None) -> None` - Navigate to homepage. |
108 | 107 | - `render(page: Page, args: tuple[Any]=None) -> None` - Render current route. If there is no route like that throw ROUTE-404 (if specified). Should be called only one time. |
109 | | - - `set_route_data(self, route: str, data: Any) -> int` - Set route data (cookies-like mechanism). Returns success/fail. |
110 | | - - `get_route_data(self, route: str) -> Any` - Get route data. |
111 | | - - `set_homepage(self, homepage: str) -> None` - Set homepage (main page). |
| 108 | + - `set_route_data(self, route: str, data: Any) -> int` - Set route data (cookies-like mechanism). Returns success/fail. More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. |
| 109 | + - `get_route_data(self, route: str) -> Any` - Get route data. More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. |
| 110 | + - `set_homepage(self, homepage: str) -> None` - Set homepage (main page). More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. |
112 | 111 |
|
113 | 112 | Using example: |
114 | 113 |
|
@@ -153,15 +152,16 @@ app(target=main) |
153 | 152 | - `routes_data: dict[str, Any] = {}` - Routes data. |
154 | 153 | - `homepage: str = '/'` - Homepage (main page). |
155 | 154 | - `fade_effect: bool = True` - Use fade effect when switching pages? BETA. |
| 155 | + - `appbars: dict[int, Control] = {}` - Dictionary of appbars for each page (ID). |
156 | 156 | - `route_changed_handler: RouteChangedHandler = None` - Route changed handler.<br><br> |
157 | 157 |
|
158 | 158 | - `__init__(page: Page, routes: dict[str, Callable[[Page, 'VirtualFletNavigator', tuple[Any], str], None]], route_changed_handler: Callable[[str], None]=None) -> None` - Initialize Flet Navigator. |
159 | 159 | - `navigate(route: str, page: Page, args: tuple[Any]=None) -> None` - Navigate to specific route. Specify `args` to transfer arguments to other page. |
160 | 160 | - `navigate_homepage(page: Page, args: tuple[Any]=None) -> None` - Navigate to homepage (main page). |
161 | 161 | - `render(page: Page, args: tuple[Any]=None, route_parameters: dict[str, Any]={}) -> None` - Render current route. If there is no route like that throw ROUTE-404 (if specified). Should be called only one time. |
162 | | - - `set_route_data(route: str, data: Any) -> int` - Set route data (cookies-like mechanism). Returns success/fail. |
163 | | - - `get_route_data(route: str) -> Any` - Get route data. |
164 | | - - `set_homepage(homepage: str) -> None` - Set homepage (main page). |
| 162 | + - `set_route_data(route: str, data: Any) -> int` - Set route data (cookies-like mechanism). Returns success/fail. More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. |
| 163 | + - `get_route_data(route: str) -> Any` - Get route data. More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. |
| 164 | + - `set_homepage(homepage: str) -> None` - Set homepage (main page). More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. |
165 | 165 |
|
166 | 166 | Using example: |
167 | 167 |
|
@@ -206,32 +206,17 @@ app(target=main, view=WEB_BROWSER) # Non-Virtual Navigator recommended in web. |
206 | 206 | - `arguments: Arguments = None` - Arguments sent from previous page. |
207 | 207 | - `previous_page: str = None` - Previous page. |
208 | 208 | - `parameters: dict[str, Any] = None` - URL parameters. (Always `None` if `VirtualFletNavigator` used). |
| 209 | + - `page_id: int = None` - Page ID.<br><br> |
209 | 210 |
|
210 | | -<hr> |
211 | | - |
212 | | -<h3 align="center"><code>template</code></h3> |
213 | | - |
214 | | -```template(template_definition: TemplateDefinition, page_data: PageData) -> Union[Control, None]``` |
215 | | - |
216 | | -Used to render template. Example:<br> |
217 | | - |
218 | | -```python |
219 | | -def go_to_button(pg: PageData, args: Arguments) -> None: |
220 | | - pg.page.add(FilledButton(args[0], on_click=lambda _: pg.navigator.navigate(args[1], pg.page, args[2]))) # Or return FilledButton so we can do things with button later. |
221 | | - |
222 | | -def main(pg: PageData) -> None: |
223 | | - pg.page.add(Text('Hello World!')) |
224 | | - |
225 | | - template(go_to_button, pg, ('Go to second page.', 'second_page', None)) |
226 | | -``` |
| 211 | + - `set_appbar(appbar: Control) -> None` - Set appbar for current page. More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. |
227 | 212 |
|
228 | 213 | <hr> |
229 | 214 |
|
230 | 215 | <h3 align="center"><code>define_page</code></h3> |
231 | 216 |
|
232 | | -```define_page(path: str, name: str=None) -> Callable[[PageData], None]``` |
| 217 | +```define_page(path: str, name: str=None) -> PageDefinition``` |
233 | 218 |
|
234 | | -Used to import page from other file. Example:<br><br> |
| 219 | +Used to import page from other file. More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. Example:<br><br> |
235 | 220 |
|
236 | 221 | `second_page.py` |
237 | 222 |
|
@@ -279,11 +264,29 @@ define_page('second_page', 'my_second_page_name') # => my_second_page_name |
279 | 264 |
|
280 | 265 | <hr> |
281 | 266 |
|
| 267 | +<h3 align="center"><code>template</code></h3> |
| 268 | + |
| 269 | +```template(template_definition: TemplateDefinition, page_data: PageData, arguments: Arguments=None) -> Union[Control, None]``` |
| 270 | + |
| 271 | +Used to render template. More <a href="github.com/xzripper/flet_navigator/issues/4#issuecomment-1817908000">detailed</a>. Example:<br> |
| 272 | + |
| 273 | +```python |
| 274 | +def go_to_button(pg: PageData, args: Arguments) -> None: |
| 275 | + pg.page.add(FilledButton(args[0], on_click=lambda _: pg.navigator.navigate(args[1], pg.page, args[2]))) # Or return FilledButton so we can do things with button later. |
| 276 | + |
| 277 | +def main(pg: PageData) -> None: |
| 278 | + pg.page.add(Text('Hello World!')) |
| 279 | + |
| 280 | + template(go_to_button, pg, ('Go to second page.', 'second_page', None)) # Out is FilledButton with text 'Go to second page.', and on click redirect to `second_page` happens. |
| 281 | +``` |
| 282 | + |
| 283 | +<hr> |
| 284 | + |
282 | 285 | <h3 align="center">Summary.</h3> |
283 | 286 | Summary! Now you know difference between virtual and non-virtual navigator, how to use navigator, etc! Good luck, have fun! But remember that project isn't finished!<br><br> |
284 | 287 |
|
285 | 288 | *Developer Note*: It would be great support for me if you'd added credits for FletNavigator! Optional! |
286 | 289 |
|
287 | 290 | <hr> |
288 | 291 |
|
289 | | -<p align="center"><b><i>FletNavigator V2.2.5</i></b></p> |
| 292 | +<p align="center"><b><i>FletNavigator V2.3.5</i></b></p> |
0 commit comments