import 'package:flutter/material.dart'; class CardFoodItemComponent extends StatelessWidget { final String foodName; final List countAndCalories; // [count, calories] const CardFoodItemComponent(this.foodName,this.countAndCalories, {Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Container( margin: const EdgeInsets.fromLTRB(0, 8, 0, 4), width: double.infinity, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "$foodName - ${countAndCalories[0] * 100}g", style: const TextStyle( color: Colors.white, fontSize: 17, fontWeight: FontWeight.bold, ), softWrap: true, maxLines: 2, ), Text( "\n${countAndCalories[1]} kcal | 100g", style: const TextStyle(color: Colors.white), ), ], )); } }