Added app bar to select apps
This commit is contained in:
39
src/main.py
39
src/main.py
@@ -1,26 +1,29 @@
|
|||||||
import flet as ft
|
import flet as ft
|
||||||
|
from MealBuilder import builder
|
||||||
|
from MealSelector import selector
|
||||||
|
|
||||||
|
|
||||||
def main(page: ft.Page):
|
def main(page: ft.Page):
|
||||||
counter = ft.Text("0", size=50, data=0)
|
main_appbar = ft.AppBar(
|
||||||
|
title=ft.Text("Meal Picker"),
|
||||||
def increment_click(e):
|
bgcolor=ft.Colors.GREEN_700,
|
||||||
counter.data += 1
|
center_title=False,
|
||||||
counter.value = str(counter.data)
|
actions=[
|
||||||
counter.update()
|
ft.PopupMenuButton(
|
||||||
|
items=[
|
||||||
page.floating_action_button = ft.FloatingActionButton(
|
ft.PopupMenuItem(text="Meal Selector", on_click=lambda e: selector(page)),
|
||||||
icon=ft.Icons.ADD, on_click=increment_click
|
ft.PopupMenuItem(text="Meal Builder", on_click=lambda e: builder(page)),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
)
|
)
|
||||||
page.add(
|
|
||||||
ft.SafeArea(
|
page.appbar = main_appbar
|
||||||
ft.Container(
|
|
||||||
counter,
|
page.add(ft.Pagelet(
|
||||||
alignment=ft.alignment.center,
|
content = ft.Text("Welcome to Meal Picker! Please select an option from the menu above to get started.")
|
||||||
),
|
|
||||||
expand=True,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
ft.app(main)
|
ft.app(main)
|
||||||
Reference in New Issue
Block a user