# flutter/gallery architecture

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

- Interactive diagram: https://gitdiagram.com/flutter/gallery
- Repository: https://github.com/flutter/gallery

## Overview

##### Project type and purpose
- This is a multi-platform Flutter “Gallery” demo application. It provides a showcase of Flutter widgets, patterns, and themes across Android, iOS, web, Linux, macOS, and Windows. Although now deprecated for active feature development, it remains in use for testing and reference.

##### File structure
- Top-level “android”, “ios”, “linux”, “macos”, “windows”, and “web” folders contain platform‐specific embedding code (Gradle/Xcode/CMake projects, Flutter engine registrants, resource manifests).
- The “lib” folder holds the Dart code:
- main.dart – app entry point and widget tree bootstrap
- pages, demos, studies, themes, data, layout, feature_discovery, codeviewer – modular feature and UI component sets
- l10n – localization resources (.arb files)
- “tool” contains command‐line utilities for code viewing and localization (codeviewer_cli, l10n_cli).
- “test” and “test_driver” contain widget, unit, integration, golden‐image, and performance tests.
- CI/CD configs under “.github/workflows” drive build/test/release across platforms; “android/fastlane” manages Play Store deployment.

##### Extract additional insights from README
- Confirms this is a reference/test app.
- No custom backend—entirely client‐side.
- Uses Flutter internationalization and automated testing heavily.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Framework
    subgraph "Flutter Core" 
        FFE["Flutter Framework & Engine"]:::core
    end

    %% Dart Application Code
    subgraph "Dart Application Code" 
        Entry["lib/main.dart"]:::dart
        UI["UI Layer<br/>(pages, demos, layout, themes)"]:::dart
        Routing["Routing Layer<br/>(lib/routes.dart & study routes)"]:::dart
        Data["Data Layer<br/>(demos, gallery_options, icons, models)"]:::dart
        Localization["Localization Layer<br/>(l10n .arb files)"]:::dart
        Tooling["Tooling Layer<br/>(codeviewer_cli, l10n_cli, grind.dart)"]:::dart
    end

    %% Platform Embeddings
    subgraph "Platform Embeddings" 
        Android["Android Embedder"]:::embed
        iOS["iOS Embedder"]:::embed
        macOS["macOS Embedder"]:::embed
        Linux["Linux Embedder"]:::embed
        Windows["Windows Embedder"]:::embed
        Web["Web Embedder"]:::embed
    end

    %% Testing & CI/CD
    subgraph "Testing & CI/CD" 
        Testing["Testing Infrastructure"]:::ci
        CI["CI/CD & Deployment"]:::ci
    end

    %% External Services
    subgraph "External Services" 
        Firebase["Firebase Hosting & Analytics"]:::ext
        Fonts["Google Fonts"]:::ext
    end

    %% Relationships
    Entry -->|"boots UI & Routing"| UI
    Entry --> Routing
    UI -->|"reads data"| Data
    UI -->|"uses localization"| Localization
    Entry --> FFE
    Routing --> FFE
    FFE <-->|"platform channels"| Android
    FFE <--> iOS
    FFE <--> macOS
    FFE <--> Linux
    FFE <--> Windows
    FFE <--> Web
    Tooling -->|"generates assets & code"| Entry
    Testing --> CI
    CI -->|"triggers build"| FFE
    CI --> Android
    CI --> iOS
    CI --> macOS
    CI --> Linux
    CI --> Windows
    CI --> Web
    CI --> Testing
    CI --> Firebase
    CI --> Fonts

    %% Click Events
    click Entry "https://github.com/flutter/gallery/blob/main/lib/main.dart"
    click UI "https://github.com/flutter/gallery/tree/main/lib/pages/"
    click UI "https://github.com/flutter/gallery/tree/main/lib/demos/"
    click UI "https://github.com/flutter/gallery/tree/main/lib/layout/"
    click UI "https://github.com/flutter/gallery/tree/main/lib/themes/"
    click Routing "https://github.com/flutter/gallery/blob/main/lib/routes.dart"
    click Routing "https://github.com/flutter/gallery/blob/main/lib/studies/crane/routes.dart"
    click Routing "https://github.com/flutter/gallery/blob/main/lib/studies/fortnightly/routes.dart"
    click Routing "https://github.com/flutter/gallery/blob/main/lib/studies/rally/routes.dart"
    click Routing "https://github.com/flutter/gallery/blob/main/lib/studies/reply/routes.dart"
    click Routing "https://github.com/flutter/gallery/blob/main/lib/studies/shrine/routes.dart"
    click Routing "https://github.com/flutter/gallery/blob/main/lib/studies/starter/routes.dart"
    click Data "https://github.com/flutter/gallery/blob/main/lib/data/demos.dart"
    click Data "https://github.com/flutter/gallery/blob/main/lib/data/gallery_options.dart"
    click Data "https://github.com/flutter/gallery/blob/main/lib/data/icons.dart"
    click Data "https://github.com/flutter/gallery/tree/main/lib/studies/crane/model/"
    click Data "https://github.com/flutter/gallery/blob/main/lib/studies/rally/data.dart"
    click Data "https://github.com/flutter/gallery/tree/main/lib/studies/rally/charts/"
    click Data "https://github.com/flutter/gallery/tree/main/lib/studies/reply/model/"
    click Data "https://github.com/flutter/gallery/tree/main/lib/studies/shrine/model/"
    click Localization "https://github.com/flutter/gallery/tree/main/lib/l10n/"
    click Localization "https://github.com/flutter/gallery/blob/main/l10n.yaml"
    click Tooling "https://github.com/flutter/gallery/tree/main/tool/codeviewer_cli/"
    click Tooling "https://github.com/flutter/gallery/tree/main/tool/l10n_cli/"
    click Tooling "https://github.com/flutter/gallery/blob/main/tool/grind.dart"
    click Android "https://github.com/flutter/gallery/blob/main/android/app/src/main/kotlin/io/flutter/demo/gallery/MainActivity.kt"
    click iOS "https://github.com/flutter/gallery/blob/main/ios/Runner/AppDelegate.swift"
    click macOS "https://github.com/flutter/gallery/blob/main/macos/Runner/AppDelegate.swift"
    click macOS "https://github.com/flutter/gallery/blob/main/macos/Runner/MainFlutterWindow.swift"
    click Linux "https://github.com/flutter/gallery/blob/main/linux/main.cc"
    click Windows "https://github.com/flutter/gallery/blob/main/windows/runner/main.cpp"
    click Windows "https://github.com/flutter/gallery/blob/main/windows/runner/flutter_window.cpp"
    click Web "https://github.com/flutter/gallery/blob/main/web/index.html"
    click Testing "https://github.com/flutter/gallery/tree/main/test/"
    click Testing "https://github.com/flutter/gallery/tree/main/test_driver/"
    click Testing "https://github.com/flutter/gallery/tree/main/test_goldens/"
    click Testing "https://github.com/flutter/gallery/tree/main/test_benchmarks/benchmarks/"
    click CI "https://github.com/flutter/gallery/tree/main/.github/workflows/"
    click CI "https://github.com/flutter/gallery/tree/main/android/fastlane/Fastfile"
    click CI "https://github.com/flutter/gallery/tree/main/android/fastlane/metadata/android"
    click CI "https://github.com/flutter/gallery/blob/main/firebase.json"
    click CI "https://github.com/flutter/gallery/blob/main/.firebaserc"

    %% Styles
    classDef core fill:#bbdefb,stroke:#0d47a1,color:#0d47a1
    classDef dart fill:#c8e6c9,stroke:#2e7d32,color:#2e7d32
    classDef embed fill:#ffe0b2,stroke:#e65100,color:#e65100
    classDef ci fill:#e1bee7,stroke:#6a1b9a,color:#6a1b9a
    classDef ext fill:#cfd8dc,stroke:#455a64,color:#455a64
```
