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