# shaunaksawargaonkar/papa_pro_vision architecture

> Architecture diagram of the GitHub repository shaunaksawargaonkar/papa_pro_vision, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shaunaksawargaonkar/papa_pro_vision
- Repository: https://github.com/shaunaksawargaonkar/papa_pro_vision

## Overview

##### Project Type and Purpose
- This is a multi-platform Flutter application (Android, iOS, Web, Linux, macOS, Windows) that:
- Captures images via camera
- Sends images and user voice prompts to a Gemini 2.5 flash LLM service
- Receives and displays LLM responses
- Reads responses aloud (multi-engine TTS)
- Supports voice input in Marathi and other languages
- Provides in-app payments, analytics, local storage, and file sharing

##### Main Components
A. Presentation Layer (UI)
- lib/UI – pages (Registration, PhoneAuth, HomeScreen, ProfilePage), widgets (mic button, image preview, sidebar)
- Flutter’s Navigator & Material widgets
B. State Management
- lib/StateManagement/button_state_provider.dart (Provider pattern)
- Service locator (lib/Txt2Speech/service_locator.dart)
C. Core Services & Helpers
- & Device Access
– DeviceHelper.dart (camera, microphone)
– DeviceAudioHelper.dart (playback)
- Local Data
– DatabaseHelper.dart (SQLite or shared prefs)
– FileSharingHelper.dart
- Analytics
– AnalyticsHelper.dart
- Payment
– payment_gateway.dart, payment_utils.dart (Razorpay integration)
D. LLM Interaction
- lib/LLMResponse/agent_service.dart (HTTP client to Gemini API)
- system_prompt_enums.dart (prompt templates)
E. Text-to-Speech Engines
- flutter_tts.dart (flutter_tts plugin)
- google_tts.dart (Google TTS REST client)
F. Platform Runners / Native Code
- Android (Kotlin MainActivity + Gradle)
- iOS/macOS (Swift AppDelegate)
- Linux/Windows runner (C++ entry points, CMake)
- Web (index.html, manifest)

##### Relationships & Data Flows
1. User taps “Capture” in UI → DeviceHelper opens camera → returns image
2. UI passes image + optional voice prompt to LLM service via agent_service
3. LLM HTTP call → Gemini 2.5 API → returns JSON analysis
4. agent_service parses JSON → returns structured text
5. UI displays text (HomeScreen / ProfilePage)
6. Text → Service Locator picks TTS engine → flutter_tts or google_tts
7. TTS audio stream → DeviceAudioHelper → plays through speaker
8. Payment flows are handled similarly: UI → payment_gateway → external Razorpay SDK → callback → state update
9. AnalyticsHelper logs key events

##### Architectural Patterns & Principles
- Layered architecture: UI → State/Controllers → Services → External
- Dependency Injection via service_locator
- Provider for state notifications
- Separation of concerns: Helpers isolate platform APIs
- Cross-platform via Flutter engine + native runners

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer (UI)
    subgraph "Presentation Layer (UI)"
        direction TB
        RegPage["Registration Pages"]:::ui
        PhoneAuth["PhoneAuth Page"]:::ui
        HomeScreen["HomeScreen"]:::ui
        ProfilePage["ProfilePage"]:::ui
        Widgets["Widgets (mic_button, image_preview, side_bar_button)"]:::ui
        UIConstants["UI Constants"]:::ui
    end

    %% State Management
    subgraph "State Management"
        direction TB
        ButtonState["ButtonStateProvider"]:::controllers
        ServiceLocator["Service Locator"]:::controllers
    end

    %% Core Services & Helpers
    subgraph "Core Services & Helpers"
        direction TB
        DeviceHelper["DeviceHelper (Camera/Microphone)"]:::services
        DeviceAudioHelper["DeviceAudioHelper (Playback)"]:::services
        DatabaseHelper["DatabaseHelper"]:::database
        FileSharing["FileSharingHelper"]:::services
        AnalyticsHelper["AnalyticsHelper"]:::services
    end

    %% Payment Integration
    subgraph "Payment Integration"
        direction TB
        PaymentGateway["Razorpay Gateway Interface"]:::services
        PaymentUtils["Payment Utilities"]:::services
    end

    %% LLM Interaction
    subgraph "LLM Interaction"
        direction TB
        AgentService["Agent Service (Gemini API)"]:::services
        PromptEnums["System Prompt Templates"]:::services
    end

    %% Text-to-Speech Engines
    subgraph "Text-to-Speech Engines"
        direction TB
        FlutterTTS["Flutter TTS Plugin"]:::services
        GoogleTTS["Google TTS REST Client"]:::services
        AudioPlayer["Audio Player Abstraction"]:::services
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GeminiAPI["Gemini 2.5 API"]:::external
        RazorpaySDK["Razorpay SDK"]:::external
    end

    %% Platform Runners / Native Code
    subgraph "Platform Runners / Native Code"
        direction TB
        AndroidRunner["Android (MainActivity.kt)"]:::platform
        IOSRunner["iOS/macOS (AppDelegate.swift)"]:::platform
        LinuxRunner["Linux Runner"]:::platform
        WindowsRunner["Windows Runner"]:::platform
        WebRunner["Web Runner"]:::platform
    end

    %% Data Flows
    RegPage -->|"taps Capture"| DeviceHelper
    HomeScreen -->|uses| DeviceHelper
    DeviceHelper -->|returns image| HomeScreen
    HomeScreen -->|sends image & prompt| AgentService
    AgentService -->|HTTP Request| GeminiAPI
    GeminiAPI -->|JSON Response| AgentService
    AgentService -->|structured text| HomeScreen
    HomeScreen -->|display text| ProfilePage
    HomeScreen -->|requests TTS| ServiceLocator
    ServiceLocator -->|provides engine| FlutterTTS
    ServiceLocator -->|provides engine| GoogleTTS
    FlutterTTS -->|audio stream| AudioPlayer
    GoogleTTS -->|audio stream| AudioPlayer
    AudioPlayer -->|play audio| DeviceAudioHelper
    HomeScreen -->|initiates payment| PaymentGateway
    PaymentGateway -->|calls| RazorpaySDK
    RazorpaySDK -->|callback| PaymentGateway
    PaymentGateway -->|updates state| ButtonState
    HomeScreen -->|logs event| AnalyticsHelper
    FileSharing -->|share file| HomeScreen
    HomeScreen -->|reads prefs| DatabaseHelper

    %% Click Events
    click RegPage "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/RegisterPage/registration_page.dart"
    click RegPage "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/RegisterPage/AlasPage.dart"
    click RegPage "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/RegisterPage/AlasInternet.dart"
    click PhoneAuth "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/auth/phone_auth_page.dart"
    click HomeScreen "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/home_Screen.dart"
    click ProfilePage "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/profile_page.dart"
    click Widgets "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/widgets/mic_button.dart"
    click Widgets "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/widgets/image_preview.dart"
    click Widgets "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/widgets/side_bar_button.dart"
    click UIConstants "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/UI/Constants/color_constans.dart"
    click ButtonState "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/StateManagement/button_state_provider.dart"
    click ServiceLocator "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Txt2Speech/service_locator.dart"
    click DeviceHelper "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Helper/DeviceHelper.dart"
    click DeviceAudioHelper "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Helper/DeviceAudioHelper.dart"
    click DatabaseHelper "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Helper/DatabaseHelper.dart"
    click FileSharing "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Helper/FileSharingHelper.dart"
    click AnalyticsHelper "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Helper/AnalyticsHelper.dart"
    click PaymentGateway "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Payment/payment_gatway.dart"
    click PaymentUtils "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Payment/payment_utils.dart"
    click AgentService "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/LLMResponse/agent_service.dart"
    click PromptEnums "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/LLMResponse/system_prompt_enums.dart"
    click FlutterTTS "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Txt2Speech/Models/flutter_tts.dart"
    click GoogleTTS "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Txt2Speech/Models/google_tts.dart"
    click AudioPlayer "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/lib/Txt2Speech/AudioPlayer/audio_player.dart"
    click AndroidRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/android/app/src/main/kotlin/com/example/papa_pro_vision/MainActivity.kt"
    click IOSRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/ios/Runner/AppDelegate.swift"
    click IOSRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/macos/Runner/AppDelegate.swift"
    click LinuxRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/linux/runner/main.cc"
    click LinuxRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/linux/runner/my_application.cc"
    click LinuxRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/linux/runner/my_application.h"
    click LinuxRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/linux/CMakeLists.txt"
    click WindowsRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/windows/runner/main.cpp"
    click WindowsRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/windows/runner/flutter_window.cpp"
    click WindowsRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/windows/runner/flutter_window.h"
    click WindowsRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/windows/CMakeLists.txt"
    click WebRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/web/index.html"
    click WebRunner "https://github.com/shaunaksawargaonkar/papa_pro_vision/blob/main/web/manifest.json"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#3399ff;
    classDef controllers fill:#d4edda,stroke:#28a745;
    classDef services fill:#ffe5cc,stroke:#ff9933;
    classDef external fill:#f8d7da,stroke:#dc3545;
    classDef platform fill:#e2e3e5,stroke:#6c757d;
    classDef database fill:#fff3cd,stroke:#ffcd39;
```
