diff --git a/sojorn_app/lib/routes/app_routes.dart b/sojorn_app/lib/routes/app_routes.dart index d001453..479373c 100644 --- a/sojorn_app/lib/routes/app_routes.dart +++ b/sojorn_app/lib/routes/app_routes.dart @@ -94,16 +94,6 @@ class AppRoutes { GoRoute( path: homeAlias, builder: (_, __) => const FeedPersonalScreen(), - routes: [ - GoRoute( - path: 'notifications', - builder: (_, __) => const NotificationsScreen(), - ), - GoRoute( - path: 'discover', - builder: (_, __) => const DiscoverScreen(), - ), - ], ), ], ), diff --git a/sojorn_app/lib/screens/home/home_shell.dart b/sojorn_app/lib/screens/home/home_shell.dart index 1aca3eb..70b04ac 100644 --- a/sojorn_app/lib/screens/home/home_shell.dart +++ b/sojorn_app/lib/screens/home/home_shell.dart @@ -256,7 +256,13 @@ class _HomeShellState extends ConsumerState with WidgetsBindingObserv IconButton( icon: Icon(Icons.search, color: AppTheme.navyBlue), tooltip: 'Discover', - onPressed: () => context.go('/home/discover'), + onPressed: () { + Navigator.of(context, rootNavigator: true).push( + MaterialPageRoute( + builder: (_) => const DiscoverScreen(), + ), + ); + }, ), IconButton( icon: Consumer( @@ -293,7 +299,13 @@ class _HomeShellState extends ConsumerState with WidgetsBindingObserv }, ), tooltip: 'Notifications', - onPressed: () => context.go('/home/notifications'), + onPressed: () { + Navigator.of(context, rootNavigator: true).push( + MaterialPageRoute( + builder: (_) => const NotificationsScreen(), + ), + ); + }, ), const SizedBox(width: 4), ], diff --git a/sojorn_app/lib/screens/notifications/notifications_screen.dart b/sojorn_app/lib/screens/notifications/notifications_screen.dart index 35f0510..a903ec5 100644 --- a/sojorn_app/lib/screens/notifications/notifications_screen.dart +++ b/sojorn_app/lib/screens/notifications/notifications_screen.dart @@ -14,6 +14,7 @@ import 'package:google_fonts/google_fonts.dart'; import '../../services/notification_service.dart'; import '../../providers/notification_provider.dart'; import '../secure_chat/secure_chat_full_screen.dart'; +import '../discover/discover_screen.dart'; /// Notifications screen showing user activity class NotificationsScreen extends ConsumerStatefulWidget { @@ -382,23 +383,23 @@ class _NotificationsScreenState extends ConsumerState { ), ), actions: [ - if (canArchiveAll) - TextButton( - onPressed: _archiveAllNotifications, - child: Text( - 'Archive All', - style: AppTheme.textTheme.labelMedium?.copyWith( - color: AppTheme.egyptianBlue, - fontWeight: FontWeight.w600, - ), - ), - ), IconButton( - onPressed: () => context.go('/home'), + onPressed: () { + Navigator.of(context).pop(); + // Small delay so pop completes before navigating + }, icon: Icon(Icons.home_outlined, color: AppTheme.navyBlue), ), IconButton( - onPressed: () => Navigator.of(context, rootNavigator: true).push( + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (_) => const DiscoverScreen()), + ); + }, + icon: Icon(Icons.search, color: AppTheme.navyBlue), + ), + IconButton( + onPressed: () => Navigator.of(context).pushReplacement( MaterialPageRoute( builder: (_) => const SecureChatFullScreen(), fullscreenDialog: true, @@ -443,7 +444,26 @@ class _NotificationsScreenState extends ConsumerState { ) : _notifications.isEmpty && !_isLoading ? const _EmptyState() - : RefreshIndicator( + : Column( + children: [ + if (canArchiveAll) + Align( + alignment: Alignment.centerRight, + child: Padding( + padding: const EdgeInsets.only(right: 8, top: 4), + child: TextButton( + onPressed: _archiveAllNotifications, + child: Text( + 'Archive All', + style: AppTheme.textTheme.labelMedium?.copyWith( + color: AppTheme.egyptianBlue, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ), + Expanded(child: RefreshIndicator( onRefresh: () => _loadNotifications(refresh: true), child: ListView.builder( itemCount: _notifications.length + (_hasMore ? 1 : 0), @@ -510,6 +530,9 @@ class _NotificationsScreenState extends ConsumerState { }, ), ), + )), + ], + ), ), ); }