Flutter-Ernaehrungsapp/lib/android/components/card/card_food_item_component.dart

36 lines
1.0 KiB
Dart

import 'package:ernaehrung/android/models/food.dart';
import 'package:flutter/material.dart';
class CardFoodItemComponent extends StatelessWidget {
final Food food;
const CardFoodItemComponent(this.food, {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(
food.name.toString(),
style: const TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
),
softWrap: true,
maxLines: 2,
),
Text(
"\n${food.calories.toString()} kcal | 100g",
style: const TextStyle(color: Colors.white),
),
],
));
}
}