44 lines
1.2 KiB
Dart
44 lines
1.2 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
import 'menu_content.dart';
|
||
|
import 'recipe.dart';
|
||
|
|
||
|
class RecipesContent implements MenuContent {
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
// Datenquelle exemplarisch definiert
|
||
|
List<Map<String, dynamic>> recipes = [
|
||
|
{"title": "Rezept 1", "image": "assets/images/burger.png"},
|
||
|
{"title": "Rezept 2", "image": "assets/images/spaghetti.png"},
|
||
|
// weitere Rezepte
|
||
|
];
|
||
|
|
||
|
return ListView.builder(
|
||
|
scrollDirection: Axis.horizontal,
|
||
|
itemCount: recipes.length,
|
||
|
itemBuilder: (BuildContext context, int index) {
|
||
|
return GestureDetector(
|
||
|
onTap: () {
|
||
|
Navigator.push(
|
||
|
context,
|
||
|
MaterialPageRoute(
|
||
|
builder: (context) => RecipeDetailPage(recipe: recipes[index]),
|
||
|
),
|
||
|
);
|
||
|
},
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(8.0),
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
Image.network(recipes[index]["image"], width: 100, height: 100),
|
||
|
Text(recipes[index]["title"]),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
},
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|