@@ -41,46 +41,56 @@ class _PrebuiltFunctionScreenState extends State<PrebuiltFunctionScreen> {
41
41
///
42
42
/// Returns a [WeatherData] object containing the current weather information.
43
43
Future <WeatherData > _getCurrentweatherByCity () async {
44
- return openWeather.currentWeatherByCityName (cityName: _cityName, weatherUnits: WeatherUnits .METRIC );
44
+ return openWeather.currentWeatherByCityName (
45
+ cityName: _cityName, weatherUnits: WeatherUnits .METRIC );
45
46
}
46
47
47
48
/// Fetches the current weather data by geographic location.
48
49
///
49
50
/// Returns a [WeatherData] object containing the current weather information.
50
51
Future <WeatherData > _getCurrentweatherByLocation () async {
51
52
return openWeather.currentWeatherByLocation (
52
- latitude: _latitude, longitude: _longitude, weatherUnits: WeatherUnits .METRIC );
53
+ latitude: _latitude,
54
+ longitude: _longitude,
55
+ weatherUnits: WeatherUnits .METRIC );
53
56
}
54
57
55
58
/// Fetches the current weather data by zip code.
56
59
///
57
60
/// Returns a [WeatherData] object containing the current weather information.
58
61
Future <WeatherData > _getCurrentweatherByZipCode () async {
59
62
return openWeather.currentWeatherByZipCode (
60
- zipCode: _zipCode, countryCode: _countryCode, weatherUnits: WeatherUnits .METRIC );
63
+ zipCode: _zipCode,
64
+ countryCode: _countryCode,
65
+ weatherUnits: WeatherUnits .METRIC );
61
66
}
62
67
63
68
/// Fetches the five-day weather forecast by city name.
64
69
///
65
70
/// Returns a [WeatherForecastData] object containing the weather forecast information.
66
71
Future <WeatherForecastData > _getFiveDaysForecastByCityName () async {
67
- return openWeather.fiveDaysWeatherForecastByCityName (cityName: _cityName, weatherUnits: WeatherUnits .METRIC );
72
+ return openWeather.fiveDaysWeatherForecastByCityName (
73
+ cityName: _cityName, weatherUnits: WeatherUnits .METRIC );
68
74
}
69
75
70
76
/// Fetches the five-day weather forecast by geographic location.
71
77
///
72
78
/// Returns a [WeatherForecastData] object containing the weather forecast information.
73
79
Future <WeatherForecastData > _getFiveDaysForecastByLocation () async {
74
80
return openWeather.fiveDaysWeatherForecastByLocation (
75
- latitude: _latitude, longitude: _longitude, weatherUnits: WeatherUnits .METRIC );
81
+ latitude: _latitude,
82
+ longitude: _longitude,
83
+ weatherUnits: WeatherUnits .METRIC );
76
84
}
77
85
78
86
/// Fetches the five-day weather forecast by zip code.
79
87
///
80
88
/// Returns a [WeatherForecastData] object containing the weather forecast information.
81
89
Future <WeatherForecastData > _getFiveDaysForecastByZipCode () async {
82
90
return openWeather.fiveDaysWeatherForecastByZipCode (
83
- zipCode: _zipCode, countryCode: _countryCode, weatherUnits: WeatherUnits .METRIC );
91
+ zipCode: _zipCode,
92
+ countryCode: _countryCode,
93
+ weatherUnits: WeatherUnits .METRIC );
84
94
}
85
95
86
96
/// Builds a button that navigates back to the previous screen.
@@ -103,7 +113,9 @@ class _PrebuiltFunctionScreenState extends State<PrebuiltFunctionScreen> {
103
113
backgroundColor: Colors .white,
104
114
elevation: 0 ,
105
115
title: const Text ('OpenWeather prebuilt functions' ,
106
- style: TextStyle (color: Colors .black), maxLines: 2 , textAlign: TextAlign .center),
116
+ style: TextStyle (color: Colors .black),
117
+ maxLines: 2 ,
118
+ textAlign: TextAlign .center),
107
119
),
108
120
body: Container (
109
121
width: double .infinity,
@@ -121,12 +133,19 @@ class _PrebuiltFunctionScreenState extends State<PrebuiltFunctionScreen> {
121
133
),
122
134
WeatherSummary (
123
135
color: Colors .black,
124
- imageUrl: 'https://openweathermap.org/img/wn/${snapshot .data !.details .first .icon }@2x.png' ,
125
- currentTemperature: snapshot.data! .temperature.currentTemperature.toString (),
126
- maxTemperature: snapshot.data! .temperature.tempMax.toString (),
127
- minTemperature: snapshot.data! .temperature.tempMin.toString (),
128
- humidity: snapshot.data! .temperature.humidity.toString (),
129
- pressure: snapshot.data! .temperature.pressure.toString (),
136
+ imageUrl:
137
+ 'https://openweathermap.org/img/wn/${snapshot .data !.details .first .icon }@2x.png' ,
138
+ currentTemperature: snapshot
139
+ .data! .temperature.currentTemperature
140
+ .toString (),
141
+ maxTemperature:
142
+ snapshot.data! .temperature.tempMax.toString (),
143
+ minTemperature:
144
+ snapshot.data! .temperature.tempMin.toString (),
145
+ humidity:
146
+ snapshot.data! .temperature.humidity.toString (),
147
+ pressure:
148
+ snapshot.data! .temperature.pressure.toString (),
130
149
),
131
150
_buildButton ()
132
151
],
0 commit comments