# thesheerazali/adaptive_design_utils architecture

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

- Interactive diagram: https://gitdiagram.com/thesheerazali/adaptive_design_utils
- Repository: https://github.com/thesheerazali/adaptive_design_utils

## Overview

##### Project type and purpose
- This is a Flutter “federated” plugin package called adaptive_design_utils.
- It provides:
- A core Dart library of responsive widgets & utilities (lib/src)
- A platform‐interface layer for cross‐platform abstraction
- A method‐channel implementation
- Native Android (Kotlin) and iOS (Swift) plugin code
- An example Flutter app demonstrating all features

##### File structure
- Top‐level folders:
- lib/ – primary Dart code, exports, source modules (responsive widgets, breakpoints, utilities)
- android/ and ios/ – native plugin code for each platform
- example/ – full Flutter application (Android & iOS) using the plugin
- test/ – Dart unit tests for the core & method‐channel logic
- Key plugin‐related files:
- flutter_responsive_utils_platform_interface.dart – defines the abstract API
- flutter_responsive_utils_method_channel.dart – invokes the native platform channel
- AndroidManifest.xml, build.gradle, Gradle wrapper under android/
- FlutterResponsiveUtilsPlugin.kt under android/src/main/kotlin
- FlutterResponsiveUtilsPlugin.swift under ios/Classes

##### README insights
- Core functionality: device detection, breakpoints, adaptive layouts, typography, alerts
- App initializes AdaptiveDesignUtils with BuildContext
- App UI imports and uses widgets and utilities
- Some utilities (e.g., DeviceUtils.getDeviceType) require native info via MethodChannel

##### Main components & their interactions
a. Core Dart SDK components (lib/src)
- ResponsiveWidgets, ScreenUtils, DeviceUtils, AlertUtils, Breakpoints, AdaptiveTypography
- Exposed via lib/adaptive_design_utils.dart and lib/flutter_responsive_utils.dart
b. Platform Interface
- Defines the abstract class for device/platform queries
c. Method‐Channel Implementation
- Implements the interface, marshals calls over Flutter’s MethodChannel
d. Native Plugins
- Android (Kotlin) and iOS (Swift) register on app startup, listen on the channel, reply with native device info
e. Example Flutter App
- UI Layer demonstrating all features, calls into the plugin package
f. Tests & CI
- Unit tests for pure Dart logic & for method channel glue

##### Architectural patterns & design principles
- Federated plugin: separation of core, interface, and platform implementations
- Layered architecture: UI Widgets → Core Logic → Platform Interface → Native Layer
- Zero‐dependency Dart library for pure-Pub usage where possible
- Single MethodChannel for all native calls

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Example App Layer
    subgraph "Example Flutter App"
        direction TB
        ExampleMain["main.dart"]:::example
        MainActivity["MainActivity.kt"]:::example
        IntegrationTest["plugin_integration_test.dart"]:::example
    end

    %% Dart Library Layer
    subgraph "Dart Library (Core Logic / Widgets)" 
        direction TB
        EntryAdaptive["adaptive_design_utils.dart"]:::dart
        EntryResponsive["flutter_responsive_utils.dart"]:::dart
        CoreWidgets["responsive_widgets.dart"]:::dart
        ScreenUtils["screen_utils.dart"]:::dart
        DeviceUtils["device_utils.dart"]:::dart
        AlertUtils["alert_utils.dart"]:::dart
        Breakpoints["breakpoints.dart"]:::dart
        AdvTypography["advanced_typography.dart"]:::dart
        Typography["typography.dart"]:::dart
        Extensions["responsive_extensions.dart"]:::dart
    end

    %% Platform Interface & MethodChannel Layer
    subgraph "Platform Interface & MethodChannel" 
        direction TB
        PlatformInterface["flutter_responsive_utils_platform_interface.dart"]:::interface
        MethodChannelImpl["flutter_responsive_utils_method_channel.dart"]:::interface
    end

    %% Native Android Plugin
    subgraph "Android Native Plugin"
        direction TB
        AndroidPlugin1["AdaptiveDesignUtilsPlugin.kt"]:::android
        AndroidPlugin2["FlutterResponsiveUtilsPlugin.kt"]:::android
        AndroidManifest["AndroidManifest.xml"]:::android
        AndroidBuild["build.gradle"]:::android
        AndroidSettings["settings.gradle"]:::android
    end

    %% Native iOS Plugin
    subgraph "iOS Native Plugin"
        direction TB
        IOSPlugin["FlutterResponsiveUtilsPlugin.swift"]:::ios
        Podspec["adaptive_design_utils.podspec"]:::ios
    end

    %% Tests & CI
    subgraph "Tests & CI" 
        direction TB
        class TestsSubgraph tests
        TestDart1["flutter_responsive_utils_test.dart"]:::tests
        TestDart2["flutter_responsive_utils_method_channel_test.dart"]:::tests
        TestAndroid["FlutterResponsiveUtilsPluginTest.kt"]:::tests
        TestWidget["widget_test.dart"]:::tests
    end

    %% Dependencies
    FlutterEngine["Flutter Engine / Dart VM"]:::external

    %% Connections
    ExampleMain -->|"imports"| EntryAdaptive
    ExampleMain -->|"imports"| EntryResponsive
    ExampleMain -->|"runs on"| FlutterEngine
    EntryAdaptive -->|"exports"| CoreWidgets
    EntryAdaptive -->|"exports"| ScreenUtils
    EntryAdaptive -->|"exports"| DeviceUtils
    EntryAdaptive -->|"exports"| AlertUtils
    EntryAdaptive -->|"exports"| Breakpoints
    EntryAdaptive -->|"exports"| AdvTypography
    EntryAdaptive -->|"exports"| Typography
    EntryAdaptive -->|"exports"| Extensions
    EntryResponsive -->|"re-exports"| EntryAdaptive
    CoreWidgets -->|"calls"| PlatformInterface
    ScreenUtils -->|"calls"| PlatformInterface
    DeviceUtils -->|"calls"| PlatformInterface
    PlatformInterface -->|"delegates to"| MethodChannelImpl
    MethodChannelImpl -->|"invokeMethod('getDeviceType')"| AndroidPlugin1
    MethodChannelImpl -->|"invokeMethod('getDeviceType')"| IOSPlugin
    AndroidPlugin1 -->|"returns native info"| MethodChannelImpl
    IOSPlugin -->|"returns native info"| MethodChannelImpl
    MethodChannelImpl -->|"returns result"| PlatformInterface
    PlatformInterface -->|"returns result"| CoreWidgets
    CoreWidgets -->|"renders UI in"| ExampleMain
    MainActivity -->|"hosts Flutter app"| FlutterEngine
    IntegrationTest -->|"validates plugin"| ExampleMain

    %% Click Events
    click CoreWidgets "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/responsive_widgets.dart"
    click ScreenUtils "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/screen_utils.dart"
    click DeviceUtils "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/device_utils.dart"
    click AlertUtils "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/alert_utils.dart"
    click Breakpoints "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/breakpoints.dart"
    click AdvTypography "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/advanced_typography.dart"
    click Typography "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/typography.dart"
    click Extensions "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/src/responsive_extensions.dart"
    click EntryAdaptive "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/adaptive_design_utils.dart"
    click EntryResponsive "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/flutter_responsive_utils.dart"
    click PlatformInterface "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/flutter_responsive_utils_platform_interface.dart"
    click MethodChannelImpl "https://github.com/thesheerazali/adaptive_design_utils/blob/main/lib/flutter_responsive_utils_method_channel.dart"
    click AndroidPlugin1 "https://github.com/thesheerazali/adaptive_design_utils/blob/main/android/src/main/kotlin/com/example/adaptive_design_utils/AdaptiveDesignUtilsPlugin.kt"
    click AndroidPlugin2 "https://github.com/thesheerazali/adaptive_design_utils/blob/main/android/src/main/kotlin/com/example/flutter_responsive_utils/FlutterResponsiveUtilsPlugin.kt"
    click AndroidManifest "https://github.com/thesheerazali/adaptive_design_utils/blob/main/android/src/main/AndroidManifest.xml"
    click AndroidBuild "https://github.com/thesheerazali/adaptive_design_utils/blob/main/android/build.gradle"
    click AndroidSettings "https://github.com/thesheerazali/adaptive_design_utils/blob/main/android/settings.gradle"
    click IOSPlugin "https://github.com/thesheerazali/adaptive_design_utils/blob/main/ios/Classes/FlutterResponsiveUtilsPlugin.swift"
    click Podspec "https://github.com/thesheerazali/adaptive_design_utils/blob/main/ios/adaptive_design_utils.podspec"
    click ExampleMain "https://github.com/thesheerazali/adaptive_design_utils/blob/main/example/lib/main.dart"
    click MainActivity "https://github.com/thesheerazali/adaptive_design_utils/blob/main/example/android/app/src/main/kotlin/com/example/flutter_responsive_utils_example/MainActivity.kt"
    click IntegrationTest "https://github.com/thesheerazali/adaptive_design_utils/blob/main/example/integration_test/plugin_integration_test.dart"
    click TestDart1 "https://github.com/thesheerazali/adaptive_design_utils/blob/main/test/flutter_responsive_utils_test.dart"
    click TestDart2 "https://github.com/thesheerazali/adaptive_design_utils/blob/main/test/flutter_responsive_utils_method_channel_test.dart"
    click TestAndroid "https://github.com/thesheerazali/adaptive_design_utils/blob/main/android/src/test/kotlin/com/example/flutter_responsive_utils/FlutterResponsiveUtilsPluginTest.kt"
    click TestWidget "https://github.com/thesheerazali/adaptive_design_utils/blob/main/example/test/widget_test.dart"

    %% Styles
    classDef dart fill:#add8e6,stroke:#000,stroke-width:1px
    classDef interface fill:#90ee90,stroke:#000,stroke-width:1px
    classDef android fill:#ffa500,stroke:#000,stroke-width:1px
    classDef ios fill:#ffb6c1,stroke:#000,stroke-width:1px
    classDef example fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef tests fill:#cccccc,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#ffffff,stroke:#000,stroke-width:1px,stroke-dasharray: 2 2
```
