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

36 lines
1.1 KiB
Dart
Raw Normal View History

2023-05-29 22:04:44 +02:00
import 'package:flutter/material.dart';
class CardFoodItemComponent extends StatelessWidget {
2023-06-02 20:02:32 +02:00
final String foodName;
final List<int> countAndCalories; // [count, calories]
2023-05-29 22:04:44 +02:00
2023-06-02 20:02:32 +02:00
const CardFoodItemComponent(this.foodName,this.countAndCalories, {Key? key}) : super(key: key);
2023-05-29 22:04:44 +02:00
@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(
2023-06-02 20:02:32 +02:00
"$foodName - ${countAndCalories[0] * 100}g",
2023-06-02 19:21:06 +02:00
style: const TextStyle(
color: Colors.white,
fontSize: 17,
fontWeight: FontWeight.bold,
),
softWrap: true,
2023-06-02 19:21:06 +02:00
maxLines: 2,
2023-05-29 22:04:44 +02:00
),
Text(
2023-06-02 20:02:32 +02:00
"\n${countAndCalories[1]} kcal | 100g",
style: const TextStyle(color: Colors.white),
),
],
));
2023-05-29 22:04:44 +02:00
}
}