68 lines
1.5 KiB
Dart
68 lines
1.5 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'menu.dart';
|
||
|
import 'menu_content.dart';
|
||
|
import 'recipes.dart';
|
||
|
|
||
|
void main() {
|
||
|
runApp(const MyApp());
|
||
|
}
|
||
|
|
||
|
class MyApp extends StatelessWidget {
|
||
|
const MyApp({super.key});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return MaterialApp(
|
||
|
title: 'Kochkomplize',
|
||
|
theme: ThemeData(
|
||
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.greenAccent),
|
||
|
useMaterial3: true,
|
||
|
),
|
||
|
home: const MyHomePage(title: 'Kochkomplize'),
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class MyHomePage extends StatefulWidget {
|
||
|
const MyHomePage({super.key, required this.title});
|
||
|
|
||
|
final String title;
|
||
|
|
||
|
@override
|
||
|
State<MyHomePage> createState() => _MyHomePageState();
|
||
|
}
|
||
|
|
||
|
class _MyHomePageState extends State<MyHomePage> {
|
||
|
MenuContent? _selectedMenuContent;
|
||
|
|
||
|
void _onMenuItemSelected(String menuItem) {
|
||
|
setState(() {
|
||
|
switch (menuItem) {
|
||
|
case 'Meine Rezepte':
|
||
|
_selectedMenuContent = RecipesContent();
|
||
|
break;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
void _importImage() {
|
||
|
//todo
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
||
|
title: Text(widget.title),
|
||
|
),
|
||
|
drawer: Menu(onMenuItemSelected: _onMenuItemSelected),
|
||
|
body: _selectedMenuContent?.build(context) ?? Container(),
|
||
|
floatingActionButton: FloatingActionButton(
|
||
|
onPressed: _importImage,
|
||
|
tooltip: 'Import',
|
||
|
child: const Icon(Icons.add),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|