From c1df09e55b31665fd1286d885c9873c541a9b9e9 Mon Sep 17 00:00:00 2001 From: SomnusVeritas Date: Mon, 2 Oct 2023 19:09:09 +0200 Subject: [PATCH] Added create recipe page --- lib/main.dart | 2 ++ lib/pages/create_recipe_page.dart | 15 +++++++++++++++ lib/pages/dashboard_page.dart | 9 +++++++++ 3 files changed, 26 insertions(+) create mode 100644 lib/pages/create_recipe_page.dart diff --git a/lib/main.dart b/lib/main.dart index 04b2391..2dc8aaa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:rezepte/pages/create_recipe_page.dart'; import 'package:rezepte/pages/dashboard_page.dart'; import 'theme.dart'; @@ -18,6 +19,7 @@ class MyApp extends StatelessWidget { darkTheme: darkTheme, routes: { Dashboard.routeName: (_) => const Dashboard(), + CreateRecipe.routeName: (_) => const CreateRecipe(), }, ); } diff --git a/lib/pages/create_recipe_page.dart b/lib/pages/create_recipe_page.dart new file mode 100644 index 0000000..d91181a --- /dev/null +++ b/lib/pages/create_recipe_page.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class CreateRecipe extends StatelessWidget { + const CreateRecipe({super.key}); + static const routeName = '/createRecipe'; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Create Recipe'), + ), + ); + } +} diff --git a/lib/pages/dashboard_page.dart b/lib/pages/dashboard_page.dart index def6d99..63679b9 100644 --- a/lib/pages/dashboard_page.dart +++ b/lib/pages/dashboard_page.dart @@ -1,15 +1,24 @@ import 'package:flutter/material.dart'; +import 'package:rezepte/pages/create_recipe_page.dart'; class Dashboard extends StatelessWidget { const Dashboard({super.key}); + static const routeName = '/'; + void _onAddTapped(BuildContext context) => + Navigator.of(context).pushNamed(CreateRecipe.routeName); + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Dashboard'), ), + floatingActionButton: FloatingActionButton( + onPressed: () => _onAddTapped(context), + child: const Icon(Icons.add), + ), ); } }