# abdelrahman-elreedy/window_frame architecture

> Architecture diagram of the GitHub repository abdelrahman-elreedy/window_frame, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdelrahman-elreedy/window_frame
- Repository: https://github.com/abdelrahman-elreedy/window_frame

## Overview

window_frame is a Flutter Windows plugin that replaces the native title bar with a customizable Flutter bar while retaining native window behavior. The main workflow initializes window options, wraps the app in a scope that presents the bar, and sends window commands through the Dart/native channel to Win32; window-state events return to Dart. The graph also preserves documented menu, drag, caption-button, and safe-close capabilities. Dart internals are represented at subsystem level because their source was not excerpted; native links are limited to relationships supported by the README and source index.

Main entry points: [`lib/src/data/datasources/window_method_channel_data_source.dart`](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/datasources/window_method_channel_data_source.dart) (Method-channel data source), [`windows/src/application/window_use_cases.cpp`](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/application/window_use_cases.cpp) (Window use cases), [`windows/src/infrastructure/win32/win32_window_gateway.cpp`](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_window_gateway.cpp) (Win32 window gateway), [`lib/src/presentation/widgets/scope`](https://github.com/abdelrahman-elreedy/window_frame/tree/main/lib/src/presentation/widgets/scope) (Frame scope)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dart_ui["Flutter presentation"]
  node_scope["Frame scope"]
  node_titlebar["Title bar"]
  node_caption["Caption buttons"]
  node_drag["Drag and menus"]
end

subgraph group_dart_domain["Dart window logic"]
  node_controller["Title bar controller"]
  node_content["Bar content model"]
  node_close["Close coordinator"]
  node_frame_api["Frame facade<br/>[window_frame.dart]"]
end

subgraph group_channel["Platform channel"]
  node_dart_channel["Method-channel data source"]
  node_contract["Channel contract"]
  node_mapper["Channel mappers"]
  node_repository["Platform repository"]
end

subgraph group_native_app["Native application"]
  node_native_plugin["Plugin composition root"]
  node_channel_controller["Channel controller<br/>[window_channel.cpp]"]
  node_usecases["Window use cases"]
  node_models["Window session and options<br/>[window_models.h]"]
  node_ports["Window ports<br/>[window_ports.h]"]
end

subgraph group_win32["Windows integration"]
  node_dispatcher["Message dispatcher"]
  node_handlers["Window message handlers"]
  node_gateway["Win32 window gateway"]
  node_frame["Native frame helpers<br/>[win32_frame.cpp]"]
end

node_app(("Flutter app"))
node_windows(("Windows window"))

node_app -->|"wraps app"| node_scope
node_scope -->|"presents"| node_titlebar
node_controller -->|"describes bar"| node_content
node_scope -->|"uses controller"| node_controller
node_titlebar -->|"shows buttons"| node_caption
node_titlebar -->|"offers interactions"| node_drag
node_app -->|"initializes frame"| node_frame_api
node_frame_api -.->|"sends commands"| node_dart_channel
node_close -.->|"requests close"| node_dart_channel
node_dart_channel -.->|"uses contract"| node_contract
node_dart_channel -.->|"maps messages"| node_mapper
node_repository -.->|"delegates calls"| node_dart_channel
node_dart_channel -->|"invokes methods"| node_channel_controller
node_native_plugin -->|"registers channel"| node_channel_controller
node_native_plugin -->|"registers handlers"| node_dispatcher
node_channel_controller -->|"dispatches commands"| node_usecases
node_usecases -->|"uses contracts"| node_ports
node_models -->|"holds session state"| node_usecases
node_dispatcher -->|"dispatches messages"| node_handlers
node_handlers -->|"synchronizes state"| node_usecases
node_gateway -->|"implements gateway"| node_ports
node_gateway -->|"uses frame helpers"| node_frame
node_gateway -->|"controls window"| node_windows
node_usecases -->|"controls window"| node_gateway

click node_scope "https://github.com/abdelrahman-elreedy/window_frame/tree/main/lib/src/presentation/widgets/scope"
click node_titlebar "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/widgets/title_bar/window_title_bar.dart"
click node_caption "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/widgets/caption_buttons/window_caption_buttons.dart"
click node_drag "https://github.com/abdelrahman-elreedy/window_frame/tree/main/lib/src/presentation/widgets/title_bar"
click node_controller "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/view_models/title_bar_controller.dart"
click node_content "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/models/title_bar_content.dart"
click node_close "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/coordinators/window_close_coordinator.dart"
click node_frame_api "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/facade/window_frame.dart"
click node_dart_channel "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/datasources/window_method_channel_data_source.dart"
click node_contract "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/constants/window_channel_contract.dart"
click node_mapper "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/mappers/window_channel_mappers.dart"
click node_repository "https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/repositories/window_platform_repositories.dart"
click node_native_plugin "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/window_frame_plugin.cpp"
click node_channel_controller "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/presentation/window_channel.cpp"
click node_usecases "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/application/window_use_cases.cpp"
click node_models "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/domain/window_models.h"
click node_ports "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/domain/window_ports.h"
click node_dispatcher "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_message_pipeline.cpp"
click node_handlers "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_message_handlers.cpp"
click node_gateway "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_window_gateway.cpp"
click node_frame "https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_frame.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scope,node_titlebar,node_caption,node_drag toneBlue
class node_controller,node_content,node_close,node_frame_api toneAmber
class node_dart_channel,node_contract,node_mapper,node_repository toneMint
class node_native_plugin,node_channel_controller,node_usecases,node_models,node_ports toneRose
class node_dispatcher,node_handlers,node_gateway,node_frame,node_app,node_windows toneIndigo
```

## Components

### Flutter presentation

- [Frame scope](https://github.com/abdelrahman-elreedy/window_frame/tree/main/lib/src/presentation/widgets/scope): `lib/src/presentation/widgets/scope`
- [Title bar](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/widgets/title_bar/window_title_bar.dart): `lib/src/presentation/widgets/title_bar/window_title_bar.dart`
- [Caption buttons](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/widgets/caption_buttons/window_caption_buttons.dart): `lib/src/presentation/widgets/caption_buttons/window_caption_buttons.dart`
- [Drag and menus](https://github.com/abdelrahman-elreedy/window_frame/tree/main/lib/src/presentation/widgets/title_bar): `lib/src/presentation/widgets/title_bar`

### Dart window logic

- [Title bar controller](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/view_models/title_bar_controller.dart): `lib/src/presentation/view_models/title_bar_controller.dart`
- [Bar content model](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/models/title_bar_content.dart): `lib/src/presentation/models/title_bar_content.dart`
- [Close coordinator](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/coordinators/window_close_coordinator.dart): `lib/src/presentation/coordinators/window_close_coordinator.dart`
- [Frame facade](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/presentation/facade/window_frame.dart): `lib/src/presentation/facade/window_frame.dart`

### Platform channel

- [Method-channel data source](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/datasources/window_method_channel_data_source.dart): `lib/src/data/datasources/window_method_channel_data_source.dart`
- [Channel contract](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/constants/window_channel_contract.dart): `lib/src/data/constants/window_channel_contract.dart`
- [Channel mappers](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/mappers/window_channel_mappers.dart): `lib/src/data/mappers/window_channel_mappers.dart`
- [Platform repository](https://github.com/abdelrahman-elreedy/window_frame/blob/main/lib/src/data/repositories/window_platform_repositories.dart): `lib/src/data/repositories/window_platform_repositories.dart`

### Native application

- [Plugin composition root](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/window_frame_plugin.cpp): `windows/window_frame_plugin.cpp`
- [Channel controller](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/presentation/window_channel.cpp): `windows/src/presentation/window_channel.cpp`
- [Window use cases](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/application/window_use_cases.cpp): `windows/src/application/window_use_cases.cpp`
- [Window session and options](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/domain/window_models.h): `windows/src/domain/window_models.h`
- [Window ports](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/domain/window_ports.h): `windows/src/domain/window_ports.h`

### Windows integration

- [Message dispatcher](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_message_pipeline.cpp): `windows/src/infrastructure/win32/win32_message_pipeline.cpp`
- [Window message handlers](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_message_handlers.cpp): `windows/src/infrastructure/win32/win32_message_handlers.cpp`
- [Win32 window gateway](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_window_gateway.cpp): `windows/src/infrastructure/win32/win32_window_gateway.cpp`
- [Native frame helpers](https://github.com/abdelrahman-elreedy/window_frame/blob/main/windows/src/infrastructure/win32/win32_frame.cpp): `windows/src/infrastructure/win32/win32_frame.cpp`

### Other components

- **Flutter app**
- **Windows window**

## Connections

- Flutter app → Frame scope: wraps app (evidence: `README.md`)
- Frame scope → Title bar: presents (evidence: `README.md`)
- Title bar controller → Bar content model: describes bar (evidence: `README.md`)
- Frame scope → Title bar controller: uses controller (evidence: `README.md`)
- Title bar → Caption buttons: shows buttons (evidence: `README.md`)
- Title bar → Drag and menus: offers interactions (evidence: `README.md`)
- Flutter app → Frame facade: initializes frame (evidence: `README.md`)
- Frame facade → Method-channel data source: sends commands
- Close coordinator → Method-channel data source: requests close
- Method-channel data source → Channel contract: uses contract
- Method-channel data source → Channel mappers: maps messages
- Platform repository → Method-channel data source: delegates calls
- Method-channel data source → Channel controller: invokes methods (evidence: `README.md`)
- Plugin composition root → Channel controller: registers channel (evidence: `windows/window_frame_plugin.cpp`)
- Plugin composition root → Message dispatcher: registers handlers
- Channel controller → Window use cases: dispatches commands
- Window use cases → Window ports: uses contracts
- Window session and options → Window use cases: holds session state
- Message dispatcher → Window message handlers: dispatches messages
- Window message handlers → Window use cases: synchronizes state
- Win32 window gateway → Window ports: implements gateway
- Win32 window gateway → Native frame helpers: uses frame helpers (evidence: `windows/src/infrastructure/win32/win32_frame.cpp`)
- Win32 window gateway → Windows window: controls window
- Window use cases → Win32 window gateway: controls window
