-
Notifications
You must be signed in to change notification settings - Fork 0
/
routing.py
49 lines (45 loc) · 1.43 KB
/
routing.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import flet as ft
from wicktionary import Wicktionary
class AppRouting(Wicktionary):
def __init__(self, page):
super().__init__(page)
# setting the routing variables
self.page.on_route_change = self.route_change
self.page.on_view_pop = self.view_pop
self.page.go(self.page.route)
# routing functionality
def route_change(self,route):
self.page.views.clear()
self.page.views.append(
ft.View(
"/",
[
self.welcome_page,
],
bgcolor="#038F75",
)
)
if self.page.route == "/homepage":
self.page.views.append(
ft.View(
"/homepage",
[
self.app_bar,
ft.Row(
[
self.search_word,
self.search_button
],
alignment="center"
),
self.definitions_list_view,
self.developer_view,
self.navigation_bar,
],
)
)
self.page.update()
def view_pop(self,view):
self.page.views.pop()
top_view = self.page.views[-1]
self.page.go(top_view.route)