display more data in daily weather widget, display weather icons
This commit is contained in:
@@ -18,6 +18,55 @@ class DailyWeatherModel {
|
||||
}
|
||||
}
|
||||
|
||||
int dailyAveragePressure() {
|
||||
double pressureSum = 0;
|
||||
int failuresInData = 0;
|
||||
for (HourlyWeatherModel forecast in hourlyForecasts) {
|
||||
if (forecast.pressure != null) {
|
||||
pressureSum = pressureSum + forecast.pressure!;
|
||||
} else {
|
||||
failuresInData += 1;
|
||||
}
|
||||
}
|
||||
return (pressureSum / (hourlyForecasts.length - failuresInData)).round();
|
||||
}
|
||||
|
||||
int dailyPrecipitation() {
|
||||
double precipitation = 0;
|
||||
for (HourlyWeatherModel forecast in hourlyForecasts) {
|
||||
if (forecast.precipitation != null) {
|
||||
precipitation = precipitation + forecast.precipitation!;
|
||||
}
|
||||
}
|
||||
return precipitation.round();
|
||||
}
|
||||
|
||||
int dailyAverageCloudCover() {
|
||||
double cloudCoverSum = 0;
|
||||
int failuresInData = 0;
|
||||
for (HourlyWeatherModel forecast in hourlyForecasts) {
|
||||
if (forecast.cloudCover != null) {
|
||||
cloudCoverSum = cloudCoverSum + forecast.cloudCover!;
|
||||
} else {
|
||||
failuresInData += 1;
|
||||
}
|
||||
}
|
||||
return (cloudCoverSum / (hourlyForecasts.length - failuresInData)).round();
|
||||
}
|
||||
|
||||
int dailyAverageWindSpeed() {
|
||||
double windSpeedSum = 0;
|
||||
int failuresInData = 0;
|
||||
for (HourlyWeatherModel forecast in hourlyForecasts) {
|
||||
if (forecast.windSpeed != null) {
|
||||
windSpeedSum = windSpeedSum + forecast.windSpeed!;
|
||||
} else {
|
||||
failuresInData += 1;
|
||||
}
|
||||
}
|
||||
return (windSpeedSum / (hourlyForecasts.length - failuresInData)).round();
|
||||
}
|
||||
|
||||
String dailyAverageTemp() {
|
||||
double tempSum = 0;
|
||||
for (var forecast in hourlyForecasts) {
|
||||
|
||||
Reference in New Issue
Block a user