43 lines
1.2 KiB
Dart
43 lines
1.2 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: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
children: [
|
||
|
Expanded(
|
||
|
flex: 6,
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Text(
|
||
|
food.name.toString(),
|
||
|
style: const TextStyle(color: Colors.white),
|
||
|
softWrap: true,
|
||
|
),
|
||
|
Text(
|
||
|
food.calories.toString(),
|
||
|
style: const TextStyle(color: Colors.white),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Expanded(
|
||
|
flex: 1, child: TextButton(onPressed: () {}, child: Text("+")))
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|