forked from eatvio/eatvio_app
feat: Add MyRecipesScreen to display user's recipes, manage active/drafted states, and navigate to recipe creation.
This commit is contained in:
@@ -7,6 +7,8 @@ import 'package:eatvio_app/features/recipe/presentation/widgets/my_recipe_widget
|
||||
import 'package:eatvio_app/features/recipe/presentation/widgets/my_recipes_tab.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:eatvio_app/features/create_recipe/presentation/pages/recipe_create_screen.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
class MyRecipesScreen extends StatelessWidget {
|
||||
const MyRecipesScreen({super.key});
|
||||
@@ -56,15 +58,41 @@ class MyRecipesScreen extends StatelessWidget {
|
||||
top: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: MyRecipesTab(
|
||||
selectedIndex: state is MyRecipesStateLoaded ? (state.selectedState == MyRecipesCubit.drafted ? 1 : 0) : 0,
|
||||
onTabChanged: (index) {
|
||||
if (index == 0) {
|
||||
context.read<MyRecipesCubit>().setActiveState();
|
||||
} else {
|
||||
context.read<MyRecipesCubit>().setDraftedState();
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: MyRecipesTab(
|
||||
selectedIndex: state is MyRecipesStateLoaded ? (state.selectedState == MyRecipesCubit.drafted ? 1 : 0) : 0,
|
||||
onTabChanged: (index) {
|
||||
if (index == 0) {
|
||||
context.read<MyRecipesCubit>().setActiveState();
|
||||
} else {
|
||||
context.read<MyRecipesCubit>().setDraftedState();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
context.push(RecipeCreateScreen.path);
|
||||
},
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
child: Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: appTheme.blueA400,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: appTheme.whiteA700,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user