2024-08-14 17:38:29 +00:00
|
|
|
import 'package:dietary_guard/models/food_data.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
class FoodDetailsScreen extends StatelessWidget {
|
|
|
|
final FoodData item;
|
|
|
|
|
|
|
|
const FoodDetailsScreen({super.key, required this.item});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2024-08-15 03:53:01 +00:00
|
|
|
return Material(
|
|
|
|
color: Theme.of(context).colorScheme.surface,
|
|
|
|
child: Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
title: Text(item.description),
|
|
|
|
),
|
|
|
|
body: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text('nutrients'.tr).paddingOnly(left: 24, right: 24, bottom: 8),
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: item.foodNutrients.length,
|
|
|
|
itemBuilder: (context, idx) {
|
|
|
|
final entry = item.foodNutrients[idx];
|
|
|
|
final unitName = unitNameValues.reverse[entry.unitName];
|
|
|
|
return ListTile(
|
|
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 24),
|
|
|
|
title: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(entry.nutrientName),
|
|
|
|
const SizedBox(width: 6),
|
|
|
|
Badge(label: Text('#${entry.nutrientId}'))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
subtitle: Text('${entry.nutrientNumber} ${unitName}'),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
).paddingSymmetric(vertical: 24),
|
2024-08-14 17:38:29 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|