arch-atlas

Home Screen

presentation/home.dart · ConsumerStatefulWidget

presentation

Overview

Top-level Home screen. Holds the IndexedStack of tab pages and decides which set of tabs to render based on isLoggedIn. AutomaticKeepAliveClientMixin keeps every tab subtree warm so swiping back doesn't rebuild map / messages / profile.

User Flow

  1. initState schedules a post-frame callback: refreshAuthState + _checkInitialTos + _checkPendingSeller.
  2. build watches authStateProvider and bottomNavIndexProvider.
  3. _buildPages returns [Home, Map, Profile] for guests or [Home, Map, Messages, Profile] for authenticated users.
  4. Horizontal swipe left pushes /search via context.pushNamed.
  5. ToS check on first frame redirects to /terms if the consented version is stale.

Cases & Edge Cases

  • Pending-seller redirect: if isPendingSellerRegistration is true on entry, the user is sent to /devenir-prestataire even though they completed initial onboarding.
  • ToS check is duplicated here (in addition to the GoRouter redirect) because the redirect's memoization makes it idempotent — the home-screen call is the authoritative re-check after login.
  • currentIndex is clamp(0, pages.length - 1) to survive a guest→logged-in transition where the tab count grows mid-session.

Code References

  • lib/src/features/shared/home/presentation/home.dart:15 // HomeScreen
  • lib/src/features/shared/home/presentation/home.dart:31 // initState hooks
  • lib/src/features/shared/home/presentation/home.dart:77 // _buildPages

API Calls

Empty — fill this in later. Open the manifest and add content here.

Notes

Horizontal-drag → /search is intentional but undiscoverable; the visible CTA is the tiny circular icon in HomePage. Don't 'fix' the size without coordinating with design.