# oliver-49/text_speach_app architecture

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

- Interactive diagram: https://gitdiagram.com/oliver-49/text_speach_app
- Repository: https://github.com/oliver-49/text_speach_app

## Overview

1. **Project type and shape**
   - This is a **cross-platform Flutter application** named `text_to_or_from_speech_app`.
   - The repository is mostly a standard Flutter app scaffold, with a small amount of domain-specific code in `lib/`.

2. **Primary runtime boundary**
   - The app runs through Flutter’s shared Dart code, while `android/`, `ios/`, `macos/`, `windows/`, `linux/`, and `web/` contain the platform bootstraps and shell projects.
   - These native directories mainly host launch/configuration, permissions, and plugin registration; the business logic appears to live in Dart.

3. **App entry and composition**
   - `lib/main.dart` is the top-level entry point.
   - The visible UI structure is organized around `presentation/screens/`, with `home_wrapper.dart` likely acting as the app’s shell/router entry after startup and `splash_screen.dart` as the initial loading screen.

4. **Presentation layer**
   - Screens include:
     - `home_page.dart` — main user-facing landing page
     - `camera_page.dart` — camera-driven feature surface
     - `vision_page.dart` — likely image/vision-related workflow
     - `splash_screen.dart` — startup/boot transition
     - `home_wrapper.dart` — likely coordinates navigation or mode selection
   - `presentation/widgets/mode_card.dart` suggests the home experience is mode-based, probably letting users choose between speech, camera, or vision workflows.

5. **State management**
   - `lib/cubit/sanad_cubit.dart` and `lib/cubit/sanad_state.dart` indicate the app uses the **Cubit/BLoC pattern** for state management.
   - This is the main coordination layer between UI actions and service/data operations, especially for asynchronous flows such as speech capture, synthesis, or media processing.

6. **Service layer for device capabilities**
   - `lib/helper.dart/services/` contains the app’s capability-specific services:
     - `stt_service.dart` — speech-to-text
     - `tts_service.dart` — text-to-speech
     - `voice_service.dart` — likely voice-related orchestration or audio control
     - `api_service.dart` — external request handling or shared API plumbing
   - These services are the key boundary between Flutter UI/state and platform or network functionality.

7. **Data layer**
   - `lib/data/` is structured as a classic repository/data-source split:
     - `web_service/api.dart` — remote API interface or request definitions
     - `repostory/response_repo.dart` — repository abstraction that mediates between services and the app
     - `models/currency_model.dart` — a data model file; the name suggests either legacy scaffold code or a placeholder that may not match the app’s current domain
   - This layer likely exists to isolate parsing, API access, and result mapping from the UI.

8. **Likely data flow**
   - The expected flow is: **UI screen → Cubit → helper service / repository → web service or device API → result back to Cubit → UI update**.
   - For speech features, the boundary is especially important: the Cubit coordinates user intent, while STT/TTS services handle audio interaction with the device.

9. **Feature domains implied by the file tree**
   - The repository appears to center on **speech input/output** and possibly **camera/vision-assisted workflows**.
   - The presence of both `camera_page.dart` and `vision_page.dart` suggests multimedia or AI-assisted features beyond simple voice conversion, though the implementation details are not visible here.

10. **Platform integration**
   - Native platform code is minimal and mostly generated Flutter host code:
     - Android `MainActivity.kt`
     - iOS `AppDelegate.swift`
     - macOS `AppDelegate.swift` / `MainFlutterWindow.swift`
     - Windows and Linux runners
   - This means the app likely relies on Flutter plugins for camera, speech, audio, and any platform APIs rather than custom native modules.

11. **Assets and static resources**
   - `assets/` is present but empty in the tree listing, so runtime media/resources may be planned but not yet added.
   - Platform-specific launch images, icons, and splash resources are managed in the native folders.

12. **Testing and quality**
   - There is a default Flutter widget test in `test/widget_test.dart` and minimal platform tests in the generated native projects.
   - `analysis_options.yaml` indicates Dart linting/static analysis is enabled, but there is no sign of a larger test architecture yet.

13. **Architectural summary for a diagram**
   - The cleanest diagram is: **Flutter UI layer** at the top, **Cubit state orchestration** in the middle, **service/repository/data layers** beneath, and **platform plugins/native shells** at the bottom.
   - The main boundaries to show are:
     - presentation vs. state management
     - state management vs. speech/camera/vision services
     - services vs. repository/web service/data model layer
     - shared Dart app vs. native platform wrappers

Main entry points: [`lib/main.dart`](https://github.com/oliver-49/text_speach_app/blob/main/lib/main.dart) (Main), [`lib/presentation/screens/home_wrapper.dart`](https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/home_wrapper.dart) (Home Wrapper), [`lib/cubit/sanad_cubit.dart`](https://github.com/oliver-49/text_speach_app/blob/main/lib/cubit/sanad_cubit.dart) (Sanad Cubit), [`lib/helper.dart/services`](https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services) (Speech Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared_dart["Shared Dart"]
  node_main["Main<br/>Flutter entry<br/>[main.dart]"]
  node_splash["Splash<br/>Startup screen<br/>[splash_screen.dart]"]
  node_home_wrapper["Home Wrapper<br/>App shell<br/>[home_wrapper.dart]"]
  node_home_page["Home Page<br/>Landing screen<br/>[home_page.dart]"]
  node_camera_page["Camera Page<br/>Camera flow<br/>[camera_page.dart]"]
  node_vision_page["Vision Page<br/>Vision flow<br/>[vision_page.dart]"]
  node_mode_card["Mode Card<br/>UI widget<br/>[mode_card.dart]"]
  node_sanad_cubit{{"Sanad Cubit<br/>State orchestration<br/>[sanad_cubit.dart]"}}
  node_sanad_state["Sanad State<br/>Cubit state<br/>[sanad_state.dart]"]
  node_speech_services[("Speech Services<br/>Device services<br/>[services]")]
  node_stt_service["STT<br/>Speech-to-text<br/>[stt_service.dart]"]
  node_tts_service["TTS<br/>Text-to-speech<br/>[tts_service.dart]"]
  node_voice_service["Voice<br/>Audio orchestration<br/>[voice_service.dart]"]
  node_api_service["API Service<br/>Network service<br/>[api_service.dart]"]
  node_response_repo[("Response Repo<br/>[response_repo.dart]")]
  node_web_api["Web API<br/>Remote API<br/>[api.dart]"]
  node_currency_model["Currency Model<br/>Data model"]
end

subgraph group_native_shells["Native Shells"]
  node_android["Android<br/>Native host<br/>[MainActivity.kt]"]
  node_ios["iOS<br/>Native host<br/>[AppDelegate.swift]"]
  node_macos["macOS<br/>Native host"]
  node_linux["Linux<br/>Native host<br/>[main.cc]"]
  node_windows["Windows<br/>Native host<br/>[main.cpp]"]
  node_web["Web<br/>[index.html]"]
end

node_android -->|"launches"| node_main
node_ios -->|"launches"| node_main
node_macos -->|"launches"| node_main
node_linux -->|"launches"| node_main
node_windows -->|"launches"| node_main
node_web -->|"launches"| node_main
node_main -->|"shows"| node_splash
node_main -->|"enters"| node_home_wrapper
node_home_wrapper -->|"navigates"| node_home_page
node_home_wrapper -->|"navigates"| node_camera_page
node_home_wrapper -->|"navigates"| node_vision_page
node_home_page -->|"uses"| node_mode_card
node_home_wrapper -->|"drives"| node_sanad_cubit
node_sanad_cubit -->|"emits"| node_sanad_state
node_sanad_cubit -->|"orchestrates"| node_speech_services
node_speech_services -->|"contains"| node_stt_service
node_speech_services -->|"contains"| node_tts_service
node_speech_services -->|"contains"| node_voice_service
node_sanad_cubit -->|"calls"| node_response_repo
node_response_repo -->|"wraps"| node_web_api
node_web_api -->|"uses"| node_api_service
node_response_repo -->|"maps"| node_currency_model

click node_main "https://github.com/oliver-49/text_speach_app/blob/main/lib/main.dart"
click node_splash "https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/splash_screen.dart"
click node_home_wrapper "https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/home_wrapper.dart"
click node_home_page "https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/home_page.dart"
click node_camera_page "https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/camera_page.dart"
click node_vision_page "https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/vision_page.dart"
click node_mode_card "https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/widgets/mode_card.dart"
click node_sanad_cubit "https://github.com/oliver-49/text_speach_app/blob/main/lib/cubit/sanad_cubit.dart"
click node_sanad_state "https://github.com/oliver-49/text_speach_app/blob/main/lib/cubit/sanad_state.dart"
click node_speech_services "https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services"
click node_stt_service "https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/stt_service.dart"
click node_tts_service "https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/tts_service.dart"
click node_voice_service "https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/voice_service.dart"
click node_api_service "https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/api_service.dart"
click node_response_repo "https://github.com/oliver-49/text_speach_app/blob/main/lib/data/repostory/response_repo.dart"
click node_web_api "https://github.com/oliver-49/text_speach_app/blob/main/lib/data/web_service/api.dart"
click node_currency_model "https://github.com/oliver-49/text_speach_app/blob/main/lib/data/models/currency_model.dart"
click node_android "https://github.com/oliver-49/text_speach_app/blob/main/android/app/src/main/kotlin/com/example/text_to_or_from_speech_app/MainActivity.kt"
click node_ios "https://github.com/oliver-49/text_speach_app/blob/main/ios/Runner/AppDelegate.swift"
click node_macos "https://github.com/oliver-49/text_speach_app/blob/main/macos/Runner/MainFlutterWindow.swift"
click node_linux "https://github.com/oliver-49/text_speach_app/blob/main/linux/runner/main.cc"
click node_windows "https://github.com/oliver-49/text_speach_app/blob/main/windows/runner/main.cpp"
click node_web "https://github.com/oliver-49/text_speach_app/blob/main/web/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_splash,node_home_wrapper,node_home_page,node_camera_page,node_vision_page,node_mode_card,node_sanad_cubit,node_sanad_state,node_speech_services,node_stt_service,node_tts_service,node_voice_service,node_api_service,node_response_repo,node_web_api,node_currency_model toneBlue
class node_android,node_ios,node_macos,node_linux,node_windows,node_web toneAmber
```

## Components

### Shared Dart

Flutter app logic in lib/

- [Main](https://github.com/oliver-49/text_speach_app/blob/main/lib/main.dart): Flutter entry · Top-level Dart entry point · `lib/main.dart`
- [Splash](https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/splash_screen.dart): Startup screen · Initial loading and transition screen · `lib/presentation/screens/splash_screen.dart`
- [Home Wrapper](https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/home_wrapper.dart): App shell · Likely routes or selects the main app mode · `lib/presentation/screens/home_wrapper.dart`
- [Home Page](https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/home_page.dart): Landing screen · Primary user-facing landing page · `lib/presentation/screens/home_page.dart`
- [Camera Page](https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/camera_page.dart): Camera flow · Camera-driven feature surface · `lib/presentation/screens/camera_page.dart`
- [Vision Page](https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/screens/vision_page.dart): Vision flow · Image or vision-related workflow · `lib/presentation/screens/vision_page.dart`
- [Mode Card](https://github.com/oliver-49/text_speach_app/blob/main/lib/presentation/widgets/mode_card.dart): UI widget · Mode selection card used in the home experience · `lib/presentation/widgets/mode_card.dart`
- [Sanad Cubit](https://github.com/oliver-49/text_speach_app/blob/main/lib/cubit/sanad_cubit.dart): State orchestration · Coordinates UI actions and asynchronous feature flows · `lib/cubit/sanad_cubit.dart`
- [Sanad State](https://github.com/oliver-49/text_speach_app/blob/main/lib/cubit/sanad_state.dart): Cubit state · State definitions for the app coordinator · `lib/cubit/sanad_state.dart`
- [Speech Services](https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services): Device services · Speech-related capability layer · `lib/helper.dart/services`
- [STT](https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/stt_service.dart): Speech-to-text · Speech capture and transcription · `lib/helper.dart/services/stt_service.dart`
- [TTS](https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/tts_service.dart): Text-to-speech · Speech synthesis output · `lib/helper.dart/services/tts_service.dart`
- [Voice](https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/voice_service.dart): Audio orchestration · Voice/audio control and coordination · `lib/helper.dart/services/voice_service.dart`
- [API Service](https://github.com/oliver-49/text_speach_app/blob/main/lib/helper.dart/services/api_service.dart): Network service · Shared API access or request plumbing · `lib/helper.dart/services/api_service.dart`
- [Response Repo](https://github.com/oliver-49/text_speach_app/blob/main/lib/data/repostory/response_repo.dart): Repository · Repository boundary between services and app data · `lib/data/repostory/response_repo.dart`
- [Web API](https://github.com/oliver-49/text_speach_app/blob/main/lib/data/web_service/api.dart): Remote API · Remote request definitions and response handling · `lib/data/web_service/api.dart`
- [Currency Model](https://github.com/oliver-49/text_speach_app/blob/main/lib/data/models/currency_model.dart): Data model · Representative model file in the data layer · `lib/data/models/currency_model.dart`

### Native Shells

Platform bootstraps and generated runners

- [Android](https://github.com/oliver-49/text_speach_app/blob/main/android/app/src/main/kotlin/com/example/text_to_or_from_speech_app/MainActivity.kt): Native host · Android launcher and plugin host · `android/app/src/main/kotlin/com/example/text_to_or_from_speech_app/MainActivity.kt`
- [iOS](https://github.com/oliver-49/text_speach_app/blob/main/ios/Runner/AppDelegate.swift): Native host · iOS launcher and plugin host · `ios/Runner/AppDelegate.swift`
- [macOS](https://github.com/oliver-49/text_speach_app/blob/main/macos/Runner/MainFlutterWindow.swift): Native host · macOS launcher and plugin host · `macos/Runner/MainFlutterWindow.swift`
- [Linux](https://github.com/oliver-49/text_speach_app/blob/main/linux/runner/main.cc): Native host · Linux desktop runner · `linux/runner/main.cc`
- [Windows](https://github.com/oliver-49/text_speach_app/blob/main/windows/runner/main.cpp): Native host · Windows desktop runner · `windows/runner/main.cpp`
- [Web](https://github.com/oliver-49/text_speach_app/blob/main/web/index.html): Web shell · Browser bootstrap and manifest · `web/index.html`

## Connections

- Android → Main: launches · Android shell boots the shared Dart app
- iOS → Main: launches · iOS shell boots the shared Dart app
- macOS → Main: launches · macOS shell boots the shared Dart app
- Linux → Main: launches · Linux runner starts the Flutter app
- Windows → Main: launches · Windows runner starts the Flutter app
- Web → Main: launches · Web bootstrap serves the Flutter app
- Main → Splash: shows · App starts in the splash/loading flow
- Main → Home Wrapper: enters · Main app composition and navigation shell
- Home Wrapper → Home Page: navigates · Primary landing experience
- Home Wrapper → Camera Page: navigates · Camera-based feature surface
- Home Wrapper → Vision Page: navigates · Vision-related workflow
- Home Page → Mode Card: uses · Home screen is built around mode selection cards
- Home Wrapper → Sanad Cubit: drives · UI shell coordinates through Cubit state
- Sanad Cubit → Sanad State: emits · Cubit publishes state transitions
- Sanad Cubit → Speech Services: orchestrates · State layer coordinates device-capability services
- Speech Services → STT: contains · Speech-to-text capability
- Speech Services → TTS: contains · Text-to-speech capability
- Speech Services → Voice: contains · Voice/audio coordination
- Sanad Cubit → Response Repo: calls · Cubit consults repository and async data operations
- Response Repo → Web API: wraps · Repository mediates remote API access
- Web API → API Service: uses · Remote API layer relies on shared request plumbing
- Response Repo → Currency Model: maps · Repository uses model objects for parsed data
