import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/theme/custom_text_style.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/recipe/presentation/cubit/my_recipes_cubit/my_recieps_cubit.dart'; import 'package:eatvio_app/features/recipe/presentation/cubit/my_recipes_cubit/my_recipes_state.dart'; import 'package:eatvio_app/features/recipe/presentation/widgets/my_recipe_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class MyRecipesScreen extends StatelessWidget { const MyRecipesScreen({super.key}); static const name = 'myRecipesScreen'; static const path = '/my-recipes-screen'; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: appTheme.gray100, appBar: AppBar( centerTitle: true, title: Text( 'Мои рецепты', maxLines: 2, textAlign: TextAlign.center, overflow: TextOverflow.ellipsis, softWrap: true, style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black), ), ), body: BlocProvider( create: (BuildContext context) => sl()..getMyRecipes(), child: BlocBuilder( builder: (BuildContext context, MyRecipesState state) { if (state is MyRecipesStateLoaded) { return ListView.separated( padding: const EdgeInsets.symmetric(vertical: 16), itemBuilder: (context, index) => MyRecipeWidget(recipe: state.recipes[index]), separatorBuilder: (context, index) => const SizedBox(height: 12), itemCount: state.recipes.length, ); } return Container(); }, ), ), ); } }