# altafc22/csc_picker architecture

> Architecture diagram of the GitHub repository altafc22/csc_picker, 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/altafc22/csc_picker
- Repository: https://github.com/altafc22/csc_picker

## Overview

##### Project Type and Purpose
This is a Flutter package that provides a customizable dropdown widget for selecting countries, states, and cities with search functionality.

##### Main Components

A. Core Components:
- CSCPicker Widget (Main Component)
- DropdownWithSearch Widget
- Data Model Layer
- Asset Storage

B. Widget Architecture:
- User Interface Layer
- State Management Layer
- Data Layer

**┌─────────────────────────────────────────────────┐**
- CSCPicker Widget               │
- ┤

- ┌─────────────┐    ┌─────────────┐          │
- Country   │    │    State    │          │
- Dropdown   │───▶│   Dropdown  │          │
- ┘    └─────────────┘          │

- ▼                  ▼                  │
- ┌─────────────┐    ┌─────────────┐          │
- Search Bar  │    │    City     │          │
- Component  │    │   Dropdown  │          │
- ┘    └─────────────┘          │
- ┘

##### Data Flow Layer
**┌───────────────┐     ┌───────────────┐     ┌───────────────┐**
- JSON Data   │────▶│  Data Model   │────▶│    Widget     │
- (assets)    │     │    Layer      │     │    State      │
- ┘     └───────────────┘     └───────────────┘

##### Important elements to highlight

- Blue: Main widget container
- Green: Interactive components (dropdowns)
- Yellow: Data storage
- Orange: State management
- Gray: Utility components

- Rectangles: UI components
- Hexagons: State management

##### Specific features

- Flag display options (ENABLE/DISABLE/ShowInDropdownOnly)
- Layout options (Horizontal/Vertical)
- Search functionality
- Customization options (decoration, styling)
- Event callbacks (onCountryChanged, onStateChanged, onCityChanged)

##### Technical Details

**┌─────────────────────────────────────────────────┐**
- Configuration Options              │
- ┤
- Flag State Management                         │
- Layout Configuration                          │
- Dropdown Decorations                          │
- Search Placeholders                           │
- Default Values                                │
- Styling Options                               │
- ┘

##### Implementation Details
- Relationship between the main widget and its sub-components
- Data flow from JSON asset to UI
- Demonstrate the search functionality implementation
- State management for selected values

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Main
        CSCPicker["CSCPicker Widget"]
        click CSCPicker "https://github.com/altafc22/csc_picker/blob/master/lib/csc_picker.dart"
        
        subgraph UI["User Interface Components"]
            direction TB
            CountryDD["Country Dropdown"]
            StateDD["State Dropdown"]
            CityDD["City Dropdown"]
            SearchBar["Search Component"]
            click SearchBar "https://github.com/altafc22/csc_picker/blob/master/lib/dropdown_with_search.dart"
        end

        subgraph Data["Data Management"]
            direction TB
            DataModel["Data Model Layer"]
            click DataModel "https://github.com/altafc22/csc_picker/blob/master/lib/model/select_status_model.dart"
            JSONStore[("JSON Storage")]
            click JSONStore "https://github.com/altafc22/csc_picker/blob/master/lib/assets/country.json"
            TestSuite["Test Suite"]
            click TestSuite "https://github.com/altafc22/csc_picker/blob/master/test/csc_picker_test.dart"
        end

        subgraph Config["Configuration"]
            direction TB
            FlagConfig["Flag Display Options"]
            LayoutConfig["Layout Settings"]
            StyleConfig["Style Customization"]
        end

        subgraph Example["Implementation"]
            ExampleApp["Example App"]
            click ExampleApp "https://github.com/altafc22/csc_picker/blob/master/example/lib/main.dart"
        end
    end

    %% Relationships
    CSCPicker --> CountryDD
    CSCPicker --> StateDD
    CSCPicker --> CityDD
    CountryDD --> SearchBar
    StateDD --> SearchBar
    CityDD --> SearchBar
    
    JSONStore --> DataModel
    DataModel --> CSCPicker
    Config --> CSCPicker
    CSCPicker --> ExampleApp
    TestSuite --> CSCPicker

    %% Styling
    classDef widget fill:#3498db,stroke:#2980b9,color:white
    classDef ui fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef config fill:#e67e22,stroke:#d35400,color:white
    classDef test fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef example fill:#9b59b6,stroke:#8e44ad,color:white

    class CSCPicker widget
    class CountryDD,StateDD,CityDD,SearchBar ui
    class DataModel,JSONStore data
    class FlagConfig,LayoutConfig,StyleConfig config
    class TestSuite test
    class ExampleApp example

    %% Legend
    subgraph Legend
        L1["Widget Component"]:::widget
        L2["UI Element"]:::ui
        L3["Data Component"]:::data
        L4["Configuration"]:::config
        L5["Testing"]:::test
        L6["Example"]:::example
    end
```
