Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
48 kB
3
Indexable
Never
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:networked_mobile/apis/interfaces/deeplink/invite_community_detail/invite_community_detail_response.dart';
import 'package:networked_mobile/screens/chat/model/chat_screen_dm.dart';
import 'package:networked_mobile/screens/chat/view/channelmembers/model/channel_member_dm.dart';
import 'package:networked_mobile/screens/chat/view/channelmembers/view/channel_member_screen.dart';
import 'package:networked_mobile/screens/chat/view/chat_screen.dart';
import 'package:networked_mobile/screens/chat/view/files/view/files_screen.dart';
import 'package:networked_mobile/screens/chat/view/pin/view/pinned_post_screen.dart';
import 'package:networked_mobile/screens/chat/widgets/preview/image/preview_image_view.dart';
import 'package:networked_mobile/screens/chatthread/model/chat_thread_dm.dart';
import 'package:networked_mobile/screens/chatthread/model/image_preview_dm.dart';
import 'package:networked_mobile/screens/chatthread/view/chat_thread_screen.dart';
import 'package:networked_mobile/screens/directory/views/directory_view.dart';
import 'package:networked_mobile/screens/eventdetails/model/event_details_dm.dart';
import 'package:networked_mobile/screens/eventdetails/view/sortedevents/event_details_screen.dart';
import 'package:networked_mobile/screens/events_advanced_screen/views/event_attendance_detail.dart';
import 'package:networked_mobile/screens/events_advanced_screen/views/events_advanced_page_view.dart';
import 'package:networked_mobile/screens/events_advanced_screen/views/events_v2_screen.dart';
import 'package:networked_mobile/screens/explore_page/views/explore_communities_view/explore_communities_view.dart';
import 'package:networked_mobile/screens/group_listing/model/group_listing_dm.dart';
import 'package:networked_mobile/screens/group_listing/view/specificgroupalllisting/all_category_group_view.dart';
import 'package:networked_mobile/screens/home_feed_screen/views/home_feed_screen.dart';
import 'package:networked_mobile/screens/home_feed_screen/views/home_screen.dart';
import 'package:networked_mobile/screens/invitations/view/invitations_screen.dart';
import 'package:networked_mobile/screens/invitepeople/view/invite_email_people_bottomsheet_view.dart';
import 'package:networked_mobile/screens/invitepeople/view/invite_people_screen.dart';
import 'package:networked_mobile/screens/invitepeople/widget/user_role_bottom_sheet.dart';
import 'package:networked_mobile/screens/login_screen/model/login_dm.dart';
import 'package:networked_mobile/screens/login_screen/views/phonenumber_view.dart';
import 'package:networked_mobile/screens/media_center/views/media_center_page_view.dart';
import 'package:networked_mobile/screens/message/view/message_chat_list.dart';
import 'package:networked_mobile/screens/message/view/newmessage/view/new_message_screen.dart';
import 'package:networked_mobile/screens/notifications/views/notification_preferences_view.dart';
import 'package:networked_mobile/screens/post/model/ask_and_offer_model.dart';
import 'package:networked_mobile/screens/post/widget/ask_offer_help/post_other_views_dialog.dart';
import 'package:networked_mobile/screens/postdetails/model/post_details_dm.dart';
import 'package:networked_mobile/screens/postdetails/view/post_detail_screen.dart';
import 'package:sheet/route.dart';

import '../../apis/interfaces/deeplink/invite_login/invite_login_response.dart';
import '../../screens/community_profile/views/community_profile_new_view.dart';
import '../../screens/createcommunity/views/createcommunityonboarding.dart';
import '../../screens/events_advanced_screen/models/events_attendance_dm.dart';
import '../../screens/group/model/group_dm.dart';
import '../../screens/group/view/groups_new_home_screen.dart';
import '../../screens/group/widgets/post/group_post_screen.dart';
import '../../screens/group_features/add_group/view/add_group_screen.dart';
import '../../screens/group_listing/view/group_list_screen.dart';
import '../../screens/home_feed_screen/views/gallery/photo_gallery_view.dart';
import '../../screens/invitations/model/invitation_dm.dart';
import '../../screens/invitepeople/view/invite_link_settings_bottamsheet.dart';
import '../../screens/login_screen/login_screen.dart';
import '../../screens/login_screen/views/social_login_screen.dart';
import '../../screens/media_center/models/media_center_content_list.dart';
import '../../screens/media_center/widget/media_center_image_preview.dart';
import '../../screens/message/model/message_direct_messages_dm.dart';
import '../../screens/post/views/create_post_screen.dart';
import '../../screens/postdetails/view/group_post_detail_screen.dart';
import '../../screens/profile/view/groups_other_profile_view.dart';
import '../../screens/profile/view/other_profile_view.dart';
import '../../screens/profile/view/profile_edit_view.dart';
import '../../screens/settings/chat_settings_screen.dart';
import '../../screens/splash/view/splash_screen.dart';
import 'app_routes.dart';

CupertinoPageTransition buildPageWithDefaultTransition({
  required BuildContext context,
  required GoRouterState state,
  required Widget child,
}) {
  return CupertinoPageTransition(
      primaryRouteAnimation: CurvedAnimation(
          parent: kAlwaysCompleteAnimation, curve: Curves.easeInOut),
      secondaryRouteAnimation: CurvedAnimation(
          parent: kAlwaysCompleteAnimation, curve: Curves.easeInOut),
      child: child,
      linearTransition: true);
}

class AppPages {
  static final GoRouter list = GoRouter(
    errorBuilder: (context, state) => HomeScreen(),
    observers: [
      FirebaseAnalyticsObserver(analytics: FirebaseAnalytics.instance)
    ],
    routes: <GoRoute>[
      GoRoute(
        path: '/',
        name: AppRoutes.splashScreen,
        // pageBuilder: (context, state) {
        //   Object? deepLink = state.extra;
        //   return buildPageWithDefaultTransition(
        //       context: context,
        //       state: state,
        //       child: SplashScreen(
        //         deepLink: deepLink.toString(),
        //       ));
        // },
        builder: (BuildContext context, GoRouterState state) {
          Object? deepLink = state.extra;
          return buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: SplashScreen(
                deepLink: deepLink.toString(),
              ));
        },
      ),
      GoRoute(
        path: "/${AppRoutes.phonescreen}",
        name: AppRoutes.phonescreen,
        builder: (BuildContext context, GoRouterState state) {
          return buildPageWithDefaultTransition(
              context: context, state: state, child: PhonenumberView());
        },
      ),
      GoRoute(
        path: "/${AppRoutes.authScreen}/:${RouteParams.authPage}",
        name: AppRoutes.authScreen,

        // pageBuilder: (context, state) {
        //   Object? inviteLoginResponse = state.extra;
        //   String page = state.params[RouteParams.authPage]!;
        //   int loginpage = page.split(" ").first == 'login'
        //       ? int.parse(page.split(" ").last)
        //       : 0;
        //   return buildPageWithDefaultTransition(
        //       context: context,
        //       state: state,
        //       child: LoginScreen(
        //         page: page,
        //         loginpage: loginpage,
        //         inviteLoginResponse: inviteLoginResponse != null
        //             ? (inviteLoginResponse as InviteLoginResponse)
        //             : null,
        //       ));
        // },
        builder: (BuildContext context, GoRouterState state) {
          Object? inviteLoginResponse = state.extra;
          String page = state.params[RouteParams.authPage]!;
          int loginpage = page.split(" ").first == 'login'
              ? int.parse(page.split(" ").last)
              : 0;
          print(page);
          print(loginpage.toString());
          return buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: LoginScreen(
                  page: page,
                  loginpage: loginpage,
                  inviteLoginResponse: inviteLoginResponse != null
                      ? (inviteLoginResponse as InviteLoginResponse)
                      : null));
        },
      ),
      GoRoute(
        path: "/${AppRoutes.socialLoginScreen}",
        name: AppRoutes.socialLoginScreen,
        // pageBuilder: (context, state) {
        //   Object? inviteCommunityDetailResponse = state.extra;
        //   return buildPageWithDefaultTransition(
        //       context: context,
        //       state: state,
        //       child: SocialLoginScreen(
        //         inviteCommunityDetailResponse:
        //             inviteCommunityDetailResponse != null
        //                 ? (inviteCommunityDetailResponse
        //                     as InviteCommunityDetailResponse)
        //                 : null,
        //       ));
        // },
        builder: (BuildContext context, GoRouterState state) {
          Object? inviteCommunityDetailResponse = state.extra;
          return buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: SocialLoginScreen(
                inviteCommunityDetailResponse:
                    inviteCommunityDetailResponse != null
                        ? (inviteCommunityDetailResponse
                            as InviteCommunityDetailResponse)
                        : null,
              ));
        },
      ),
      GoRoute(
        path: "/${AppRoutes.homeScreen}",
        name: AppRoutes.homeScreen,
        // pageBuilder: (context, state) => buildPageWithDefaultTransition(
        //     context: context, state: state, child: HomeScreen()),
        builder: (BuildContext context, GoRouterState state) {
          return buildPageWithDefaultTransition(
              context: context, state: state, child: HomeScreen());
        },
        routes: [
          GoRoute(
            path: AppRoutes.createCommunityOnBoarding,
            name: AppRoutes.createCommunityOnBoarding,
            // pageBuilder: (context, state) {
            //   Object communityId = state.extra as String;
            //   return buildPageWithDefaultTransition(
            //       context: context,
            //       state: state,
            //       child: CreateCommunityOnBoarding(
            //         communityId: communityId as String,
            //       ));
            // },
            builder: (BuildContext context, GoRouterState state) {
              Object communityId = state.extra as String;
              return buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: CreateCommunityOnBoarding(
                    communityId: communityId as String,
                  ));
            },
          ),
          GoRoute(
              path: "newMessage",
              name: AppRoutes.newMessagesScreen,
              // pageBuilder: (context, state) => buildPageWithDefaultTransition(
              //     context: context,
              //     state: state,
              //     child: const NewMessageScreen()),
              builder: (BuildContext context, GoRouterState state) =>
                  buildPageWithDefaultTransition(
                      context: context,
                      state: state,
                      child: NewMessageScreen())),
          GoRoute(
              path: "chat",
              name: AppRoutes.chat,
              // pageBuilder: (context, state) => buildPageWithDefaultTransition(
              //       context: context,
              //       state: state,
              //       child:
              //           ChatScreen(chatScreenDM: state.extra as ChatScreenDM),
              //     ),
              builder: (BuildContext context, GoRouterState state) =>
                  buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child:
                        ChatScreen(chatScreenDM: state.extra as ChatScreenDM),
                  ),
              routes: [
                GoRoute(
                  path: "pinnedPost",
                  name: AppRoutes.pinnedPostScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //   context: context,
                  //   state: state,
                  //   child: PinnedPostScreen(state.extra as DirectMessagesDM),
                  // ),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: PinnedPostScreen(state.extra as DirectMessagesDM),
                  ),
                ),
                GoRoute(
                  path: "files",
                  name: AppRoutes.filesScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //   context: context,
                  //   state: state,
                  //   child: FilesScreen(
                  //     directMessagesDM: state.extra as DirectMessagesDM,
                  //   ),
                  // ),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: FilesScreen(
                      directMessagesDM: state.extra as DirectMessagesDM,
                    ),
                  ),
                ),
                GoRoute(
                  path: "channelMembers",
                  name: AppRoutes.channelMemberScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //   context: context,
                  //   state: state,
                  //   child: ChannelMemberScreen(
                  //     channelMemberDM: state.extra as ChannelMemberDM,
                  //   ),
                  // ),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: ChannelMemberScreen(
                      channelMemberDM: state.extra as ChannelMemberDM,
                    ),
                  ),
                ),
                GoRoute(
                  path: "thread",
                  name: AppRoutes.threadScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //   context: context,
                  //   state: state,
                  //   child: ChatThreadScreen(
                  //     chatThreadDM: state.extra as ChatThreadDM,
                  //   ),
                  // ),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: ChatThreadScreen(
                      chatThreadDM: state.extra as ChatThreadDM,
                    ),
                  ),
                ),
                GoRoute(
                  path: "previewImageView",
                  name: AppRoutes.previewImageViewScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //   context: context,
                  //   state: state,
                  //   child: PreviewImageView(
                  //       imagePreviewDM: state.extra as ImagePreviewDM),
                  // ),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: PreviewImageView(
                        imagePreviewDM: state.extra as ImagePreviewDM),
                  ),
                ),
                GoRoute(
                  path: "postOtherViewsDialogScreen",
                  name: AppRoutes.postOtherViewsDialogScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //   context: context,
                  //   state: state,
                  //   child: PostOtherViewsDialog(
                  //       getAskAndOfferPrivilege:
                  //           state.extra as GetAskAndOfferPrivilege),
                  // ),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: PostOtherViewsDialog(
                        getAskAndOfferPrivilege:
                            state.extra as GetAskAndOfferPrivilege),
                  ),
                ),
                GoRoute(
                  path: "chatNotificationPreferences",
                  name: AppRoutes.chatNotificationPreferences,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //         context: context,
                  //         state: state,
                  //         child: const ChatSettingsScreen()),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: ChatSettingsScreen(),
                  ),
                ),
              ]),

          GoRoute(
              path: AppRoutes.homeFeedScreen,
              name: AppRoutes.homeFeedScreen,
              // pageBuilder: (context, state) => buildPageWithDefaultTransition(
              //     context: context,
              //     state: state,
              //     child: HomeFeedView(pageTitle: state.extra as String)),
              builder: (BuildContext context, GoRouterState state) {
                return buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: HomeFeedView(pageTitle: state.extra as String),
                );
              },
              routes: [
                GoRoute(
                  path: AppRoutes.homeUserProfileScreen,
                  name: AppRoutes.homeUserProfileScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //         context: context,
                  //         state: state,
                  //         child: const OtherUserProfileView()),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                          context: context,
                          state: state,
                          child: OtherUserProfileView()),
                ),
                GoRoute(
                  path: AppRoutes.postDetailsScreen,
                  name: AppRoutes.postDetailsScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //         context: context,
                  //         state: state,
                  //         child: PostDetailsScreen(
                  //           postContent: state.extra as PostDetailsDM,
                  //         )),
                  builder: (BuildContext context, GoRouterState state) {
                    // final pid = (state.extra as Map<String,dynamic>?)!['pid'];
                    return buildPageWithDefaultTransition(
                        context: context,
                        state: state,
                        child: PostDetailsScreen(
                          postContent: state.extra as PostDetailsDM,
                        ));
                  },
                ),
                GoRoute(
                  path: AppRoutes.postScreen,
                  name: AppRoutes.postScreen,
                  // pageBuilder: (context, state) {
                  //   return buildPageWithDefaultTransition(
                  //     context: context,
                  //     state: state,
                  //     child: CreatePostScreen(
                  //       mediaContent: state.extra != null
                  //           ? state.extra as MediaCenterScraperContentListModel
                  //           : null,
                  //     ),
                  //   );
                  // },
                  // pageBuilder: (context, state) => CupertinoPage<void>(
                  //   key: state.pageKey,
                  //   restorationId: state.pageKey.value,
                  //   child: CreatePostScreen(
                  //     mediaContent: state.extra != null
                  //         ? state.extra as MediaCenterScraperContentListModel
                  //         : null,
                  //   ),
                  // ),
                  builder: (BuildContext context, GoRouterState state) {
                    // final pid = state.extra['pid']
                    // Object? content = state.extra;
                    return buildPageWithDefaultTransition(
                        context: context,
                        state: state,
                        child: CreatePostScreen(
                          mediaContent: state.extra != null
                              ? state.extra
                                  as MediaCenterScraperContentListModel
                              : null,
                        ));
                  },
                ),
                GoRoute(
                  path: AppRoutes.eventDetailsScreenPost,
                  name: AppRoutes.eventDetailsScreenPost,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //         context: context,
                  //         state: state,
                  //         child: const EventsV2Screen(state: "post")),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: EventsV2Screen(state: "post"),
                  ),
                  routes: [
                    GoRoute(
                      path: AppRoutes.eventAttendancePost,
                      name: AppRoutes.eventAttendancePost,
                      // pageBuilder: (context, state) =>
                      //     buildPageWithDefaultTransition(
                      //   context: context,
                      //   state: state,
                      //   child: EventAttendanceDetail(
                      //     eventsAttendanceDM: state.extra as EventsAttendanceDM,
                      //   ),
                      // ),
                      builder: (BuildContext context, GoRouterState state) =>
                          buildPageWithDefaultTransition(
                        context: context,
                        state: state,
                        child: EventAttendanceDetail(
                          eventsAttendanceDM: state.extra as EventsAttendanceDM,
                        ),
                      ),
                    ),
                  ],
                )
              ]),
          GoRoute(
            path: AppRoutes.notificationPreferencesMain,
            name: AppRoutes.notificationPreferencesMain,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: const NotificationPreferencesView()),
            builder: (BuildContext context, GoRouterState state) {
              return buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: NotificationPreferencesView());
            },
          ),
          GoRoute(
              path: AppRoutes.directoryScreen,
              name: AppRoutes.directoryScreen,
              // pageBuilder: (context, state) => buildPageWithDefaultTransition(
              //     context: context, state: state, child: const DirectoryView()),
              builder: (BuildContext context, GoRouterState state) {
                return buildPageWithDefaultTransition(
                    context: context, state: state, child: DirectoryView());
              },
              routes: [
                GoRoute(
                  path: AppRoutes.otherUserProfileScreen,
                  name: AppRoutes.otherUserProfileScreen,
                  // pageBuilder: (context, state) =>
                  //     buildPageWithDefaultTransition(
                  //         context: context,
                  //         state: state,
                  //         child: const OtherUserProfileView()),
                  builder: (BuildContext context, GoRouterState state) =>
                      buildPageWithDefaultTransition(
                          context: context,
                          state: state,
                          child: OtherUserProfileView()),
                ),
              ]),

          GoRoute(
            path: "${AppRoutes.eventDetailsScreen}/:pid",
            name: AppRoutes.eventDetailsScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //   context: context,
            //   state: state,
            //   child: EventDetailsScreen(
            //     postContent: state.extra as EventDetailsDM,
            //   ),
            // ),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: EventDetailsScreen(
                      postContent: state.extra as EventDetailsDM,
                    )),
          ),
          GoRoute(
            path: "${AppRoutes.showGalleryScreen}/:pid",
            name: AppRoutes.showGalleryScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: const PhotoGalleryView()),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: PhotoGalleryView(),
            ),
          ),
          GoRoute(
            path: AppRoutes.profileEditScreen,
            name: AppRoutes.profileEditScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context, state: state, child: const ProfileEditView()),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: ProfileEditView(),
            ),
          ),
          GoRoute(
            path: AppRoutes.eventsScreen,
            name: AppRoutes.eventsScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: const EventsAdvancedPageView()),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: EventsAdvancedPageView(),
            ),
            routes: [
              GoRoute(
                path: AppRoutes.eventDetailsScreenNormal,
                name: AppRoutes.eventDetailsScreenNormal,
                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //   context: context,
                //   state: state,
                //   child: const EventsV2Screen(state: "normal"),
                // ),
                builder: (BuildContext context, GoRouterState state) =>
                    buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: EventsV2Screen(state: "normal"),
                ),
                routes: [
                  GoRoute(
                    path: AppRoutes.eventAttendanceNormal,
                    name: AppRoutes.eventAttendanceNormal,
                    // pageBuilder: (context, state) =>
                    //     buildPageWithDefaultTransition(
                    //   context: context,
                    //   state: state,
                    //   child: EventAttendanceDetail(
                    //     eventsAttendanceDM: state.extra as EventsAttendanceDM,
                    //   ),
                    // ),
                    builder: (BuildContext context, GoRouterState state) =>
                        buildPageWithDefaultTransition(
                      context: context,
                      state: state,
                      child: EventAttendanceDetail(
                        eventsAttendanceDM: state.extra as EventsAttendanceDM,
                      ),
                    ),
                  ),
                ],
              ),
            ],
          ),
          GoRoute(
            path: AppRoutes.mediaCenterScreen,
            name: AppRoutes.mediaCenterScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: const MediaCenterPageView()),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: MediaCenterPageView(),
            ),
            routes: [
              GoRoute(
                path: "mediaCenterPreviewImageViewScreen",
                name: AppRoutes.mediaCenterPreviewImageViewScreen,
                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //   context: context,
                //   state: state,
                //   child: MediaCenterImagePreview(
                //       mediaCenterScraperContentListModelDM:
                //           state.extra as MediaCenterScraperContentListModelDM),
                // ),
                builder: (BuildContext context, GoRouterState state) =>
                    buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: MediaCenterImagePreview(
                      mediaCenterScraperContentListModelDM:
                          state.extra as MediaCenterScraperContentListModelDM),
                ),
              ),
            ],
          ),
          GoRoute(
            path: AppRoutes.invitationsScreen,
            name: AppRoutes.invitationsScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //   context: context,
            //   state: state,
            //   child: InvitationsScreen(
            //     invitationDM: state.extra as InvitationDM,
            //   ),
            // ),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: InvitationsScreen(
                invitationDM: state.extra as InvitationDM,
              ),
            ),
          ),
          GoRoute(
            path: AppRoutes.exploreScreen,
            name: AppRoutes.exploreScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: const ExploreCommunitiesView()),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: ExploreCommunitiesView(),
            ),
          ),
          GoRoute(
            path: "${AppRoutes.communityProfile}/:isActiveCommunity",
            name: AppRoutes.communityProfile,
            // pageBuilder: (context, state) {
            //   final isActive = state.params['isActiveCommunity'] ?? 'false';
            //   final bool isActiveCommunity = isActive == 'true';
            //   bool scrollToDashboard = state.extra != null ? true : false;
            //
            //   return buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: NewCommunityProfileView(
            //       isActiveCommunity: isActiveCommunity,
            //       scrollToDashboardView: scrollToDashboard,
            //     ),
            //   );
            // },
            builder: (BuildContext context, GoRouterState state) {
              final isActive = state.params['isActiveCommunity'] ?? 'false';

              final bool isActiveCommunity = isActive == 'true';
              bool scrollToDashboard = state.extra != null ? true : false;

              // return CommunityProfileView(
              //   isActiveCommunity: isActiveCommunity,
              //   scrollToDashboardView: scrollToDashboard,
              // );
              return buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: NewCommunityProfileView(
                    isActiveCommunity: isActiveCommunity,
                    scrollToDashboardView: scrollToDashboard,
                  ));
            },
          ),
          GoRoute(
            path: "${AppRoutes.communityProfileAbout}/:isActiveCommunity",
            name: AppRoutes.communityProfileAbout,

            // pageBuilder: (context, state) {
            //   final bool isActiveCommunity =
            //       state.params['isActiveCommunity']! == 'true';
            //   bool scrollToDashboard = state.extra != null ? true : false;
            //
            //   return buildPageWithDefaultTransition(
            //       context: context,
            //       state: state,
            //       child: NewCommunityProfileView(
            //         isActiveCommunity: isActiveCommunity,
            //         scrollToDashboardView: scrollToDashboard,
            //       ));
            // },
            builder: (BuildContext context, GoRouterState state) {
              final bool isActiveCommunity =
                  state.params['isActiveCommunity']! == 'true';
              bool scrollToDashboard = state.extra != null ? true : false;

              return buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: NewCommunityProfileView(
                    isActiveCommunity: isActiveCommunity,
                    scrollToDashboardView: scrollToDashboard,
                  ));
            },
          ),
          GoRoute(
            path: AppRoutes.invitePeopleScreen,
            name: AppRoutes.invitePeopleScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: const InvitePeopleScreen()),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: InvitePeopleScreen(),
            ),
          ),
          GoRoute(
            path: AppRoutes.groupListScreen,
            name: AppRoutes.groupListScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context, state: state, child: const GroupListScreen()),
            builder: (BuildContext context, GoRouterState state) =>
                buildPageWithDefaultTransition(
              context: context,
              state: state,
              child: GroupListScreen(),
            ),
          ),
          GoRoute(
            path: AppRoutes.groupHomeScreen,
            name: AppRoutes.groupHomeScreen,
            // pageBuilder: (context, state) => buildPageWithDefaultTransition(
            //     context: context,
            //     state: state,
            //     child: GroupsHomeScreen(
            //       groupsListContent: state.extra as GroupDM,
            //     )),
            builder: (BuildContext context, GoRouterState state) {
              return buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: GroupsHomeScreen(
                    groupsListContent: state.extra as GroupDM,
                  ));
            },
            routes: [
              GoRoute(
                path: AppRoutes.groupsUserProfileScreen,
                name: AppRoutes.groupsUserProfileScreen,
                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //     context: context,
                //     state: state,
                //     child: const GroupOtherUserProfileView()),
                builder: (BuildContext context, GoRouterState state) =>
                    buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: GroupOtherUserProfileView(),
                ),
              ),
              GoRoute(
                path: AppRoutes.groupPostScreen,
                name: AppRoutes.groupPostScreen,
                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //     context: context,
                //     state: state,
                //     child: CreateGroupPostScreen(
                //       mediaContent: state.extra != null
                //           ? state.extra as MediaCenterScraperContentListModel
                //           : null,
                //     )),
                // pageBuilder: (context, state) => CupertinoPage<void>(
                //   key: state.pageKey,
                //   restorationId: state.pageKey.value,
                //   child: CreateGroupPostScreen(
                //     mediaContent: state.extra != null
                //         ? state.extra as MediaCenterScraperContentListModel
                //         : null,
                //   ),
                // ),
                builder: (BuildContext context, GoRouterState state) {
                  return buildPageWithDefaultTransition(
                      context: context,
                      state: state,
                      child: CreateGroupPostScreen(
                        mediaContent: state.extra != null
                            ? state.extra as MediaCenterScraperContentListModel
                            : null,
                      ));
                },
              ),
              GoRoute(
                path: AppRoutes.addGroupBottomSheet,
                name: AppRoutes.addGroupBottomSheet,
                builder: (context, state) => buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: AddGroupScreen(
                      isListRefresh: false,
                    )),

                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //     context: context,
                //     state: state,
                //     child: const AddGroupScreen(
                //       isListRefresh: false,
                //     )),
                // pageBuilder: (context, state) {
                //   return MaterialExtendedPage<void>(
                //       key: state.pageKey,
                //       fullscreenDialog: true,
                //       child: const AddGroupScreen(
                //         isListRefresh: false,
                //       ));
                // },
              ),
              GoRoute(
                path: AppRoutes.inviteEmailBottomSheetView,
                name: AppRoutes.inviteEmailBottomSheetView,
                builder: (context, state) => buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: InviteEmailBottomSheetView()),
                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //     context: context,
                //     state: state,
                //     child: const InviteEmailBottomSheetView()),
                // pageBuilder: (context, state) {
                //   return MaterialExtendedPage<void>(
                //       key: state.pageKey,
                //       fullscreenDialog: false,
                //       child: const InviteEmailBottomSheetView());
                // },
              ),
              GoRoute(
                path: AppRoutes.inviteLinkSettingsBottomSheetView,
                name: AppRoutes.inviteLinkSettingsBottomSheetView,
                builder: (context, state) => buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: InviteLinkSettingsBottomSheetView()),

                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //     context: context,
                //     state: state,
                //     child: const InviteLinkSettingsBottomSheetView()),
                // pageBuilder: (context, state) {
                //   return MaterialExtendedPage<void>(
                //       key: state.pageKey,
                //       fullscreenDialog: false,
                //       child: const InviteLinkSettingsBottomSheetView());
                // },
              ),
              GoRoute(
                path: AppRoutes.postGroupDetailsScreen,
                name: AppRoutes.postGroupDetailsScreen,
                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //     context: context,
                //     state: state,
                //     child: GroupPostDetailsScreen(
                //       postContent: state.extra as PostDetailsDM,
                //     )),
                builder: (BuildContext context, GoRouterState state) {
                  return buildPageWithDefaultTransition(
                      context: context,
                      state: state,
                      child: GroupPostDetailsScreen(
                        postContent: state.extra as PostDetailsDM,
                      ));
                },
              ),
              GoRoute(
                path: AppRoutes.eventDetailsScreenGroup,
                name: AppRoutes.eventDetailsScreenGroup,
                // pageBuilder: (context, state) => buildPageWithDefaultTransition(
                //     context: context,
                //     state: state,
                //     child: const EventsV2Screen(state: "group")),
                builder: (BuildContext context, GoRouterState state) =>
                    buildPageWithDefaultTransition(
                  context: context,
                  state: state,
                  child: EventsV2Screen(state: "group"),
                ),
                routes: [
                  GoRoute(
                      path: AppRoutes.eventAttendanceGroup,
                      name: AppRoutes.eventAttendanceGroup,
                      // pageBuilder: (context, state) =>
                      //     buildPageWithDefaultTransition(
                      //   context: context,
                      //   state: state,
                      //   child: EventAttendanceDetail(
                      //     eventsAttendanceDM: state.extra as EventsAttendanceDM,
                      //   ),
                      // ),
                      builder: (BuildContext context, GoRouterState state) =>
                          buildPageWithDefaultTransition(
                            context: context,
                            state: state,
                            child: EventAttendanceDetail(
                              eventsAttendanceDM:
                                  state.extra as EventsAttendanceDM,
                            ),
                          )),
                ],
              ),

              // GoRoute(
              //   path: AppRoutes.addRemovePeopleScreen,
              //   name: AppRoutes.addRemovePeopleScreen,
              //   builder: (BuildContext context, GoRouterState state) =>
              //       const GroupAddRemovePeopleScreen(),
              // ),
              // GoRoute(
              //   path: AppRoutes.updateGroupDetailsScreen,
              //   name: AppRoutes.updateGroupDetailsScreen,
              //   builder: (BuildContext context, GoRouterState state) =>
              //       const UpdateGroupDetailsScreen(),
              // ),
            ],
          ),
          // GoRoute(
          //   path: AppRoutes.addGroupsScreen,
          //   name: AppRoutes.addGroupsScreen,
          //   builder: (BuildContext context, GoRouterState state) =>
          //       const AddGroupScreen(),
          // ),
          GoRoute(
              path: AppRoutes.allCategoryGroupsHomeScreen,
              name: AppRoutes.allCategoryGroupsHomeScreen,

              // pageBuilder: (context, state) => buildPageWithDefaultTransition(
              //   context: context,
              //   state: state,
              //   child: AllCategoryGroupsView(
              //     groupsListContent: state.extra as GroupListingDM,
              //   ),
              // ),
              builder: (BuildContext context, GoRouterState state) =>
                  buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: AllCategoryGroupsView(
                      groupsListContent: state.extra as GroupListingDM,
                    ),
                  )),
          GoRoute(
              path: "message",
              name: AppRoutes.messageChatListScreen,
              routes: [],
              // pageBuilder: (context, state) => buildPageWithDefaultTransition(
              //     context: context,
              //     state: state,
              //     child: const MessageChatListScreen()),
              builder: (BuildContext context, GoRouterState state) =>
                  buildPageWithDefaultTransition(
                    context: context,
                    state: state,
                    child: MessageChatListScreen(),
                  )),
          // GoRoute(
          //   path: AppRoutes.createCommunityOnBoarding,
          //   name: AppRoutes.createCommunityOnBoarding,
          //   builder: (BuildContext context, GoRouterState state) {
          //     Object communityId = state.extra as String;
          //     return CreateCommunityOnBoarding(communityId: communityId as String,);
          //   },
          // ),
        ],
      ),
    ],
  );
}