29 lines
820 B
Dart
29 lines
820 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:kalodings/food_entry_bloc.dart';
|
|
import 'package:kalodings/row_with_spacers_widget.dart';
|
|
|
|
class FoodEntryWidget extends StatelessWidget {
|
|
final FoodEntry entry;
|
|
final Function(BuildContext context) onDelete;
|
|
|
|
const FoodEntryWidget(
|
|
{super.key, required this.entry, required this.onDelete});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
child: RowWidgetWithSpacers(
|
|
Text(entry.name),
|
|
Text(entry.mass.toString()),
|
|
Text(entry.kcalPerMass.toString()),
|
|
Text((entry.mass * entry.kcalPerMass / 100).toString()),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
onDelete(context);
|
|
},
|
|
child: const Icon(Icons.delete_forever_rounded)),
|
|
),
|
|
);
|
|
}
|
|
}
|