# wiradikusuma/flutter_sticky_infinite_list architecture

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

- Interactive diagram: https://gitdiagram.com/wiradikusuma/flutter_sticky_infinite_list
- Repository: https://github.com/wiradikusuma/flutter_sticky_infinite_list

## Overview

##### Main Components Identification

The system should be represented as a widget-based architecture with the following key components:

a) Core Components:
- InfiniteList (Main Container Widget)
- InfiniteListItem (List Item Container)
- StickyListItem (Independent Sticky Item)
- StickyListItemRenderObject (Rendering Logic)

b) Supporting Components:
- Models Layer (alignments.dart, sticky_state.dart, types.dart)
- Render Layer (render.dart)

**Top Level (Widget Layer):**
- InfiniteList
- ScrollView Management
- Item Management

**Middle Level (Item Layer):**
- InfiniteListItem/StickyListItem
- Header Management
- Content Management
- Position Calculation

**Bottom Level (Implementation Layer):**
- Models
- Render Logic
- State Management

##### Component Relationships

- Blue: Widget components
- Green: Data models
- Orange: Render logic
- Gray: Supporting utilities

- Double lines: Data flow

##### Specific Implementation Details

a) Scroll Direction Management:
- Vertical scroll support
- Horizontal scroll support
- Multi-directional infinite scrolling

b) Header Positioning System:
- Relative positioning
- Overlay positioning
- Cross-axis alignment
- Main-axis alignment

c) State Management:
- StickyState tracking
- Calculations
- Offset management

##### Key Interactions to Highlight

- Scroll event handling flow
- Header position calculation process
- Content-header relationship
- Viewport interaction

##### Implementation Notes

- Version compatibility notes (Flutter 1.20+)
- Extension points for customization
- Integration points with ScrollView

Remember to include notes about the package's key features:
- Multi-directional infinite scrolling
- Customizable header positioning
- Dynamic header building
- Independent sticky item usage
- Stream-based position updates

This will provide a comprehensive view of how the package works while maintaining clarity about its architecture and implementation details.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Widget Layer"
        IL["InfiniteList"]:::widget
        SV["ScrollView Management"]:::widget
        IM["Item Management"]:::widget
        
        IL --> SV
        IL --> IM
    end

    subgraph "Item Layer"
        ILI["InfiniteListItem"]:::widget
        SLI["StickyListItem"]:::widget
        HM["Header Management"]:::widget
        CM["Content Management"]:::widget
        PC["Position Calculation"]:::widget
        
        ILI --> HM
        ILI --> CM
        SLI --> PC
        SLI --> HM
    end

    subgraph "Implementation Layer"
        RO["Render Object"]:::render
        AM["Alignment Management"]:::model
        SM["State Management"]:::model
        TD["Type Definitions"]:::model
        
        RO --> AM
        RO --> SM
        SM --> TD
    end

    IL --> ILI
    IL --> SLI
    ILI --> RO
    SLI --> RO
    
    subgraph "Features"
        MS["Multi-directional Scrolling"]:::feature
        HP["Header Positioning"]:::feature
        SP["Stream Position Updates"]:::feature
        
        IL -.-> MS
        HM -.-> HP
        PC -.-> SP
    end

    %% Component Mappings
    click IL "https://github.com/wiradikusuma/flutter_sticky_infinite_list/blob/master/lib/sticky_infinite_list.dart"
    click ILI "https://github.com/wiradikusuma/flutter_sticky_infinite_list/blob/master/lib/widget.dart"
    click SLI "https://github.com/wiradikusuma/flutter_sticky_infinite_list/blob/master/lib/widget.dart"
    click RO "https://github.com/wiradikusuma/flutter_sticky_infinite_list/blob/master/lib/render.dart"
    click AM "https://github.com/wiradikusuma/flutter_sticky_infinite_list/blob/master/lib/models/alignments.dart"
    click SM "https://github.com/wiradikusuma/flutter_sticky_infinite_list/blob/master/lib/models/sticky_state.dart"
    click TD "https://github.com/wiradikusuma/flutter_sticky_infinite_list/blob/master/lib/models/types.dart"

    %% Styles
    classDef widget fill:#3498db,stroke:#2980b9,color:white
    classDef model fill:#2ecc71,stroke:#27ae60,color:white
    classDef render fill:#e67e22,stroke:#d35400,color:white
    classDef feature fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1["Widget Component"]:::widget
        L2["Data Model"]:::model
        L3["Render Logic"]:::render
        L4["Feature"]:::feature
    end
```
