forked from eatvio/eatvio_app
feat: Introduce user-generated content features, including recipe creation and management, and blog post creation.
This commit is contained in:
@@ -33,39 +33,40 @@ class MyRecipesScreen extends StatelessWidget {
|
||||
create: (BuildContext context) => sl<MyRecipesCubit>()..getMyRecipes(),
|
||||
child: BlocBuilder<MyRecipesCubit, MyRecipesState>(
|
||||
builder: (BuildContext context, MyRecipesState state) {
|
||||
return Column(
|
||||
return Stack(
|
||||
children: [
|
||||
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();
|
||||
}
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
Positioned.fill(
|
||||
child: state is MyRecipesStateLoaded
|
||||
? state.recipes.isEmpty
|
||||
? Center(
|
||||
child: Text(
|
||||
state.selectedState == MyRecipesCubit.drafted
|
||||
? 'Нет черновиков'
|
||||
: 'Нет опубликованных рецептов',
|
||||
style: TextStyles.textLMedium.copyWith(color: appTheme.gray500),
|
||||
),
|
||||
)
|
||||
: 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,
|
||||
)
|
||||
? Center(
|
||||
child: Text(
|
||||
state.selectedState == MyRecipesCubit.drafted ? 'Нет черновиков' : 'Нет опубликованных рецептов',
|
||||
style: TextStyles.textLMedium.copyWith(color: appTheme.gray500),
|
||||
),
|
||||
)
|
||||
: ListView.separated(
|
||||
padding: const EdgeInsets.only(top: 80, bottom: 16),
|
||||
itemBuilder: (context, index) => MyRecipeWidget(recipe: state.recipes[index]),
|
||||
separatorBuilder: (context, index) => const SizedBox(height: 12),
|
||||
itemCount: state.recipes.length,
|
||||
)
|
||||
: const Center(child: CircularProgressIndicator()),
|
||||
),
|
||||
Positioned(
|
||||
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();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user