# paulohebert/periodic-table architecture

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

- Interactive diagram: https://gitdiagram.com/paulohebert/periodic-table
- Repository: https://github.com/paulohebert/periodic-table

## Overview

##### Project Type and Purpose
This is a cross-platform educational application built with Flutter, specifically designed to provide an interactive periodic table for chemistry education at Colégio Rui Barbosa. The project supports multiple platforms (Android, iOS, web, desktop).

##### Main Components

A. Application Layer (Core)
- Main Application Container
- State Management System
- Router/Navigation System

B. Feature Modules
- Periodic Table View
- Element Details
- Settings
- About Section

C. Data Layer
- Element Models
- JSON Data Storage
- 3D Models Storage

D. Platform-Specific Implementations
- Mobile (Android/iOS)
- Web
- Desktop (Windows/macOS/Linux)

**┌─ User Interface Layer ─────────────────────┐**

- ┌─ Screens ─────┐    ┌─ Widgets ───────┐ │
- Home        │    │ - PeriodicTable │ │
- Details     │    │ - ElementCell   │ │
- Settings    │    │ - ElementInfo   │ │
- ┘    └────────────────┘ │

- Business Logic Layer ───────────────────┤

- ┌─ Controllers ──┐    ┌─ Services ────┐  │
- Settings    │    │ - Settings    │  │
- Table       │    └──────────────┘  │
- ┘                       │

- Data Layer ────────────────────────────┤

- ┌─ Models ──────┐    ┌─ Assets ──────┐  │
- Element     │    │ - JSON Data   │  │
- Category    │    │ - 3D Models   │  │
- Details     │    │ - Images      │  │
- ┘    └──────────────┘  │

- ┘

##### Specific Elements

- Blue: UI Components
- Green: Business Logic
- Yellow: Data Layer
- Gray: Platform-specific implementations

- Double lines: Platform bridges

##### Important Architectural Patterns to Highlight

- Model-View-Controller (MVC) pattern
- Widget composition pattern (Flutter-specific)
- Asset management system
- Cross-platform compatibility layer

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        Screens --> Home["Home Screen"]:::screen
        Screens --> Details["Element Details Screen"]:::screen
        Screens --> Settings["Settings Screen"]:::screen
        
        Widgets --> PTable["Periodic Table Widget"]:::widget
        Widgets --> ECell["Element Cell Widget"]:::widget
        Widgets --> EInfo["Element Info Widget"]:::widget
        Widgets --> About["About Widget"]:::widget
    end

    subgraph Logic
        Controllers --> TableCtrl["Table Controller"]:::controller
        Controllers --> SettingsCtrl["Settings Controller"]:::controller
        
        Services --> SettingsSvc["Settings Service"]:::service
    end

    subgraph Data
        Models --> ElementModel["Element Model"]:::model
        Models --> CategoryModel["Category Model"]:::model
        Models --> DetailsModel["Details Model"]:::model
        
        Assets --> JsonData["JSON Data"]:::asset
        Assets --> Models3D["3D Models"]:::asset
    end

    subgraph Platforms
        direction TB
        Android["Android"]:::platform
        iOS["iOS"]:::platform
        Web["Web"]:::platform
        Windows["Windows"]:::platform
        Linux["Linux"]:::platform
        MacOS["MacOS"]:::platform
    end

    App["Main App Container"]:::core

    App --> UI
    UI --> Logic
    Logic --> Data
    App --> Platforms

    %% Click Events
    click App "https://github.com/paulohebert/periodic-table/blob/main/lib/src/app.dart"
    click Home "https://github.com/paulohebert/periodic-table/blob/main/lib/src/screens/home.dart"
    click Details "https://github.com/paulohebert/periodic-table/blob/main/lib/src/screens/element_details.dart"
    click Settings "https://github.com/paulohebert/periodic-table/blob/main/lib/src/screens/settings.dart"
    click PTable "https://github.com/paulohebert/periodic-table/blob/main/lib/src/widgets/periodic_table.dart"
    click ECell "https://github.com/paulohebert/periodic-table/blob/main/lib/src/widgets/element_cell.dart"
    click EInfo "https://github.com/paulohebert/periodic-table/blob/main/lib/src/widgets/element_info.dart"
    click About "https://github.com/paulohebert/periodic-table/blob/main/lib/src/widgets/about.dart"
    click TableCtrl "https://github.com/paulohebert/periodic-table/blob/main/lib/src/controllers/expanded_table.dart"
    click SettingsCtrl "https://github.com/paulohebert/periodic-table/blob/main/lib/src/controllers/settings.dart"
    click SettingsSvc "https://github.com/paulohebert/periodic-table/blob/main/lib/src/services/settings.dart"
    click ElementModel "https://github.com/paulohebert/periodic-table/blob/main/lib/src/models/element.dart"
    click CategoryModel "https://github.com/paulohebert/periodic-table/blob/main/lib/src/models/element_category.dart"
    click DetailsModel "https://github.com/paulohebert/periodic-table/blob/main/lib/src/models/element_details.dart"
    click JsonData "https://github.com/paulohebert/periodic-table/tree/main/assets/json/"
    click Models3D "https://github.com/paulohebert/periodic-table/tree/main/assets/model3d/"
    click Android "https://github.com/paulohebert/periodic-table/tree/main/android/"
    click iOS "https://github.com/paulohebert/periodic-table/tree/main/ios/"
    click Web "https://github.com/paulohebert/periodic-table/tree/main/web/"
    click Windows "https://github.com/paulohebert/periodic-table/tree/main/windows/"
    click Linux "https://github.com/paulohebert/periodic-table/tree/main/linux/"
    click MacOS "https://github.com/paulohebert/periodic-table/tree/main/macos/"

    %% Styles
    classDef core fill:#2d3436,stroke:#2d3436,color:#fff
    classDef screen fill:#3498db,stroke:#2980b9,color:#fff
    classDef widget fill:#2ecc71,stroke:#27ae60,color:#fff
    classDef controller fill:#e74c3c,stroke:#c0392b,color:#fff
    classDef service fill:#9b59b6,stroke:#8e44ad,color:#fff
    classDef model fill:#f1c40f,stroke:#f39c12,color:#fff
    classDef asset fill:#1abc9c,stroke:#16a085,color:#fff
    classDef platform fill:#95a5a6,stroke:#7f8c8d,color:#fff
```
