A weather app made with flutter using openweathermap.org api .
This is a weather app made using flutter and openweathermap.org api, with many features like dark-mode
, favorite city
,weekly data
and current location weather data
.
💻Important packages used in this app
-
Location tracking and current location These packages help with the current location
geocoding: ^2.0.1 geolocator: ^9.0.2
Location tracking script
This simple dart script allow to fetch the current location
Future<Position> getPos() async { bool _enabled; LocationPermission permission; _enabled = await Geolocator.isLocationServiceEnabled(); if (!_enabled) { logger.shout("Permissions are disabled") return Future.error('Location permission are disabled'); } permission = await Geolocator.checkPermission(); if (permission == LocationPermission.denied) { permission = await Geolocator.requestPermission(); if (permission == LocationPermission.denied) { logger.shout("User denied permission") return Future.error('Permission are denied'); } } if (permission == LocationPermission.deniedForever) { logger.shout("permanently denied permission") return Future.error('permission are denied forever'); } return await Geolocator.getCurrentPosition(); }
-
State Management For state management we have used bloc, which help to separates our business logic from our UI.
💓 Feature
- We have a weather details page where we provide a graphical and card based views for weather related information.
- A location can be made ❤️ favorite which are saved in
shared-preferences
as favorites. Those locations weather is shown as small cards in the second tab.
- Search a weather app is not dynamic if there is no search functionality, you can search for a city if it's a valid
city
according to openweathermap.org.
-
🕶️ Dark Theme ,who loves light theme right, there is a theme-switcher which switch theme from
light-mode
todark-mode
and vice-versa. -
Over many timezones there is 🕙
24:00
format thus there is also a switch for that named 24:00 clock format
The assets
are provided in the assets
directory which mainly contain the app icon ,and api
folder contains files related to api responses and icon
folder contains all the images for ☁️ weather icons
🌈.
To run the app. Primary need an you need to have a API KEY
from openweathermap.org.
To get one log into openweathermap.org and create an API_KEY
Then,
-
🌀 Clone this repo.
git clone https://github.com/tuuhin/weather_app cd weather_app
-
Create an
.env
file in the$root
projecttouch .env
-
Add the api key to your .env file
API_KEY=YOUR_API_KEY
-
👍 You are now all done with the extra configuration, to run the app
flutter pub get flutter run
This Weather app was one of my first flutter project and after the results, it fill all of my requirements 😃.