restrict_spaceMemberUser_and_change_SignUpModel

This commit is contained in:
mohammad
2025-01-23 18:35:01 +03:00
parent 827585815b
commit 790479effb
20 changed files with 643 additions and 322 deletions
+39 -46
View File
@@ -1,69 +1,62 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
import 'package:syncrow_app/features/menu/bloc/menu_cubit.dart';
import 'package:syncrow_app/features/menu/view/widgets/menu_list.dart';
import 'package:syncrow_app/features/menu/view/widgets/profile/profile_tab.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
class MenuView extends StatelessWidget {
const MenuView({super.key});
const MenuView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (BuildContext context) => MenuCubit(),
create: (BuildContext context) => MenuCubit()..fetchMenuSections(),
child: BlocBuilder<MenuCubit, MenuState>(
builder: (context, state) {
return BlocBuilder<AuthCubit, AuthState>(
builder: (context, state) {
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
children: [
const ProfileTab(),
for (var section in menuSections)
MenuList(
section: section,
),
const SizedBox(
height: 15,
),
BodyMedium(text: dotenv.env['ENV_NAME'] ?? ''),
const SizedBox(
height: 15,
),
InkWell(
onTap: () {
AuthCubit.get(context).logout();
},
child: Row(
children: [
Expanded(
child: DefaultContainer(
child: Center(
child: BodyLarge(
text: 'Logout',
style: context.bodyLarge.copyWith(
color: Colors.red,
),
builder: (context, menuState) {
if (menuState is MenuLoading) {
return const Center(child: CircularProgressIndicator());
} else if (menuState is MenuError) {
return Center(child: Text(menuState.message));
} else if (menuState is MenuItemsLoaded) {
final sections = menuState.menuSections;
return SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Column(
children: [
const ProfileTab(),
for (var section in sections) MenuList(section: section),
const SizedBox(height: 15),
InkWell(
onTap: () {
AuthCubit.get(context).logout();
},
child: Row(
children: [
Expanded(
child: DefaultContainer(
child: Center(
child: BodyLarge(
text: 'Logout',
style: context.bodyLarge.copyWith(
color: Colors.red,
),
),
),
),
],
),
)
],
),
);
},
);
),
],
),
),
],
),
);
}
// Fallback in case no states match
return const SizedBox.shrink();
},
),
);