import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/utils/localization_utils.dart'; import 'package:eatvio_app/core/widgets/main_background_bouble.dart'; import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:eatvio_app/features/feed/models/recipes_model.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:flutter/material.dart'; class IngredientsWidget extends StatelessWidget { const IngredientsWidget({super.key, required this.recipe}); final Recipe recipe; @override Widget build(BuildContext context) { final s = S.of(context); return MainBackgroundBouble( child: ExpansionTile( initiallyExpanded: true, shape: Border(), title: Text( s.ingredients, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), children: List.generate(recipe.ingredients!.length, (index) { return Padding( padding: const EdgeInsets.only(left: 16, bottom: 8), child: Row( children: [ Container( width: 4, height: 4, decoration: BoxDecoration( color: appTheme.black, shape: BoxShape.circle, ), ), SizedBox(width: 4), Builder( builder: (context) { final portion = Portion.getPortionFromValue(recipe.ingredients![index].unit ?? ''); String? portionName; if (portion != null) { portionName = getLocalizedMeasurementUnits(s, portion); } return Text( '${recipe.ingredients![index].name} - ${recipe.ingredients![index].portion} ${portionName}', style: TextStyles.textMMedium.copyWith(color: appTheme.black), ); }, ), ], ), ); }), ), ); } }