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;
|
|
|
|
|
|
|
|
const CardDataFoodComponent(this.foods, {Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-06-01 11:46:53 +02:00
|
|
|
return SizedBox(
|
2023-05-29 22:04:44 +02:00
|
|
|
height: 180,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
|
2023-06-02 00:38:19 +02:00
|
|
|
child: foods.isNotEmpty
|
|
|
|
? SingleChildScrollView(
|
|
|
|
child: 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(
|
|
|
|
"Die Liste ist momentan leer, aber Sie können sie ändern!"),
|
|
|
|
)),
|
2023-05-29 22:04:44 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|