# jhoannpv/calculadora-de-interes architecture

> Architecture diagram of the GitHub repository jhoannpv/calculadora-de-interes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jhoannpv/calculadora-de-interes
- Repository: https://github.com/jhoannpv/calculadora-de-interes

## Overview

##### Main Components
- Flutter UI Layer: Represent the user interface which lives mostly in the lib/ui directory. This includes pages (like home and operations), widgets, and app configuration (lib/ui/app.dart).
- Domain/Business Logic Layer: Include the business logic in the lib/domain directory. This is where the controllers, calculations (e.g., calculate_simple_interest, calculate_gradients, etc.), and data management reside.
- Platform-Specific Layers: Showcase separate modules for Android, iOS, and other supported platforms like web, Linux, macOS, and Windows. This delineates how Flutter acts as a single codebase deployed across multiple platforms with platform-specific configurations.

##### Relationships and Interactions
- Data Flow: Illustrate how user commands from the UI trigger function calls to the business logic components (controllers in lib/domain) and how these compute the results which are then sent back to the UI for display.
- UI components invoke calculation functions in the domain layer.
- The domain layer maintains separation from platform-specific code but all layers interact through Flutter’s framework.
- The interface between the Flutter framework and platform-specific runtime (Android/iOS, etc.) should be noted.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Emphasize the clear distinction between UI (presentation layer) and business logic (domain layer).
- Multi-platform approach: Point out that the project is designed to be deployed on multiple operating systems with a single unified codebase.
- Modular Design: The file structure (separating domain, UI, and platform-specific directories) shows a modular approach to building the application.

##### Relevant Technologies, Frameworks, or Libraries
- Flutter (UI toolkit and framework) for creating the application interface.
- Dart (language) for writing business logic.
- Platform-specific build tools: Gradle for Android, Xcode for iOS, and respective tools for desktop and web.

##### Implementation Advice for the Principal Software Engineer
- Detail the internal workings of the domain layer by listing the individual calculation modules (like “calculate_simple_interest”, “calculate_annuities”, etc.) and how they interact.

## Diagram (Mermaid)

```mermaid
graph TD
    User["User"]:::user

    subgraph "Core Flutter Code"
        UI["Flutter UI Layer"]:::ui
        subgraph "Domain Business Logic Layer"
            Domain["Domain Business Logic"]:::domain
            subgraph "Calculations"
                SIC["Simple Interest Calculation"]:::calc
                GC["Gradients Calculation"]:::calc
                AC["Annuities Calculation"]:::calc
            end
            Domain --> SIC
            Domain --> GC
            Domain --> AC
        end
        UI -->|"triggers"| Domain
        Domain -->|"returns_result"| UI
    end

    subgraph "Platform-Specific Layers"
        Android["Android Platform Code"]:::platform
        iOS["iOS Platform Code"]:::platform
        Linux["Linux Platform Code"]:::platform
        macOS["macOS Platform Code"]:::platform
        Windows["Windows Platform Code"]:::platform
        Web["Web Platform Code"]:::platform
    end

    Assets["Assets & Configuration"]:::assets

    User -->|"interacts_with"| UI
    UI -->|"builds_for"| Android
    UI -->|"builds_for"| iOS
    UI -->|"builds_for"| Linux
    UI -->|"builds_for"| macOS
    UI -->|"builds_for"| Windows
    UI -->|"builds_for"| Web
    Assets -->|"configures"| UI

    click UI "https://github.com/jhoannpv/calculadora-de-interes/tree/main/lib/ui"
    click Domain "https://github.com/jhoannpv/calculadora-de-interes/tree/main/lib/domain"
    click SIC "https://github.com/jhoannpv/calculadora-de-interes/blob/main/lib/domain/controller/calculations/calculate_simple_interest.dart"
    click GC "https://github.com/jhoannpv/calculadora-de-interes/blob/main/lib/domain/controller/calculations/calculate_gradients.dart"
    click AC "https://github.com/jhoannpv/calculadora-de-interes/blob/main/lib/domain/controller/calculations/calculate_annuities.dart"
    click Android "https://github.com/jhoannpv/calculadora-de-interes/tree/main/android"
    click iOS "https://github.com/jhoannpv/calculadora-de-interes/tree/main/ios"
    click Linux "https://github.com/jhoannpv/calculadora-de-interes/tree/main/linux"
    click macOS "https://github.com/jhoannpv/calculadora-de-interes/tree/main/macos"
    click Windows "https://github.com/jhoannpv/calculadora-de-interes/tree/main/windows"
    click Web "https://github.com/jhoannpv/calculadora-de-interes/tree/main/web"
    click Assets "https://github.com/jhoannpv/calculadora-de-interes/blob/main/pubspec.yaml"

    classDef ui fill:#ccf,stroke:#333,stroke-width:2px;
    classDef domain fill:#cfc,stroke:#333,stroke-width:2px;
    classDef calc fill:#afa,stroke:#333,stroke-width:2px;
    classDef platform fill:#ffc,stroke:#333,stroke-width:2px;
    classDef assets fill:#eee,stroke:#333,stroke-width:2px;
    classDef user fill:#fdd,stroke:#333,stroke-width:2px;
```
