import 'package:flutter/material.dart'; class Menu extends StatelessWidget { final Function(String) onMenuItemSelected; const Menu({Key? key, required this.onMenuItemSelected}) : super(key: key); @override Widget build(BuildContext context) { return Drawer( child: ListView( padding: EdgeInsets.zero, children: [ SizedBox( height: AppBar().preferredSize.height, child: const DrawerHeader( decoration: BoxDecoration( color: Colors.greenAccent, ), child: Text('Hauptmenü', style: TextStyle(color: Colors.black, fontSize: 20.0)), ), ), _buildListTile(context, 'Startseite'), _buildListTile(context, 'Meine Rezepte'), //_buildListTile(context, 'Rezept importieren'), //_buildListTile(context, 'Texterkennung Bild'), //_buildListTile(context, '(Beta) Rezepte finden'), ], ), ); } Widget _buildListTile(BuildContext context, String title) { return Container( color: Colors.white54, child: ListTile( title: Text(title), onTap: () { onMenuItemSelected(title); Navigator.pop(context); }, ), ); } }