A beautiful, feature-rich weather application built with Flutter that provides current weather conditions, forecasts, and Android home screen widgets.
- Current Weather: Real-time weather conditions with detailed information
- Weather Forecast: 3-day weather forecast with hourly breakdowns
- Location Search: Search for weather in any location worldwide
- Temperature Units: Switch between Celsius and Fahrenheit
- Android Widgets: Home screen widgets for quick weather access
- Responsive Design: Optimized for both mobile and tablet devices
- Dark/Light Theme: Automatic theme switching based on system preferences
- Flutter SDK (3.0.0 or higher)
- Android Studio (for Android development)
- Xcode (for iOS development, macOS only)
- WeatherAPI.com account and API key
git clone <repository-url>
cd atmosflutter pub get- Visit WeatherAPI.com
- Sign up for a free account
- Navigate to your dashboard and copy your API key
- Open the
.envfile in the project root - Replace
YOUR_API_KEY_HEREwith your actual WeatherAPI.com API key:
WEATHER_API_KEY=your_actual_api_key_here
WEATHER_API_BASE_URL=https://api.weatherapi.com/v1flutter runflutter run --device-id <iOS-device-id>flutter run -d webThe .env file contains all configurable settings:
| Variable | Description | Default Value |
|---|---|---|
WEATHER_API_KEY |
Your WeatherAPI.com API key | Required |
WEATHER_API_BASE_URL |
WeatherAPI base URL | https://api.weatherapi.com/v1 |
APP_NAME |
Application name | Atmos Weather App |
DEFAULT_TEMPERATURE_UNIT |
Default temperature unit | celsius |
DEFAULT_UPDATE_INTERVAL_MINUTES |
Weather update interval | 30 |
DEFAULT_LOCATION |
Default location | Current Location |
WIDGET_UPDATE_INTERVAL_MINUTES |
Widget update interval | 60 |
DEBUG_MODE |
Enable debug logging | false |
The app uses a centralized configuration system located in lib/core/config/app_config.dart. Key settings include:
- Weather Settings: Cache duration, request timeout, forecast days
- Widget Settings: Update intervals, display options
- UI Settings: Animation durations, theme preferences
- Debug Settings: Logging levels, debug mode
lib/
├── core/
│ ├── config/ # App configuration
│ └── network/ # API client and networking
├── data/
│ ├── models/ # Data models
│ ├── repositories/ # Data repositories
│ ├── services/ # Business logic services
│ └── storage/ # Local storage
├── providers/ # State management
├── ui/
│ ├── screens/ # UI screens
│ └── widgets/ # Reusable widgets
└── main.dart # App entry point
- WeatherProvider: Manages weather data state
- SettingsProvider: Handles user preferences
- WeatherService: API communication layer
- AppConfig: Centralized configuration management
The app includes Android home screen widgets. To enable widgets:
-
Ensure the following permissions are in
AndroidManifest.xml:- Widget provider registration
- Widget configuration activity
- Widget update service
-
The widget files are located in:
android/app/src/main/kotlin/com/example/atmos/WeatherWidgetProvider.ktandroid/app/src/main/res/xml/weather_widget_info.xml
The app uses the following WeatherAPI.com endpoints:
- Current Weather:
/current.json - Forecast:
/forecast.json - Search:
/search.json
- API keys are stored in environment variables
- Never commit API keys to version control
- Use
.gitignoreto exclude.envfiles - Consider using secure storage for production apps
- 4x2 Grid Size: Default widget size
- Current Weather: Temperature and condition
- Location Display: Configurable location name
- Auto Updates: Background weather updates
- Tap Actions: Launch app from widget
Widgets can be configured through the widget configuration activity:
- Select location for weather display
- Customize display options
- Set update preferences
flutter testThe project includes widget tests for UI components:
flutter test test/flutter build apk --releaseflutter build appbundle --releaseflutter build ios --release- Store API keys securely using environment variables
- Implement proper error handling for API failures
- Validate user input for location searches
- Use HTTPS for all API communications
- Implement rate limiting for API calls
-
API Key Issues
- Verify API key is correct in
.envfile - Check WeatherAPI.com account status
- Ensure API key has proper permissions
- Verify API key is correct in
-
Location Issues
- Check location permissions in device settings
- Verify GPS/Network location is enabled
- Try searching for a different location
-
Widget Issues
- Ensure widget permissions are granted
- Check AndroidManifest.xml configuration
- Verify widget provider registration
Enable debug logging by setting DEBUG_MODE=true in .env:
DEBUG_MODE=true
LOG_LEVEL=debug- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- WeatherAPI.com for weather data
- Flutter for the amazing framework
- Open source community for contributions and inspiration
Made with ❤️ for weather enthusiasts everywhere!