fooder-app/lib/widgets/entry.dart

42 lines
1.1 KiB
Dart
Raw Normal View History

2023-07-29 19:21:02 +02:00
import 'package:flutter/material.dart';
2023-07-30 15:31:36 +02:00
import 'package:fooder/models/entry.dart';
import 'package:fooder/widgets/macro.dart';
2023-07-29 19:21:02 +02:00
import 'dart:core';
class EntryWidget extends StatelessWidget {
final Entry entry;
const EntryWidget({super.key, required this.entry});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(8),
2023-07-29 23:54:51 +02:00
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Text(
entry.product.name,
style: Theme.of(context).textTheme.titleLarge,
),
),
Text("${entry.calories.toStringAsFixed(1)} kcal"),
2023-07-29 23:54:51 +02:00
],
),
MacroWidget(
protein: entry.protein,
carb: entry.carb,
fat: entry.fat,
amount: entry.grams,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
2023-08-28 14:45:32 +02:00
color: Theme.of(context).colorScheme.secondary,
),
2023-07-29 23:54:51 +02:00
),
],
),
2023-07-29 19:21:02 +02:00
);
}
}