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

47 lines
1.6 KiB
Dart
Raw Normal View History

2023-05-29 22:04:44 +02:00
import 'package:ernaehrung/android/components/card/card_food_item_component.dart';
import 'package:ernaehrung/android/models/food.dart';
import 'package:flutter/material.dart';
class CardDataFoodComponent extends StatelessWidget {
final List<Food> foods;
2023-06-02 19:21:06 +02:00
final Color color;
2023-05-29 22:04:44 +02:00
2023-06-02 19:21:06 +02:00
const CardDataFoodComponent(this.foods,this.color, {Key? key,}) : super(key: key);
2023-05-29 22:04:44 +02:00
@override
Widget build(BuildContext context) {
2023-06-02 19:21:06 +02:00
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
child: foods.isNotEmpty ?
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: foods.length,
itemBuilder: (context, i) {
return Column(
children: [
CardFoodItemComponent(foods[i]),
Divider(
color: Colors.grey.shade300,
thickness: 1.2,
)
],
);
})
],
)
: const Center(
child: Text(
"Füge jetzt neue Gerichte hinzu!",
style: TextStyle(
fontSize: 14,
color: Colors.white
),
)
2023-06-02 19:21:06 +02:00
));
2023-05-29 22:04:44 +02:00
}
}