Comments (5)
Its not hard to implement, I'll add opportunity to display AppBar only is selected pages.
from flet_navigator.
Also, it would be helpful if you could have examples
to show how to :
(1) use functions in actual actions like:
Define_ page
render
set_route_data
get_route_data
set_homepage
(2) what if Homepage, second_page, third_page … are in separate py files.
Thanks again. I find this package is very intuitive and easy to use to beginners.
from flet_navigator.
Thanks a lot, much appreciated! In the v2.3.5
release the problem with the AppBar is fixed by hooking each AppBar to the page ID. (pip install flet_navigator --upgrade
)
def main_page(pg: PageData) -> None:
pg.page.set_appbar(my_appbar) # Appbar is going to be displayed.
def second_page(pg: PageData) -> None:
... # Appbar isn't going to be displayed.
def third_appbar(pg: PageData) -> None:
pg.page.set_appbar(my_appbar) # If you don't wanna copy & paste AppBar each time, you can write AppBar template and use it everywhere. # Appbar is going to be displayed.
define_page
Documentation:
https://github.com/xzripper/flet_navigator/blob/main/flet-navigator-docs.md#define_page
define_page
used to import page from other .py
file.
flet_navigator = FletNavigator(page,
{
'/': main_page,
'second_page': define_page('second_page') # Auto imports `second_page` function from `second_page.py`.
})
second_page.py
# from flet import
from flet_navigator import PageData
def second_page(pg: PageData) -> None:
... # Second page content.
render
render
function shouldn't be called by user.
set_route_data
Save server data on route. Its similar to Flet session
(but data saved for this route is global, for all users).
users_visited_main_page = pg.navigator.get_route_data('/')
if users_visited_main_page == None:
users_visited_main_page = 1
else:
users_visited_main_page += 1
pg.navigator.set_route_data('/', users_visited_main_page)
get_route_data
Get server data on route. Returns data saved on this route.
pg.page.add(Text(f'Users visited this page: {pg.navigator.get_route_data("/")}.'))
set_homepage
You can set homepage with this function (pg.navigator.set_homepage('/')
), and later instead of using pg.navigator.navigate(home_page, pg.page)
, you can use pg.navigator.navigate_homepage(pg.page)
I also updated documentation: https://github.com/xzripper/flet_navigator/blob/main/flet-navigator-docs.md
from flet_navigator.
Thanks for reporting! I'll release patch that fixes this issue in the near future!
from flet_navigator.
But in some cases, appbar again needs to be displayed in other pages anyway. So it would be better to have an option? That might make things a bit complicated.
from flet_navigator.
Related Issues (11)
- I can't upload an image in any PageData.. HOT 4
- [ISSUE] Container "expand=True" doesn't work HOT 22
- A possible performance issue when returning to the previous page HOT 5
- [ISSUE] HOT 4
- flet_navigator error HOT 10
- docs not complete why my app blank white HOT 10
- [ISSUE] HOT 1
- [ISSUE] HOT 9
- __init__.py bug HOT 1
- NavigationBar not showing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flet_navigator.