# alihassan20/akhbary architecture

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

- Interactive diagram: https://gitdiagram.com/alihassan20/akhbary
- Repository: https://github.com/alihassan20/akhbary

## Overview

##### Project type and purpose
- This is a Flutter-based mobile application (“akhbary”) for Android and iOS.
- It presents news fetched from an external API, organized into categories via bottom navigation and a drawer.

##### File structure
- android/, ios/
– Platform-specific wrappers (Gradle, Xcode) for building the Flutter engine and Dart code.
- lib/
– main.dart: App entry point.
– core/
· model/: ArticleModel, ListOfArticle – data representations.
· server/: NewsAPI – network client for fetching JSON.
– feature/
· screen/: Splash, HomePage, Details.
· bottom_screen/: Widgets for News categories (artist, health, politics, sports).
· drawer_screen/: Widgets for additional categories (general, health, technology).
– animation/: Custom animations for splash, transitions.
- test/: Basic widget test.
- pubspec.yaml: Declares Flutter SDK, HTTP and other dependencies.

##### README for additional insights
- Confirms the app is a “News Application with API.”
- Includes sample UI screenshots (splash, list, details).

##### Main components
a. Mobile Client (Flutter App)
- Presentation Layer
– Splash & animation (animation_splash.dart, raindrop_animation, HolePainter)
– UI Screens (home_page, details, bottom nav, drawer nav)
- Data Layer
– Models (ArticleModel, ListOfArticle)
– Network Service (NewsAPI: HTTP client, JSON parsing)
- Navigation & State
– BottomNavigationBar, DrawerWidget (no external state management library, state held in StatefulWidgets)
b. External Services
- News API Provider (third-party REST API)
- (Optional) Platform Services
– Android/iOS native storage or caching (not used in this version)

##### Relationships and interactions
- App launches → Splash animation → main.dart initializes → HomePage()
- HomePage requests NewsAPI.getArticles(category) → HTTP call → JSON response → parse into ArticleModel
- Data flows back to the UI → ListView.builder displays articles
- User taps an article → navigation to Details screen → UI renders ArticleModel details

##### Architectural patterns and design principles
- Layered architecture (Presentation → Domain/Models → Data/Network).
- Single responsibility: each Dart file handles one screen, model, or service.
- Widget composition for UI and animations.
- Separation of concerns: core/ for generic models & API, feature/ for UI.

## Diagram (Mermaid)

```mermaid
graph TB
  subgraph "Presentation Layer"
    direction TB
    Main["Main (lib/main.dart)"]:::presentation
    Splash["Splash Screen (animation_splash.dart)"]:::presentation
    AnimationHelpers["Animation Helpers"]:::presentation
    CustomPainter["Custom Painter"]:::presentation
    Raindrop["Raindrop Animation"]:::presentation
    Home["HomePage (home_page.dart)"]:::presentation
    Details["DetailsScreen (details.dart)"]:::presentation

    subgraph "Bottom Navigation Tabs"
      direction TB
      Artist["Artist News (artist.dart)"]:::presentation
      HealthTab["Health News Tab (health.dart)"]:::presentation
      Politics["Politics News Tab (politics.dart)"]:::presentation
      Sports["Sports News Tab (sports.dart)"]:::presentation
    end

    subgraph "Drawer Navigation"
      direction TB
      General["General News (general.dart)"]:::presentation
      HealthDrawer["Health News (healt.dart)"]:::presentation
      Tech["Technology News (tecnology.dart)"]:::presentation
    end
  end

  subgraph "Data Layer"
    direction TB
    ArticleModel["ArticleModel"]:::data
    ListOfArticle["ListOfArticle"]:::data
    NewsAPI["NewsAPI Client"]:::data
  end

  subgraph "External Services"
    direction TB
    NewsAPIService["News REST API"]:::external
  end

  subgraph "Platform Build Targets"
    direction TB
    Android["Android Build"]:::platform
    iOS["iOS Build"]:::platform
  end

  Main -->|"launches"| Splash
  Splash -->|"init animations"| AnimationHelpers
  Splash -->|"init painter"| CustomPainter
  Splash -->|"init raindrop"| Raindrop
  Splash -->|"navigate"| Home
  Home -->|"getArticles(category)"| NewsAPI
  NewsAPI -->|"HTTP GET /v2/top-headlines"| NewsAPIService
  NewsAPIService -->|"JSON response"| NewsAPI
  NewsAPI -->|"parse to models"| ArticleModel
  NewsAPI -->|"parse to list"| ListOfArticle
  ArticleModel -->|"data ready"| Home
  ListOfArticle -->|"data ready"| Home
  Home -->|"tap article"| Details
  Main -->|"build target"| Android
  Main -->|"build target"| iOS

  click Main "https://github.com/alihassan20/akhbary/blob/main/lib/main.dart"
  click Splash "https://github.com/alihassan20/akhbary/blob/main/lib/feature/screen/animation_splash.dart"
  click AnimationHelpers "https://github.com/alihassan20/akhbary/blob/main/lib/animation/animation_screen.dart"
  click CustomPainter "https://github.com/alihassan20/akhbary/blob/main/lib/animation/holeprainter.dart"
  click Raindrop "https://github.com/alihassan20/akhbary/blob/main/lib/animation/raindrop_animation.dart"
  click Home "https://github.com/alihassan20/akhbary/blob/main/lib/feature/screen/home_page.dart"
  click Details "https://github.com/alihassan20/akhbary/blob/main/lib/feature/screen/details.dart"
  click Artist "https://github.com/alihassan20/akhbary/blob/main/lib/feature/bottom_screen/artist.dart"
  click HealthTab "https://github.com/alihassan20/akhbary/blob/main/lib/feature/bottom_screen/health.dart"
  click Politics "https://github.com/alihassan20/akhbary/blob/main/lib/feature/bottom_screen/politics.dart"
  click Sports "https://github.com/alihassan20/akhbary/blob/main/lib/feature/bottom_screen/sports.dart"
  click General "https://github.com/alihassan20/akhbary/blob/main/lib/feature/drawer_screen/general.dart"
  click HealthDrawer "https://github.com/alihassan20/akhbary/blob/main/lib/feature/drawer_screen/healt.dart"
  click Tech "https://github.com/alihassan20/akhbary/blob/main/lib/feature/drawer_screen/tecnology.dart"
  click ArticleModel "https://github.com/alihassan20/akhbary/blob/main/lib/core/model/article_model.dart"
  click ListOfArticle "https://github.com/alihassan20/akhbary/blob/main/lib/core/model/list_of_artical.dart"
  click NewsAPI "https://github.com/alihassan20/akhbary/blob/main/lib/core/server/news_api.dart"
  click Android "https://github.com/alihassan20/akhbary/tree/main/android/"
  click iOS "https://github.com/alihassan20/akhbary/tree/main/ios/"

  classDef presentation fill:#f9f,stroke:#333,stroke-width:1px
  classDef data fill:#bbf,stroke:#333,stroke-width:1px
  classDef external fill:#bfb,stroke:#333,stroke-width:1px
  classDef platform fill:#ffb,stroke:#333,stroke-width:1px
```
