# lucacivale/maui.bottomsheet architecture

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

- Interactive diagram: https://gitdiagram.com/lucacivale/maui.bottomsheet
- Repository: https://github.com/lucacivale/maui.bottomsheet

## Overview

##### Main Components
- Core Plugin Library – This is the heart of the project and is found under “src/Plugin.Maui.BottomSheet”. It encapsulates:
– Core classes: BottomSheet, BottomSheetContent, BottomSheetHeader, configuration classes, styles, and helper classes.
– Behaviors (e.g., BottomSheetPeekBehavior) used to drive UI interactions.
– Navigation components: BottomSheetNavigationService, navigation parameters, and supporting classes (e.g., BottomSheetStack).
– Hosting/Extension methods: In the “Hosting” folder (e.g., MauiAppBuilderExtensions and IServiceCollectionExtensions) that integrate the plugin with a MAUI app.
- Sample Application – Located in the “sample/Plugin.Maui.BottomSheet.Sample” folder, this mature MAUI app uses XAML and code-behind to demonstrate the plugin’s API (including pages like ShowCasePage, custom headers, and integration with MVVM).
- CI/CD & Repository Configuration – GitHub workflows and supporting configuration files indicate the continuous integration setup but are peripheral to the system architecture.

##### Relationships and Interactions
- The Core Library (bottom sheet components, styles, navigation, etc.) is designed to be integrated into any MAUI application. The extension methods (UseBottomSheet and others) allow the plugin to be registered during app startup.
- The Navigation Service interacts directly with the Core BottomSheet components so that page navigation, parameter passing, and lifecycle events (Opening, Opened, Closing, Closed) are managed centrally.
- Platform-Specific Handlers adapt the behavior of the BottomSheet to native platforms. For instance, separate handler implementations exist for Android (with Android-specific themes, edge-to-edge configurations, etc.) and for iOS/MacCatalyst.
- The sample application consumes the Core Library by referencing the extension methods and showing both XAML usage and code-behind examples.
- The MVVM pattern is apparent in both the sample project and the navigation approach (i.e., using BindingContexts with pages and bottom sheets).

##### Architectural Patterns and Design Principles
- Modularity & Separation of Concerns: The core functionalities (UI definition, behavior, navigation, styles) are separated into distinct classes and folders. Platform abstraction is achieved by having separate directories for Android, iOS/MacCatalyst, Tizen, etc.
- Dependency Injection & Hosting: Using extension methods, the plugin neatly integrates with MAUI’s dependency injection container, allowing for easy registration of services and navigation.
- MVVM and XAML: The sample usage emphasizes MVVM support by using binding contexts, view models, and XAML-based design.

##### Final Elements
– Avoid overcomplicating it; focus on representing as many distinct components as possible with their interactions clearly mapped.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Core Plugin Library"
        direction TB
            BS_UI["BottomSheet (UI)"]:::core
            BS_Content["BottomSheetContent (UI)"]:::core
            BS_Header["BottomSheetHeader (UI)"]:::core
            Behavior["BottomSheetPeekBehavior"]:::behavior
            NS["BottomSheetNavigationService"]:::navigation
            NPar["BottomSheetNavigationParameters"]:::navigation
            NST["BottomSheetStack"]:::navigation
            ME["MauiAppBuilderExtensions"]:::hosting
            ISCE["IServiceCollectionExtensions"]:::hosting
    end

    subgraph "Platform-Specific Handlers"
        direction TB
            Android_Platform["Android Platform"]:::platform
            Android_Handler["BottomSheetHandler.android"]:::platform
            iOS_Platform["iOS/MacCatalyst Platform"]:::platform
            iOS_Handler["BottomSheetHandler.macios"]:::platform
            Others["Other Platforms (Tizen,Windows)"]:::platform
    end

    subgraph "Sample Application"
        direction TB
            Sample_App["Plugin.Maui.BottomSheet.Sample"]:::sample
    end

    %% Relationships
    Sample_App -->|"UseBottomSheet()"| ME
    Sample_App -->|"UseBottomSheet()"| ISCE
    ME -->|"RegistersPlugin"| NS
    ISCE -->|"RegistersPlugin"| NS
    NS -->|"InvokesBottomSheet"| BS_UI
    NS --> NPar
    NS --> NST
    Behavior -->|"AttachesTo"| BS_UI
    BS_UI -->|"Contains"| BS_Content
    BS_UI -->|"Contains"| BS_Header
    BS_UI -->|"PlatformAbstraction"| Android_Platform
    BS_UI -->|"PlatformAbstraction"| iOS_Platform
    Android_Platform --> Android_Handler
    iOS_Platform --> iOS_Handler

    %% Styles
    classDef core fill:#f9e,stroke:#333,stroke-width:2px;
    classDef behavior fill:#fee,stroke:#333,stroke-width:2px;
    classDef navigation fill:#efe,stroke:#333,stroke-width:2px;
    classDef hosting fill:#ffc,stroke:#333,stroke-width:2px;
    classDef platform fill:#ccf,stroke:#333,stroke-width:2px;
    classDef sample fill:#cfc,stroke:#333,stroke-width:2px;

    %% Click Events
    click BS_UI "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/BottomSheet.cs"
    click BS_Content "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/BottomSheetContent.cs"
    click BS_Header "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/BottomSheetHeader.cs"
    click Behavior "https://github.com/lucacivale/maui.bottomsheet/tree/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Behaviors/BottomSheetPeekBehavior"
    click NS "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Navigation/BottomSheetNavigationService.cs"
    click NPar "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Navigation/BottomSheetNavigationParameters.cs"
    click NST "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Navigation/BottomSheetStack.cs"
    click ME "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Hosting/MauiAppBuilderExtensions.cs"
    click ISCE "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Hosting/IServiceCollectionExtensions.cs"
    click Android_Platform "https://github.com/lucacivale/maui.bottomsheet/tree/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Platform/Android"
    click Android_Handler "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Handlers/BottomSheetHandler.android.cs"
    click iOS_Platform "https://github.com/lucacivale/maui.bottomsheet/tree/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Platform/MaciOS"
    click iOS_Handler "https://github.com/lucacivale/maui.bottomsheet/blob/main/src/Plugin.Maui.BottomSheet/Plugin.Maui.BottomSheet/Handlers/BottomSheetHandler.macios.cs"
    click Sample_App "https://github.com/lucacivale/maui.bottomsheet/blob/main/sample/Plugin.Maui.BottomSheet.Sample/Plugin.Maui.BottomSheet.Sample"
```
