Skip to content

Commit

Permalink
added uv-index, cloudcover, dynamic_color
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonavichus committed Apr 16, 2023
1 parent 16261dd commit c0e865e
Show file tree
Hide file tree
Showing 13 changed files with 308 additions and 79 deletions.
Binary file removed assets/images/air_quality.png
Binary file not shown.
Binary file modified assets/images/cloudy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
2 changes: 1 addition & 1 deletion lib/app/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class WeatherAPI {

Future<Iterable<Result>> getSuggestions(String query, Locale? locale) async {
final url =
'https://geocoding-api.open-meteo.com/v1/search?name=$query&count=10&language=${locale?.languageCode}&format=json';
'https://geocoding-api.open-meteo.com/v1/search?name=$query&count=5&language=${locale?.languageCode}&format=json';
try {
Response response = await dioLocation.get(url);
if (response.statusCode == 200) {
Expand Down
1 change: 1 addition & 0 deletions lib/app/data/weather.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Settings {
bool? theme;
bool location = false;
bool notifications = false;
bool materialColor = false;
String measurements = 'metric';
String degrees = 'celsius';
String timeformat = '24';
Expand Down
107 changes: 81 additions & 26 deletions lib/app/data/weather.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions lib/app/modules/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ class _SettingsPageState extends State<SettingsPage> {
),
// SettingLinks(
// icon: Icon(
// Iconsax.colorfilter,
// color: context.theme.iconTheme.color,
// ),
// text: 'materialColor'.tr,
// switcher: true,
// dropdown: false,
// value: settings.materialColor,
// onChange: (value) {
// isar.writeTxn(() async {
// settings.materialColor = value;
// isar.settings.put(settings);
// });
// setState(() {});
// },
// ),
// SettingLinks(
// icon: Icon(
// Iconsax.notification,
// color: context.theme.iconTheme.color,
// ),
Expand Down
52 changes: 51 additions & 1 deletion lib/app/modules/weather.dart
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,61 @@ class _WeatherPageState extends State<WeatherPage> {
),
],
),
const SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DescWeather(
imageName: 'assets/images/cloudy.png',
value:
'${locationController.mainWeather.cloudcover![locationController.hourOfDay.value]}%',
desc: 'cloudcover'.tr,
),
DescWeather(
imageName: 'assets/images/uv-index.png',
value:
'${locationController.mainWeather.uvIndex![locationController.hourOfDay.value].round()}',
desc: 'uvIndex'.tr,
message: locationController
.mainWeather
.uvIndex![locationController
.hourOfDay.value]
.round() <
3
? 'uvLow'.tr
: locationController
.mainWeather
.uvIndex![locationController
.hourOfDay.value]
.round() <
6
? 'uvAverage'.tr
: locationController
.mainWeather
.uvIndex![
locationController
.hourOfDay.value]
.round() <
8
? 'uvHigh'.tr
: locationController
.mainWeather
.uvIndex![
locationController
.hourOfDay
.value]
.round() <
11
? 'uvVeryHigh'.tr
: 'uvExtreme'.tr,
),
],
),
],
),
)
: const MyShimmer(
hight: 350,
hight: 400,
edgeInsetsMargin: EdgeInsets.only(bottom: 15),
),
),
Expand Down
34 changes: 34 additions & 0 deletions lib/app/modules/weather_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,40 @@ class _WeatherCardPageState extends State<WeatherCardPage> {
),
],
),
const SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DescWeather(
imageName: 'assets/images/cloudy.png',
value:
'${widget.weatherCard.cloudcover![timeNow]}%',
desc: 'cloudcover'.tr,
),
DescWeather(
imageName: 'assets/images/uv-index.png',
value:
'${widget.weatherCard.uvIndex![timeNow].round()}',
desc: 'uvIndex'.tr,
message: widget.weatherCard.uvIndex![timeNow]
.round() <
3
? 'uvLow'.tr
: widget.weatherCard.uvIndex![timeNow].round() <
6
? 'uvAverage'.tr
: widget.weatherCard.uvIndex![timeNow]
.round() <
8
? 'uvHigh'.tr
: widget.weatherCard.uvIndex![timeNow]
.round() <
11
? 'uvVeryHigh'.tr
: 'uvExtreme'.tr,
),
],
),
],
),
),
Expand Down
Loading

0 comments on commit c0e865e

Please sign in to comment.