fooder-app/lib/widgets/product.dart

43 lines
1.1 KiB
Dart
Raw Normal View History

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,
),
),
Text("${product.calories.toStringAsFixed(1)} kcal"),
2023-07-29 23:54:51 +02:00
],
),
MacroWidget(
protein: product.protein,
carb: product.carb,
fat: product.fat,
2023-07-30 20:44:50 +02:00
fiber: product.fiber,
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
),
],
),
);
}
}