This site is driven by two keys, like the machine it came from. Reading: j and k scroll, d and u move half a page, gg goes to the top, G to the bottom, H and L switch windows, ? opens the help. Space is the Neovim leader and handles content: Space then h home, r research, p projects, g gear, a about, / tags, or Space then a digit to jump to that window. Home is the tmux prefix and handles windows: Home then c opens a terminal, Home then & closes a window, Home then space goes to the next one. While focus is on the keyboard, h j k l move between keys and Enter opens one.

ResearchR AboutA Gear: G for gear, keyboard, terminal, editor, homelab.G
    ProjectsP Tags: / as in vim: search./
    ×
    Menu

    busgo: A Bus Ticket Booking Flow in Flutter

    A UI prototype for booking bus tickets, search, pick a bus, pick a seat, enter passenger details, pay, ticket. Flutter with Riverpod and go_router; Supabase handles Google sign-in, the booking data stays local.

    busgo is a bus-ticket booking flow I built to practise one specific thing: a multi-step flow in Flutter without every screen knowing what comes next.

    The booking flow is all local data. The one thing that talks to a server is login: Google sign-in, handed to Supabase. What’s being exercised here is the navigation and the shape of the state, not integration.

    The flow

    login → home (search form)
          → select_bus_page
          → select_seat_sheet
          → passengger_form_sheet
          → waiting_payment
          → ticket → list_booking

    The three middle steps aren’t full pages but bottom sheets (select_seat_sheet, passengger_form_sheet, plus the shared bottom_sheet_selector and bottom_sheet_date_selector). The reason is practical: picking a seat and then changing your mind is normal, and dismissing a sheet feels far cheaper than hitting back on a full page.

    Routes and state

    Navigation goes through go_router in a single lib/core/router.dart, so every route is readable in one place and no screen pushes directly to another. State is Riverpod (flutter_riverpod + hooks_riverpod), with ProviderScope wrapped around the app in main.dart, after the .env file is read and Supabase is initialised:

    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      await Env.load();
    
      await Supabase.initialize(
        url: EnvKeys.supabaseUrl,
        anonKey: EnvKeys.supabaseAnonKey,
      );
    
      runApp(const ProviderScope(child: BusGoApp()));
    }

    Login

    AuthController runs google_sign_in, then passes the Google ID token and access token to Supabase with signInWithIdToken. The router listens to Supabase’s onAuthStateChange through a small GoRouterRefreshStream, and its redirect does the rest: no user sends you to /login, a signed-in user on /login goes to /home. No screen checks the session itself.

    The folder layout is by feature, not by file type:

    lib/features/{auth,home,booking,payment,profile}
    lib/shared/widgets      # bottom navigation + sheets used across features
    lib/core/router.dart    # routes + auth redirect

    Status

    A UI prototype for Android and iOS (the desktop and web targets were removed). Login is real, the rest is not: no bookings are stored anywhere, and there is no real payment, waiting_payment just holds the screen. If it ever gets wired to an API, the layer to add is a repository under the providers; the screens shouldn’t have to know.

    id en
    rss gh in