kochkomplize/lib/menu.dart

45 lines
1.3 KiB
Dart
Raw Permalink Normal View History

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: <Widget>[
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, 'Meine Rezepte'),
_buildListTile(context, 'Rezept importieren'),
_buildListTile(context, 'Texterkennung Bild'),
_buildListTile(context, '(Beta) Rezepte finden'),
// Füge hier weitere ListTiles für zusätzliche Menüpunkte hinzu
],
),
);
}
Widget _buildListTile(BuildContext context, String title) {
return Container(
color: Colors.white54,
child: ListTile(
title: Text(title),
onTap: () {
onMenuItemSelected(title);
Navigator.pop(context);
},
),
);
}
}