import 'package:basic_utils/basic_utils.dart'; import 'package:ernaehrung/android/components/card/card_data_food_component.dart'; import 'package:ernaehrung/android/components/card/card_title_component.dart'; import 'package:ernaehrung/android/config/cast_helper.dart'; import 'package:flutter/material.dart'; import '../../models/food.dart'; import '../../pages/nav_pages/search_food.dart'; class CardComponent extends StatelessWidget { final String title; final Color color; final List foods; const CardComponent(this.title, this.foods, {super.key, Color? color}) : color = color ?? Colors.black; Route createRoute(String cardName) { return PageRouteBuilder( pageBuilder: (context, animation, secondaryAnimation) => SearchFoodPage(cardName), transitionsBuilder: (context, animation, secondaryAnimation, child) { const begin = Offset(0.0, 1.0); const end = Offset.zero; const curve = Curves.ease; var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); return SlideTransition( position: animation.drive(tween), child: child, ); }, ); } int countCalories(List foods){ int summary = 0; for(int i=0; i