Skip to content

DangHuuLong/Weather-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌀️ Weather App

Flutter Dart Provider Bloc Dio SharedPreferences WeatherAPI WAQI

A Flutter mobile application for real-time weather monitoring and air quality tracking β€” with AQI metrics, pollutant breakdowns, multi-day forecasts, and personalized health recommendations.

πŸ“¦ Repository: github.com/DangHuuLong/Weather-App


🌟 Overview

Weather App is a Flutter application that combines live weather data and air quality index (AQI) information into a single mobile experience. Users are guided through an onboarding flow, authenticate via login, and land on a dashboard displaying current conditions, pollutant levels, hourly and 7-day forecasts, and AI-generated health recommendations based on live data.

The app integrates with WeatherAPI for weather data and WAQI for air quality data, using reverse geocoding to resolve human-readable location names from coordinates.


✨ Features

  • 🌬️ Onboarding β€” Multi-slide intro experience focused on breathing quality, pollution tracking, and exposure control
  • πŸ” Login β€” Email/password authentication with input validation
  • 🏠 Home Dashboard β€” Current weather, AQI overview, and upcoming forecast UI with cached data support
  • πŸ“ Location Details β€” Deep-dive view with pollutant metrics (O₃, PM10, NOβ‚‚, PM2.5, SOβ‚‚, CO), hourly weather, 7-day AQ forecast, 7-day weather forecast, and recommendation cards
  • πŸ“Š AQI Scale β€” Reference screen explaining AQI ranges and health categories
  • πŸ—ƒοΈ Data Bank β€” Data request form UI routing to location detail views
  • πŸ‘€ More β€” Profile and settings menu including Saved Locations, FAQ, Settings, About Us, Contact Us, and Logout
  • πŸ’Ύ Local Caching β€” Weather data and auth tokens stored locally via SharedPreferences
  • πŸ”„ Reverse Geocoding β€” Derives street/location names from device coordinates

πŸ—ΊοΈ App Flow

App Launch
    └── Onboarding (multi-slide intro)
            └── Login (email + password validation)
                    └── Root Page (bottom navigation)
                            β”œβ”€β”€ 🏠 Home
                            β”‚     └── Location Details
                            β”‚               └── AQI Scale
                            β”œβ”€β”€ πŸ—ƒοΈ Data Bank
                            └── πŸ‘€ More

After a successful login, the app navigates to the main shell with a bottom navigation bar. Auth tokens are persisted locally so returning sessions can be restored.


πŸ› οΈ Tech Stack

Flutter Dart Provider Bloc Dio SharedPreferences Freezed json_serializable Geocoding WeatherAPI WAQI

Concern Technology
Framework Flutter
Language Dart
State Management provider + flutter_bloc
HTTP Client dio
Local Storage shared_preferences
Geocoding geocoding
Code Generation freezed + json_serializable
Weather Data WeatherAPI
Air Quality Data WAQI
Auth API EscuelaJS

πŸ—οΈ Architecture

The project follows a layered architecture separating data access, state, and UI concerns:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            UI Layer              β”‚
β”‚   (page/ β€” screens & widgets)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         State Layer              β”‚
β”‚  (providers/ + flutter_bloc)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Data Layer              β”‚
β”‚  api/ Β· models/ Β· storage/       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β–Ό                     β–Ό
WeatherAPI              WAQI
(weather + forecast)  (air quality)
  • api/ β€” Remote service calls (WeatherAPI, WAQI, auth)
  • models/ β€” Typed data models, generated with freezed and json_serializable
  • storage/ β€” Local persistence for tokens and cached weather data
  • providers/ β€” Lightweight app-level state using provider
  • page/ β€” All screens and UI modules

πŸ“ Folder Structure

weather_app/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api/                        # Remote API service classes
β”‚   β”œβ”€β”€ models/                     # Dart data models (freezed/json)
β”‚   β”œβ”€β”€ page/
β”‚   β”‚   β”œβ”€β”€ aqi_scale/              # AQI scale reference screen
β”‚   β”‚   β”œβ”€β”€ data_bank/              # Data request form UI
β”‚   β”‚   β”œβ”€β”€ home/                   # Home dashboard screen
β”‚   β”‚   β”œβ”€β”€ location_details/       # Detailed AQ + weather view
β”‚   β”‚   β”œβ”€β”€ login.dart              # Login screen
β”‚   β”‚   β”œβ”€β”€ more.dart               # Profile / settings menu
β”‚   β”‚   β”œβ”€β”€ on_boarding.dart        # Onboarding slides
β”‚   β”‚   └── root_page.dart          # Bottom nav shell
β”‚   β”œβ”€β”€ providers/                  # Provider-based app state
β”‚   β”œβ”€β”€ storage/                    # SharedPreferences helpers
β”‚   └── main.dart                   # App entry point
β”œβ”€β”€ assets/                         # Images, icons, static files
β”œβ”€β”€ android/
β”œβ”€β”€ ios/
β”œβ”€β”€ linux/
β”œβ”€β”€ macos/
β”œβ”€β”€ web/
β”œβ”€β”€ windows/
β”œβ”€β”€ test/
β”œβ”€β”€ pubspec.yaml
└── README.md

🌐 API & Data Integration

☁️ WeatherAPI

Used to fetch current weather conditions, hourly forecasts, and 7-day weather forecasts based on location.

πŸ’¨ WAQI (World Air Quality Index)

Used to fetch real-time AQI data and individual pollutant readings including O₃, PM10, NOβ‚‚, PM2.5, SOβ‚‚, and CO.

πŸ“ Geocoding

Reverse geocoding via the geocoding package resolves human-readable street and location names from device coordinates.

πŸ” Auth API

Login and token management is handled via the EscuelaJS public API.

⚠️ API keys and tokens are currently configured directly in the source code. Ensure valid credentials are in place before running the app against live services.


πŸ’Ύ Local Storage

The app persists the following data locally using shared_preferences:

Key Contents
Access token JWT access token from login
Refresh token JWT refresh token
Cached weather Latest weather response for the default location

Cached weather data is used on the Home screen when fresh data is unavailable.


πŸ”„ State Management

The project uses two complementary state management approaches:

  • provider β€” Lightweight app-level state such as auth status and shared UI state
  • flutter_bloc β€” Bloc/Cubit pattern for more structured state in specific screens

Not every screen is fully wired to Bloc in the current implementation; some screens use Provider or local state directly.


πŸ“± Screens & Modules

πŸ›« Onboarding

Multi-slide introduction to the app. Messaging covers breathing better, tracking air pollution, and managing exposure. Leads to the login screen.

πŸ” Login

Email and password form with validation. On success, navigates to the main app shell. Auth tokens are stored locally.

🏠 Home

Displays current weather conditions and AQI for the current location. Shows a short forecast UI. Uses cached data when available and navigates to Location Details for a deeper view.

Note: The current implementation uses a default city configured in code.

πŸ“ Location Details

The most data-dense screen. Shows:

  • Current weather
  • Pollutant breakdown: O₃, PM10, NOβ‚‚, PM2.5, SOβ‚‚, CO
  • Hourly weather timeline
  • 7-day air quality forecast
  • 7-day weather forecast
  • Recommendation cards generated from live weather and AQ data

πŸ“Š AQI Scale

Informational screen explaining AQI value ranges and their associated health categories.

πŸ—ƒοΈ Data Bank

Form-based UI for data requests. Current implementation is primarily UI-driven and routes to location detail views.

πŸ‘€ More

Profile and settings menu with the following items:

  • Profile
  • Saved Location
  • FAQ
  • Settings
  • About Us
  • Contact Us
  • Logout

πŸš€ Getting Started

βœ… Prerequisites

  • Flutter SDK (stable channel recommended)
  • Dart (included with Flutter)
  • Android Studio, VS Code, or another Flutter-compatible IDE
  • A connected device or emulator

πŸ“¦ Installation

# Clone the repository
git clone https://github.com/DangHuuLong/Weather-App.git
cd Weather-App

# Install dependencies
flutter pub get

▢️ Run the App

flutter run

To generate code for freezed and json_serializable models:

dart run build_runner build --delete-conflicting-outputs

πŸ“Œ Notes / Current Limitations

  • The Home screen uses a default city value hard-coded in source. Dynamic location-based fetching may require additional permission and GPS configuration.
  • API keys for WeatherAPI and WAQI are currently embedded in the source code. For any fork or deployment, replace these with your own valid credentials.
  • The Data Bank screen is primarily UI-driven in the current state; a full backend data request flow has not been confirmed.
  • Some More menu items (e.g. Saved Location, Settings, About Us) may be partially implemented.
  • The project integrates both provider and flutter_bloc; state management coverage varies across screens.
  • Live data depends on active and valid API subscriptions to WeatherAPI and WAQI.

Built with ❀️ by DangHuuLong using Flutter & Dart
Repository

# 🌀️ Weather App

Flutter Dart Provider Bloc Dio SharedPreferences WeatherAPI WAQI

A Flutter mobile application for real-time weather monitoring and air quality tracking β€” with AQI metrics, pollutant breakdowns, multi-day forecasts, and personalized health recommendations.

πŸ“¦ Repository: github.com/DangHuuLong/Weather-App


🌟 Overview

Weather App is a Flutter application that combines live weather data and air quality index (AQI) information into a single mobile experience. Users are guided through an onboarding flow, authenticate via login, and land on a dashboard displaying current conditions, pollutant levels, hourly and 7-day forecasts, and AI-generated health recommendations based on live data.

The app integrates with WeatherAPI for weather data and WAQI for air quality data, using reverse geocoding to resolve human-readable location names from coordinates.


✨ Features

  • 🌬️ Onboarding β€” Multi-slide intro experience focused on breathing quality, pollution tracking, and exposure control
  • πŸ” Login β€” Email/password authentication with input validation
  • 🏠 Home Dashboard β€” Current weather, AQI overview, and upcoming forecast UI with cached data support
  • πŸ“ Location Details β€” Deep-dive view with pollutant metrics (O₃, PM10, NOβ‚‚, PM2.5, SOβ‚‚, CO), hourly weather, 7-day AQ forecast, 7-day weather forecast, and recommendation cards
  • πŸ“Š AQI Scale β€” Reference screen explaining AQI ranges and health categories
  • πŸ—ƒοΈ Data Bank β€” Data request form UI routing to location detail views
  • πŸ‘€ More β€” Profile and settings menu including Saved Locations, FAQ, Settings, About Us, Contact Us, and Logout
  • πŸ’Ύ Local Caching β€” Weather data and auth tokens stored locally via SharedPreferences
  • πŸ”„ Reverse Geocoding β€” Derives street/location names from device coordinates

πŸ—ΊοΈ App Flow

App Launch
    └── Onboarding (multi-slide intro)
            └── Login (email + password validation)
                    └── Root Page (bottom navigation)
                            β”œβ”€β”€ 🏠 Home
                            β”‚     └── Location Details
                            β”‚               └── AQI Scale
                            β”œβ”€β”€ πŸ—ƒοΈ Data Bank
                            └── πŸ‘€ More

After a successful login, the app navigates to the main shell with a bottom navigation bar. Auth tokens are persisted locally so returning sessions can be restored.


πŸ› οΈ Tech Stack

Flutter Dart Provider Bloc Dio SharedPreferences Freezed json_serializable Geocoding WeatherAPI WAQI

Concern Technology
Framework Flutter
Language Dart
State Management provider + flutter_bloc
HTTP Client dio
Local Storage shared_preferences
Geocoding geocoding
Code Generation freezed + json_serializable
Weather Data WeatherAPI
Air Quality Data WAQI
Auth API EscuelaJS

πŸ—οΈ Architecture

The project follows a layered architecture separating data access, state, and UI concerns:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            UI Layer              β”‚
β”‚   (page/ β€” screens & widgets)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         State Layer              β”‚
β”‚  (providers/ + flutter_bloc)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Data Layer              β”‚
β”‚  api/ Β· models/ Β· storage/       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β–Ό                     β–Ό
WeatherAPI              WAQI
(weather + forecast)  (air quality)
  • api/ β€” Remote service calls (WeatherAPI, WAQI, auth)
  • models/ β€” Typed data models, generated with freezed and json_serializable
  • storage/ β€” Local persistence for tokens and cached weather data
  • providers/ β€” Lightweight app-level state using provider
  • page/ β€” All screens and UI modules

πŸ“ Folder Structure

weather_app/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api/                        # Remote API service classes
β”‚   β”œβ”€β”€ models/                     # Dart data models (freezed/json)
β”‚   β”œβ”€β”€ page/
β”‚   β”‚   β”œβ”€β”€ aqi_scale/              # AQI scale reference screen
β”‚   β”‚   β”œβ”€β”€ data_bank/              # Data request form UI
β”‚   β”‚   β”œβ”€β”€ home/                   # Home dashboard screen
β”‚   β”‚   β”œβ”€β”€ location_details/       # Detailed AQ + weather view
β”‚   β”‚   β”œβ”€β”€ login.dart              # Login screen
β”‚   β”‚   β”œβ”€β”€ more.dart               # Profile / settings menu
β”‚   β”‚   β”œβ”€β”€ on_boarding.dart        # Onboarding slides
β”‚   β”‚   └── root_page.dart          # Bottom nav shell
β”‚   β”œβ”€β”€ providers/                  # Provider-based app state
β”‚   β”œβ”€β”€ storage/                    # SharedPreferences helpers
β”‚   └── main.dart                   # App entry point
β”œβ”€β”€ assets/                         # Images, icons, static files
β”œβ”€β”€ android/
β”œβ”€β”€ ios/
β”œβ”€β”€ linux/
β”œβ”€β”€ macos/
β”œβ”€β”€ web/
β”œβ”€β”€ windows/
β”œβ”€β”€ test/
β”œβ”€β”€ pubspec.yaml
└── README.md

🌐 API & Data Integration

☁️ WeatherAPI

Used to fetch current weather conditions, hourly forecasts, and 7-day weather forecasts based on location.

πŸ’¨ WAQI (World Air Quality Index)

Used to fetch real-time AQI data and individual pollutant readings including O₃, PM10, NOβ‚‚, PM2.5, SOβ‚‚, and CO.

πŸ“ Geocoding

Reverse geocoding via the geocoding package resolves human-readable street and location names from device coordinates.

πŸ” Auth API

Login and token management is handled via the EscuelaJS public API.

⚠️ API keys and tokens are currently configured directly in the source code. Ensure valid credentials are in place before running the app against live services.


πŸ’Ύ Local Storage

The app persists the following data locally using shared_preferences:

Key Contents
Access token JWT access token from login
Refresh token JWT refresh token
Cached weather Latest weather response for the default location

Cached weather data is used on the Home screen when fresh data is unavailable.


πŸ”„ State Management

The project uses two complementary state management approaches:

  • provider β€” Lightweight app-level state such as auth status and shared UI state
  • flutter_bloc β€” Bloc/Cubit pattern for more structured state in specific screens

Not every screen is fully wired to Bloc in the current implementation; some screens use Provider or local state directly.


πŸ“± Screens & Modules

πŸ›« Onboarding

Multi-slide introduction to the app. Messaging covers breathing better, tracking air pollution, and managing exposure. Leads to the login screen.

πŸ” Login

Email and password form with validation. On success, navigates to the main app shell. Auth tokens are stored locally.

🏠 Home

Displays current weather conditions and AQI for the current location. Shows a short forecast UI. Uses cached data when available and navigates to Location Details for a deeper view.

Note: The current implementation uses a default city configured in code.

πŸ“ Location Details

The most data-dense screen. Shows:

  • Current weather
  • Pollutant breakdown: O₃, PM10, NOβ‚‚, PM2.5, SOβ‚‚, CO
  • Hourly weather timeline
  • 7-day air quality forecast
  • 7-day weather forecast
  • Recommendation cards generated from live weather and AQ data

πŸ“Š AQI Scale

Informational screen explaining AQI value ranges and their associated health categories.

πŸ—ƒοΈ Data Bank

Form-based UI for data requests. Current implementation is primarily UI-driven and routes to location detail views.

πŸ‘€ More

Profile and settings menu with the following items:

  • Profile
  • Saved Location
  • FAQ
  • Settings
  • About Us
  • Contact Us
  • Logout

πŸš€ Getting Started

βœ… Prerequisites

  • Flutter SDK (stable channel recommended)
  • Dart (included with Flutter)
  • Android Studio, VS Code, or another Flutter-compatible IDE
  • A connected device or emulator

πŸ“¦ Installation

# Clone the repository
git clone https://github.com/DangHuuLong/Weather-App.git
cd Weather-App

# Install dependencies
flutter pub get

▢️ Run the App

flutter run

To generate code for freezed and json_serializable models:

dart run build_runner build --delete-conflicting-outputs

πŸ“Œ Notes / Current Limitations

  • The Home screen uses a default city value hard-coded in source. Dynamic location-based fetching may require additional permission and GPS configuration.
  • API keys for WeatherAPI and WAQI are currently embedded in the source code. For any fork or deployment, replace these with your own valid credentials.
  • The Data Bank screen is primarily UI-driven in the current state; a full backend data request flow has not been confirmed.
  • Some More menu items (e.g. Saved Location, Settings, About Us) may be partially implemented.
  • The project integrates both provider and flutter_bloc; state management coverage varies across screens.
  • Live data depends on active and valid API subscriptions to WeatherAPI and WAQI.

Built with ❀️ by DangHuuLong using Flutter & Dart
Repository

About

Flutter weather and air quality app with real-time AQI, pollutant metrics, forecasts, and health recommendations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors