How aditya290605/cricket_scorer works
1. Overall shape
- This is a Flutter client application, not a server repo.
- The core product logic lives in lib/; everything else is platform bootstrap for Android, iOS, web, macOS, Linux, and Windows.
- Firebase is the only external backend boundary visible in the repo.
2. Entry point and app bootstrap
- lib/main.dart is the application entry.
- lib/firebase_options.dart suggests Firebase is initialized from generated per-platform config.
- lib/screens/auth/auth_wrapper.dart likely acts as the top-level route gate, sending users to auth or the main app depending on login state.
3. State management boundary
- lib/providers/auth_provider.dart is the main state layer shown in the tree.
- The app uses Provider to keep UI screens reactive to auth/session and likely match-related state.
- This is the main separation between UI widgets and backend/service calls.
4. Domain models
- lib/models/user_model.dart and lib/models/players.dart hold app data structures.
- These models are the shared contract between Firestore data, provider state, and screen rendering.
- The repository appears centered on users/players rather than generic CRUD entities.
5. Firebase-facing services
- lib/services/auth_service.dart handles authentication, likely wrapping Firebase Auth and Google Sign-In.
- lib/services/firestore.dart is the persistence layer for match and user data in Firestore.
- lib/services/feedback_service.dart is a separate service boundary for user feedback submission.
- lib/services/generate_summary.dart indicates post-match or match-summary generation happens as a service, not inside UI widgets.
6. Primary gameplay / scoring flow
- The app’s core flow is cricket match setup and scoring: team selection, toss, live score entry, match summary, and leaderboard views.
- Relevant screens are select_teams_screen.dart, toss_screen.dart, match_score.dart, match_summary.dart, matches_list.dart, and match_list_detail.dart.
- This suggests a stateful workflow where match state evolves ball-by-ball and is then summarized and persisted.
7. User-facing screen hierarchy
- home_screen.dart, main_screen.dart, and starting_screen.dart appear to be the main navigation shell and landing flow.
- profile_screen.dart, leader_board.dart, and feedback_dialog.dart are supporting features around the scoring core.
- The screens/auth/ folder isolates login/signup from the rest of the app.
8. Audio and match-event feedback
- The assets/ folder contains many MP3 clips for boundaries and wickets, plus an IPL-style horn.
- This implies event-driven audio feedback is part of the scoring experience, probably triggered from the match-scoring logic when runs/wickets occur.
- Audio is a first-class UI feedback channel, not just decoration.
9. Data persistence and sync
- Firestore is the main cloud datastore for match and user data, based on the README and service structure.
- The app is designed for cloud-synced scoring, so local UI actions likely fan out to provider state first, then to Firestore.
- The summary/leaderboard screens likely read aggregated match data back from Firestore or derived summaries.
10. Cross-platform shell
- Android, iOS, web, macOS, Linux, and Windows directories are all present, so this is a single Flutter codebase deployed to multiple targets.
- Platform folders are mostly standard launcher/bootstrap layers, while the functional architecture stays in lib/.
- firebase.json and platform Firebase files/configs indicate the app is wired for Firebase across targets.
11. Testing and quality
- test/widget_test.dart is the main test entry shown, so automated coverage appears lightweight and Flutter-widget oriented.
- analysis_options.yaml indicates linting/static analysis is enabled.
- There is no sign of a separate backend test suite because the backend is external Firebase services.
12. Important architectural boundary for diagrams
- A useful diagram should show: user actions in screens → Provider state → Firebase/auth/firestore services → Firebase cloud services, with audio playback branching off from match events.
- The match workflow is the central business pipeline; auth is the gate, and summaries/leaderboards are the main readout of persisted match data.
Main entry points: auth_provider.dart Auth provider · main.dart Main · match_score.dart Score match · firestore.dart Firestore
Components 30
App bootstrap
Flutter entry, generated config, and route gating.
- Main · Application entry point.
cricket_app/lib/main.dart - Firebase opts · Per-platform Firebase initialization options.
cricket_app/lib/firebase_options.dart
Auth flow
Sign-in, signup, and session gating.
Match workflow
Core cricket setup, scoring, summary, and history.
- Select teams · Team selection for a match.
cricket_app/lib/screens/select_teams_screen.dart - Toss · Toss and pre-match decision flow.
cricket_app/lib/screens/toss_screen.dart - Score match · Live scoring and event-driven match updates.
cricket_app/lib/screens/match_score.dart - Summary · Post-match summary and results view.
cricket_app/lib/screens/match_summary.dart - Matches · List of persisted matches.
cricket_app/lib/screens/matches_list.dart - Match detail · Single match history and details view.
cricket_app/lib/screens/match_list_detail.dart
Supporting UI
Profile, leaderboard, feedback, and landing screens.
- Start · Initial landing or onboarding screen.
cricket_app/lib/screens/starting_screen.dart - Main shell · Primary in-app navigation container.
cricket_app/lib/screens/main_screen.dart - Home · Main home/dashboard screen.
cricket_app/lib/screens/home_screen.dart - Leaderboard · Aggregate rankings and standings.
cricket_app/lib/screens/leader_board.dart - Profile · User profile and account view.
cricket_app/lib/screens/profile_screen.dart - Feedback · User feedback entry and submission UI.
cricket_app/lib/screens/feedback_dialog.dart - Match audio · Boundary, wicket, and horn sound effects.
cricket_app/assets/audios
Data layer
Provider state, models, and Firebase-facing services.
- Auth provider · Reactive app state for auth and session-related data.
cricket_app/lib/providers/auth_provider.dart - User model · Shared user data contract.
cricket_app/lib/models/user_model.dart - Players · Player and roster data structures.
cricket_app/lib/models/players.dart - Auth service · Authentication boundary, likely wrapping Firebase Auth.
cricket_app/lib/services/auth_service.dart - Firestore · Cloud persistence for users, matches, and summaries.
cricket_app/lib/services/firestore.dart - Summary service · Generates post-match summaries.
cricket_app/lib/services/generate_summary.dart - Feedback service · Submits user feedback to a backend boundary.
cricket_app/lib/services/feedback_service.dart - Firebase cloud · External Firebase auth and datastore boundary.
Platform shells
Launcher code for mobile, desktop, and web targets.
- Android · Android launcher/bootstrap.
cricket_app/android/app/src/main/kotlin/com/a2cstudiosindia/cricket_app/MainActivity.kt - iOS · iOS launcher/bootstrap.
cricket_app/ios/Runner/AppDelegate.swift - Web · Web launcher shell.
cricket_app/web/index.html - Desktop · Desktop launcher/bootstrap for macOS, Linux, and Windows.
cricket_app/windows/runner/main.cpp
Connections 32
- Main → Firebase opts: configures · Initializes app with generated Firebase options.
- Main → Auth gate: boots · Starts the top-level route gate.
- Auth gate → Auth provider: reads state · Chooses auth or app routes from provider state.
- Auth gate → Login: routes to · Sends unauthenticated users to login.
- Auth gate → Signup: routes to · Sends new users to signup.
- Auth provider → Auth service: uses · Delegates login and session operations.
- Auth service → Firebase cloud: auth · Uses Firebase authentication services.
- Auth provider → User model: emits · Publishes user/session state to UI.
- Auth provider → Firestore: syncs · Coordinates persisted app state.
- Login → Auth provider: updates · Triggers sign-in state changes.
- Signup → Auth provider: updates · Triggers account creation state changes.
- Main shell → Home: navigates · Primary in-app shell routes to home.
- Home → Select teams: starts · Begins match setup flow.
- Select teams → Toss: continues · Moves from team selection to toss.
- Toss → Score match: starts · Enters live scoring after toss.
- Score match → Players: uses · Tracks players, rosters, and on-field state.
- Score match → Firestore: persists · Writes live match events and score state.
- Score match → Match audio: plays · Triggers run/wicket sound feedback.
- Score match → Summary service: summarizes · Generates end-of-match output.
- Summary service → Summary: feeds · Produces the summary screen content.
- Summary → Matches: links · Drives match history navigation.
- Matches → Match detail: opens · Shows an individual match record.
- Matches → Firestore: reads · Loads stored match data and aggregates.
- Leaderboard → Firestore: reads · Uses persisted scoring data for rankings.
- Profile → Auth provider: reads state · Displays current user/session info.
- Feedback → Feedback service: submits · Sends user feedback for persistence or delivery.
- Feedback service → Firebase cloud: backend · Uses Firebase-backed cloud integration.
- Firestore → Firebase cloud: stores · Persists match and user data in Firestore.
- Android → Main: launches · Platform bootstrap into Flutter app.
- iOS → Main: launches · Platform bootstrap into Flutter app.
- Web → Main: launches · Platform bootstrap into Flutter app.
- Desktop → Main: launches · Platform bootstrap into Flutter app.