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