Skip to content

Kavindya-Kariyawasam/clima-track-flutter

Repository files navigation

ClimaTrack 🌤️

A compact, location-based weather dashboard built with Flutter. It calculates coordinates from a student index, queries Open‑Meteo for current weather, and caches the last successful result for offline use.

Quick links

  • Project: ClimaTrack
  • Language: Dart / Flutter
  • Repo: clima-track

Features

  • Index-based coordinate calculation (from a student index)
  • Real-time weather from Open‑Meteo
  • Offline caching with shared_preferences
  • Clean Material UI with error handling and retry
  • Displays the raw API request URL for verification

Tech stack

  • Flutter 3.x+
  • http, shared_preferences, intl (see pubspec.yaml)

Getting started

Prerequisites

  • Flutter SDK (3.0 or higher)
  • Android Studio or VS Code (recommended)
  • Emulator or physical device for testing

Installation

  1. Clone the repo and enter the directory
git clone https://github.com/Kavindya-Kariyawasam/clima-track-flutter.git
cd clima-track
  1. Install dependencies
flutter pub get

Running the app

# Run on default device (choose with -d)
flutter run

# Run on Chrome (web)
flutter run -d chrome

# List connected devices
flutter devices

# Build a release APK
flutter build apk --release

Tip: while flutter run is active, press r for hot reload (preserves state) and R for hot restart (resets state).

Project structure

lib/
├── main.dart
├── models/
├── services/
├── utils/
├── widgets/
└── screens/

How it works (brief)

  1. Convert a student index (e.g., 224174B) into latitude/longitude using a simple digit mapping.
  2. Build the Open‑Meteo API URL with the calculated coordinates and current_weather=true.
  3. Fetch current weather and show on the UI; on success, cache the response for offline use.

Example conversion (illustrative):

  • lat = 5 + (22 / 10.0) = 7.2
  • lon = 79 + (41 / 10.0) = 83.1

API reference

  • Base: https://api.open-meteo.com/v1/forecast
  • Query params: latitude, longitude, current_weather=true

Response fields used: temperature (°C), wind speed, weather code (WMO)

Development & debugging

Common commands

# Install/upgrade deps
flutter pub get
flutter pub upgrade

# Run (pick device with -d)
flutter run

# Clean and rebuild
flutter clean
flutter pub get

# Format, analyze, test
dart format .
flutter analyze
flutter test

# Verbose run for troubleshooting
flutter run -v

# Diagnose environment
flutter doctor -v

Tips

  • Use debugPrint() for long logs.
  • Use Flutter DevTools for widget inspection and performance profiling.
  • On macOS, if CocoaPods issues occur: cd ios && pod repo update && pod install.
  • If plugin registration problems appear, try flutter clean then flutter pub get and rebuild.

Offline testing

  1. Run the app and fetch weather successfully.
  2. Toggle Airplane Mode on the device/emulator.
  3. Fetch again — cached data should be shown with a "CACHED" indicator.

CI / release notes

  • Commit pubspec.lock for apps to ensure consistent dependency versions across CI and developers.
  • This repo includes GitHub Actions workflows under .github/workflows/ for linting, analysis, PR checks, and APK builds.

Acknowledgments

  • Weather data: Open‑Meteo
  • Icons: Flutter Material icons

About

A location-based weather dashboard built with Flutter that provides real-time weather information using coordinate-derived positioning. Features offline caching, clean material design UI, and seamless error handling for reliable weather updates anywhere.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors