10000 GitHub - OmidHaqi/weather_app: A weather forecasting application built with Flutter, following Clean Architecture principles with a feature-based folder structure. The app features a modern blurry UI theme and offers functionalities like current weather, 5-day forecasts, and city bookmarking. This project integrates with the OpenWeatherMap API for weather data and uses the GeoDB
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
10000

A weather forecasting application built with Flutter, following Clean Architecture principles with a feature-based folder structure. The app features a modern blurry UI theme and offers functionalities like current weather, 5-day forecasts, and city bookmarking. This project integrates with the OpenWeatherMap API for weather data and uses the GeoDB

License

Notifications You must be signed in to change notification settings

OmidHaqi/weather_app

Repository files navigation

Weather App

A weather forecasting application built with Flutter, following Clean Architecture principles with a feature-based folder structure. The app features a modern blurry UI theme and offers functionalities like current weather, 5-day forecasts, and city bookmarking. This project integrates with the OpenWeatherMap API for weather data and uses the GeoDB Cities API for city selection.

Important

The purpose of this code is to implement Clean Architecture in the program. You may notice bugs in the UI. If so, please submit an issue or a pull request.

Features

  • Current Weather Data: Fetch weather updates.
  • 5-Day Forecast: View detailed weather forecasts for the next five days.
  • City Bookmarking: Save your favorite cities for quick access to weather updates.
  • Blurry UI Design: Enjoy a visually appealing, modern interface.
  • Feature-Based Clean Architecture: Organized code structure to separate concerns and enhance maintainability.
  • Comprehensive Testing: Includes unit tests, bloc tests, and UI tests.

Getting Started

Prerequisites

Ensure you have the following installed:

API Key Setup

This app requires an API key from OpenWeatherMap to fetch weather data. Follow the steps below to obtain and configure your API key:

  1. Get an API Key from OpenWeatherMap:

    • Visit the OpenWeatherMap website and create an account if you don't have one.
    • After signing up, log in to your account.
    • Navigate to the API keys section in your profile.
    • Generate a new API key and copy it.
  2. Add the API Key to the Project:

    • Open the file located at lib/core/utils/constants.dart.
    • Locate the apiKey1 variable and replace its value with your OpenWeatherMap API key. It should look like this:
    class Constants {
      static const baseUrl = 'https://api.openweathermap.org';
    
      static const apiKey1 = 'YOUR_API_KEY_HERE'; // Add your API_KEY here
    }
    • Replace 'YOUR_API_KEY_HERE' with the actual API key you obtained from OpenWeatherMap.

Installation

  1. Clone the repository:

    git clone https://github.com/omidhaqi/weather_app.git
  2. Navigate to the project directory:

    cd weather_app
  3. Install dependencies:

    flutter pub get

Running the App

To run the app on a connected device or emulator, use:

flutter run

Running Tests

To run all the tests, use:

flutter test

To run tests with coverage:

flutter test --coverage

To run a specific test file:

flutter test test/<test_file_name>.dart

Code Coverage (Optional)

To generate a code coverage report:

  1. Run tests with coverage:

    flutter test --coverage
  2. Generate and view the coverage report:

    genhtml coverage/lcov.info -o coverage/html
  3. Open coverage/html/index.html in your browser to view the detailed report.

Project Structure

This project follows a feature-based Clean Architecture structure. Each feature is organized into its own folder with separate layers for data, domain, and presentation:

lib
├── core
│   ├── params
│   │   └── forecast_params.dart
│   ├── resources
│   │   └── date_state.dart
│   ├── use_case
│   │   └── use_case.dart
│   ├── utils
│   │   ├── constants.dart
│   │   ├── date_converter.dart
│   │   └── themes.dart
│   └── widgets
│       ├── app_background.dart
│       ├── bottom_nav.dart
│       ├── dot_loading_widget.dart
│       └── main_wrapper.dart
├── features
│   ├── feature_bookmark
│   │   ├── data
│   │   │   ├── date_source
│   │   │   │   └── local
│   │   │   │       ├── city_dao.dart
│   │   │   │       ├── database.dart
│   │   │   │       └── database.g.dart
│   │   │   └── repository
│   │   │       └── city_repositoryimpl.dart
│   │   ├── domain
│   │   │   ├── entities
│   │   │   │   └── city_entity.dart
│   │   │   ├── repository
│   │   │   │   └── city_repository.dart
│   │   │   └── use_cases
│   │   │       ├── delete_city_usecase.dart
│   │   │       ├── get_all_city_usecase.dart
│   │   │       ├── get_city_usecase.dart
│   │   │       └── save_city_usecase.dart
│   │   └── presentation
│   │       ├── bloc
│   │       │   ├── bookmark_bloc.dart
│   │       │   ├── bookmark_event.dart
│   │       │   ├── bookmark_state.dart
│   │       │   ├── delete_city_status.dart
│   │       │   ├── get_all_city_status.dart
│   │       │   ├── get_city_status.dart
│   │       │   └── save_city_status.dart
│   │       ├── screens
│   │       │   └── bookmark_screen.dart
│   │       └── widgets
│   └── feature_weather
│       ├── data
│       │   ├── date_sorurce
│       │   │   └── remote
│       │   │       └── api_provider.dart
│       │   ├── model
│       │   │   ├── current_city_model.dart
│       │   │   ├── forecast_days_model.dart
│       │   │   └── suggest_city_model.dart
│       │   └── repository
│       │       └── weather_repository_impl.dart
│       ├── domain
│       │   ├── entities
│       │   │   ├── current_city_entity.dart
│       │   │   ├── forecase_days_entity.dart
│       │   │   └── suggest_city_entity.dart
│       │   ├── repository
│       │   │   └── weather_repository.dart
│       │   └── use_cases
│       │       ├── get_current_weather_usecase.dart
│       │       ├── get_forecast_weather_usecase.dart
│       │       └── get_suggestion_city_usecase.dart
│       └── presentation
│           ├── bloc
│           │   ├── cw_status.dart
│           │   ├── fw_status.dart
│           │   ├── home_bloc.dart
│           │   ├── home_event.dart
│           │   └── home_state.dart
│           ├── screens
│           │   └── home_screen.dart
│           └── widgets
│               ├── bookmark_icon.dart
│               ├── city_search.dart
│               └── day_weather_view.dart
├── locator.dart
└── main.dart

36 directories, 52 files

Floor and SQLite Integration

  • The Data Layer of the feature_bookmark module uses Floor and SQLite for local data persistence.
  • Floor serves as an abstraction layer over SQLite, simplifying database interactions.
  • The repository implementation in feature_bookmark/data/repository/city_repositoryimpl.dart interacts with Floor DAOs and SQLite directly to manage local city data.

Libraries & Tools Used

API References

Screenshots


License

This project is licensed under the Apache License - see the LICENSE file for details.

Version 0.0.1+1

Developed with ☕ by Umut

About

A weather forecasting application built with Flutter, following Clean Architecture principles with a feature-based folder structure. The app features a modern blurry UI theme and offers functionalities like current weather, 5-day forecasts, and city bookmarking. This project integrates with the OpenWeatherMap API for weather data and uses the GeoDB

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0