# p3ro/calie architecture

> Architecture diagram of the GitHub repository p3ro/calie, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/p3ro/calie
- Repository: https://github.com/p3ro/calie

## Overview

##### Main Components Identification

a) Presentation Layer (UI Components):
- Sub-components for:
- Main Calculator Interface (main.dart)
- Scientific Calculator View (scientific.dart)
- History View (history.dart)
- Custom Button Component (button.dart)
- History Entry Component (history_entry.dart)

b) Platform-Specific Layers:
- Android Implementation
- iOS Implementation
- Web Implementation

##### Architectural Pattern Representation

- Use a hierarchical structure showing widget tree relationships
- State management flow
- Relationship between UI components and platform channels

- Blue: Core UI components
- Green: Platform-specific implementations
- Orange: State management
- Gray: Supporting components

- Rectangles: Major components
- Rounded rectangles: UI widgets
- Diamonds: Decision points

##### Implementation Details

**Top Layer: User Interface**
- Main Calculator View
- Scientific Calculator View
- History View

**Middle Layer: Core Logic**
- Calculation Engine
- History Management

**Bottom Layer: Platform Implementation**
- Android
- iOS
- Web

##### Technical Stack Indicators

- Flutter Framework
- Dart Language
- Platform SDKs (Android, iOS, Web)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface Layer"
        MC["Main Calculator Interface"]
        SC["Scientific Calculator View"]
        HV["History View"]
        CB["Custom Button Component"]
        HE["History Entry Component"]
    end

    subgraph "Core Logic Layer"
        CE["Calculation Engine"]
        HM["History Management"]
    end

    subgraph "Platform Layer"
        subgraph "Android"
            AImpl["Android Implementation"]
            AEntry["Android Entry Point"]
        end
        
        subgraph "iOS"
            IImpl["iOS Implementation"]
            IEntry["iOS Entry Point"]
        end
        
        subgraph "Web"
            WImpl["Web Implementation"]
            WEntry["Web Entry Point"]
        end
    end

    subgraph "Supporting Components"
        GF["Google Fonts"]
        TF["Testing Framework"]
    end

    %% Relationships
    MC --> CE
    SC --> CE
    CE --> HM
    HM --> HV
    HV --> HE
    MC --> CB
    SC --> CB

    CE --> AImpl
    CE --> IImpl
    CE --> WImpl

    %% Platform-specific relationships
    AImpl --> AEntry
    IImpl --> IEntry
    WImpl --> WEntry

    %% Supporting component relationships
    GF --> MC
    GF --> SC
    TF -.-> MC
    TF -.-> SC

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#e67e22,stroke:#d35400,color:white
    classDef platform fill:#2ecc71,stroke:#27ae60,color:white
    classDef support fill:#95a5a6,stroke:#7f8c8d,color:white

    class MC,SC,HV,CB,HE ui
    class CE,HM core
    class AImpl,IImpl,WImpl,AEntry,IEntry,WEntry platform
    class GF,TF support

    %% Click events
    click MC "https://github.com/p3ro/calie/blob/master/lib/main.dart"
    click SC "https://github.com/p3ro/calie/blob/master/lib/scientific.dart"
    click HV "https://github.com/p3ro/calie/blob/master/lib/history.dart"
    click CB "https://github.com/p3ro/calie/blob/master/lib/button.dart"
    click HE "https://github.com/p3ro/calie/blob/master/lib/history_entry.dart"
    click AImpl "https://github.com/p3ro/calie/tree/master/android/app/src/main"
    click IImpl "https://github.com/p3ro/calie/tree/master/ios/Runner"
    click WImpl "https://github.com/p3ro/calie/tree/master/web/"
    click TF "https://github.com/p3ro/calie/blob/master/test/widget_test.dart"
    click GF "https://github.com/p3ro/calie/tree/master/google_fonts/"
    click AEntry "https://github.com/p3ro/calie/blob/master/android/app/src/main/kotlin/com/example/calie/MainActivity.kt"
    click IEntry "https://github.com/p3ro/calie/blob/master/ios/Runner/AppDelegate.swift"
    click WEntry "https://github.com/p3ro/calie/blob/master/web/index.html"
```
