# ksokolovskyi/paper_liquid_metal_logo architecture

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

- Interactive diagram: https://gitdiagram.com/ksokolovskyi/paper_liquid_metal_logo
- Repository: https://github.com/ksokolovskyi/paper_liquid_metal_logo

## Overview

##### Main Components
- Flutter Application Core – the entry point (main.dart) that kicks off the application and sets up the widget tree.
- UI/Widget Layer – all custom widgets and controls such as:
– liquid_metal_logo.dart and liquid_metal_logo_state.dart, which are likely responsible for rendering the logo and managing its state.
– simple_slider.dart and control_panel.dart, which serve as interactive components for controlling aspects of the animation.
– logo_selector.dart, which might allow users to change or select different logo variations.
- Shader and Graphics Layer – responsible for rendering the liquid metal effect:
– The assets/shaders folder (with liquid.frag) represents the GLSL fragment shader critical for the liquid effect.
– Integration point within liquid_metal_shader_controller.dart which probably orchestrates shader parameters and animations.
- Assets and Resources – fonts from assets/fonts and images from assets/images used throughout the UI.
- Platform-Specific Code – separate directories for macOS (native macOS project files under macos/) and web (files in the web folder like index.html, manifest.json), indicating that this Flutter project is configured to run on multiple platforms.
- Configuration and Dependency Management – files like pubspec.yaml (which lists project dependencies and assets), analysis_options.yaml, and various configuration files under the macos directory providing environment-specific build settings.

##### Relationships and Interactions
- The main.dart file acts as the central hub that initializes the Flutter application.
- The UI layer (widgets, control panels, sliders) directly interacts with the shader controller to change visual parameters and trigger animations.
- The stateful widgets (for example, the ones in liquid_metal_logo_state.dart) maintain the animation’s current state and update the UI as needed.
- The shader controller communicates with the shader (liquid.frag) to pass real-time data (like changes from sliders in control_panel.dart).
- All assets (images, fonts, shaders) are loaded through Flutter’s asset management defined in the pubspec.yaml.
- Platform-specific layers (macos and web) encapsulate how the Flutter engine interacts with the native or browser environment.

##### Architectural Patterns and Technologies
- MVC / MVVM-like Separation – while not explicitly stated, the separation into different Dart files for UI (widgets), state (logo state), and control (shader controller) suggests a layered approach that distinguishes presentation from logic.
- Cross-platform considerations are handled by Flutter’s unified codebase with specialized directories for macOS and web.
- Integration of platform-specific configurations (macos Xcode projects and web entry files) highlights a pattern where the “core” Flutter portion remains the same, but each platform has its tailor-made bootstrap code.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Flutter Core
    subgraph "Flutter Core"
        AppCore["App Entry & Initialization"]:::core
    end

    %% UI/Widget Layer
    subgraph "UI/Widget Layer"
        LogoWidget["Liquid Metal Logo Widget"]:::ui
        LogoState["Liquid Metal Logo State Management"]:::ui
        Slider["Slider for Animation Control"]:::ui
        ControlPanel["Control Panel for UI Interactions"]:::ui
        LogoSelector["Logo Selector Widget"]:::ui
    end

    %% Shader & Animation Engine
    subgraph "Shader & Animation Engine"
        ShaderCtrl["Shader Controller"]:::shader
        ShaderFrag["Liquid Metal Shader"]:::shader
    end

    %% Assets/Resources
    subgraph "Assets/Resources"
        Fonts["Fonts"]:::assets
        Images["Images"]:::assets
    end

    %% Platform-Specific Modules
    subgraph "Platform-Specific Modules"
        MacOS["macOS Integration"]:::platform
        Web["Web Integration"]:::platform
    end

    %% Configuration & Dependency Management
    subgraph "Config & Dependencies"
        Pubspec["Project Dependencies"]:::config
        Analysis["Analysis Options"]:::config
    end

    %% External Reference
    ExternalRepo["External Liquid Metal Repo"]:::external

    %% Connections from Core to UI Layer
    AppCore -->|"initializes"| LogoWidget
    AppCore -->|"initializes"| LogoState
    AppCore -->|"initializes"| Slider
    AppCore -->|"initializes"| ControlPanel
    AppCore -->|"initializes"| LogoSelector

    %% UI components inter-relationships
    ControlPanel -->|"updates"| LogoState
    Slider -->|"updates"| LogoState
    LogoSelector -->|"selects"| LogoState
    LogoState -->|"renders"| LogoWidget

    %% UI to Shader interaction
    LogoState -->|"controls"| ShaderCtrl
    ShaderCtrl -->|"appliesEffect"| ShaderFrag
    ShaderCtrl -->|"inspiredBy"| ExternalRepo

    %% Assets loading from configuration
    Pubspec -->|"loadsAssets"| Fonts
    Pubspec -->|"loadsAssets"| Images
    Pubspec -->|"defines"| Analysis

    %% Platform-specific bootstrapping
    AppCore -->|"runsOn"| MacOS
    AppCore -->|"runsOn"| Web

    %% Click Events
    click AppCore "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/lib/main.dart"
    click LogoWidget "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/lib/liquid_metal_logo.dart"
    click LogoState "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/lib/liquid_metal_logo_state.dart"
    click Slider "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/lib/simple_slider.dart"
    click ControlPanel "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/lib/control_panel.dart"
    click LogoSelector "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/lib/logo_selector.dart"
    click ShaderCtrl "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/lib/liquid_metal_shader_controller.dart"
    click ShaderFrag "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/assets/shaders/liquid.frag"
    click Fonts "https://github.com/ksokolovskyi/paper_liquid_metal_logo/tree/main/assets/fonts"
    click Images "https://github.com/ksokolovskyi/paper_liquid_metal_logo/tree/main/assets/images"
    click MacOS "https://github.com/ksokolovskyi/paper_liquid_metal_logo/tree/main/macos"
    click Web "https://github.com/ksokolovskyi/paper_liquid_metal_logo/tree/main/web"
    click Pubspec "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/pubspec.yaml"
    click Analysis "https://github.com/ksokolovskyi/paper_liquid_metal_logo/blob/main/analysis_options.yaml"

    %% Styling 
    classDef core fill:#ffddcc,stroke:#d2691e,stroke-width:2px;
    classDef ui fill:#ccffcc,stroke:#228b22,stroke-width:2px;
    classDef shader fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef assets fill:#f0e68c,stroke:#b8860b,stroke-width:2px;
    classDef platform fill:#e6e6fa,stroke:#9370db,stroke-width:2px;
    classDef config fill:#ffe4e1,stroke:#ff69b4,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#696969,stroke-width:2px;
```
