Skip to content

Commit

Permalink
issue #158
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonavichus committed Jan 28, 2024
1 parent 42ad98d commit d0464a5
Show file tree
Hide file tree
Showing 27 changed files with 135 additions and 32 deletions.
6 changes: 3 additions & 3 deletions lib/app/api/weather.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class _$WeatherDataApiImpl implements _WeatherDataApi {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$WeatherDataApiImpl &&
Expand Down Expand Up @@ -781,7 +781,7 @@ class _$HourlyImpl implements _Hourly {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$HourlyImpl &&
Expand Down Expand Up @@ -1445,7 +1445,7 @@ class _$DailyImpl implements _Daily {
}

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$DailyImpl &&
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 @@ -11,6 +11,7 @@ class Settings {
bool notifications = false;
bool materialColor = false;
bool amoledTheme = false;
bool roundDegree = false;
String? widgetBackgroundColor;
String? widgetTextColor;
String measurements = 'metric';
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.

15 changes: 15 additions & 0 deletions lib/app/modules/settings/view/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,21 @@ class _SettingsPageState extends State<SettingsPage> {
),
),
),
SettingCard(
elevation: 4,
icon: const Icon(Iconsax.cloud_notif),
text: 'roundDegree'.tr,
switcher: true,
value: settings.roundDegree,
onChange: (value) {
settings.roundDegree = value;
isar.writeTxnSync(
() => isar.settings.putSync(settings));
MyApp.updateAppState(context,
newRoundDegree: value);
setState(() {});
},
),
SettingCard(
elevation: 4,
icon: const Icon(Iconsax.sun_1),
Expand Down
2 changes: 1 addition & 1 deletion lib/app/widgets/now/weather_now.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _WeatherNowState extends State<WeatherNow> {
height: 200,
),
GlowText(
'${widget.degree}',
'${roundDegree ? widget.degree.round() : widget.degree}',
style: context.textTheme.displayLarge?.copyWith(
fontSize: 90,
fontWeight: FontWeight.w800,
Expand Down
12 changes: 12 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =

bool amoledTheme = false;
bool materialColor = false;
bool roundDegree = false;
Locale locale = const Locale('en', 'US');
int timeRange = 1;
String timeStart = '09:00';
Expand Down Expand Up @@ -149,6 +150,7 @@ class MyApp extends StatefulWidget {
BuildContext context, {
bool? newAmoledTheme,
bool? newMaterialColor,
bool? newRoundDegree,
Locale? newLocale,
int? newTimeRange,
String? newTimeStart,
Expand All @@ -164,6 +166,9 @@ class MyApp extends StatefulWidget {
if (newMaterialColor != null) {
state.changeMarerialTheme(newMaterialColor);
}
if (newRoundDegree != null) {
state.changeRoundDegree(newRoundDegree);
}
if (newLocale != null) {
state.changeLocale(newLocale);
}
Expand Down Expand Up @@ -203,6 +208,12 @@ class _MyAppState extends State<MyApp> {
});
}

void changeRoundDegree(bool newRoundDegree) {
setState(() {
roundDegree = newRoundDegree;
});
}

void changeTimeRange(int newTimeRange) {
setState(() {
timeRange = newTimeRange;
Expand Down Expand Up @@ -243,6 +254,7 @@ class _MyAppState extends State<MyApp> {
void initState() {
amoledTheme = settings.amoledTheme;
materialColor = settings.materialColor;
roundDegree = settings.roundDegree;
locale = Locale(
settings.language!.substring(0, 2), settings.language!.substring(3));
timeRange = settings.timeRange ?? 1;
Expand Down
1 change: 1 addition & 0 deletions lib/translation/bn_in.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ class BnIn {
'dewpoint': 'তুষার বিন্দু',
'shortwaveRadiation': 'সংক্ষেপণ তরঙ্গ প্রকৃতি',
'W/m2': 'ডব্লিউ/মিটার বর্গ',
'roundDegree': 'ডিগ্রি রাউন্ড করুন',
};
}
1 change: 1 addition & 0 deletions lib/translation/cs_cz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,6 @@ class CsCz {
'widgetText': 'Text widgetu',
'dewpoint': 'Rosný bod',
'shortwaveRadiation': 'Krátká vlnová radiace',
'roundDegree': 'Zaokrouhlit stupně',
};
}
1 change: 1 addition & 0 deletions lib/translation/de_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ class DeDe {
'widgetText': 'Widget-Text',
'dewpoint': 'Taupunkt',
'shortwaveRadiation': 'Kurzwellenstrahlung',
'roundDegree': 'Grad runden',
};
}
1 change: 1 addition & 0 deletions lib/translation/en_us.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,6 @@ class EnUs {
'dewpoint': 'Dewpoint',
'shortwaveRadiation': 'Shortwave radiation',
'W/m2': 'W/m2',
'roundDegree': 'Round degrees',
};
}
1 change: 1 addition & 0 deletions lib/translation/es_es.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ class EsEs {
'widgetText': 'Texto del widget',
'dewpoint': 'Punto de rocío',
'shortwaveRadiation': 'Radiación de onda corta',
'roundDegree': 'Redondear grados',
};
}
1 change: 1 addition & 0 deletions lib/translation/fr_fr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ class FrFr {
'widgetText': 'Texte du widget',
'dewpoint': 'Point de rosée',
'shortwaveRadiation': 'Rayonnement à ondes courtes',
'roundDegree': 'Arrondir les degrés',
};
}
1 change: 1 addition & 0 deletions lib/translation/ga_ie.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ class GaIe {
'dewpoint': 'Poinnte Dé',
'shortwaveRadiation': 'Fuinneamh Ghearrfhad',
'W/m2': 'W/m2',
'roundDegree': 'Timpeall na Gráid',
};
}
1 change: 1 addition & 0 deletions lib/translation/hi_in.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ class HiIn {
'widgetText': 'विजेट पाठ',
'dewpoint': 'बर्फ़ के बिंदु',
'shortwaveRadiation': 'शॉर्टवेव विकिरण',
'roundDegree': 'डिग्री गोली मारें',
};
}
3 changes: 2 additions & 1 deletion lib/translation/hu_hu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class HuHu {
'widgetText': 'Widget szöveg',
'dewpoint': 'Harmatpont',
'shortwaveRadiation': 'Rövidhullámú sugárzás',
'W/m2': 'W/m2'
'W/m2': 'W/m2',
'roundDegree': 'Fokok Kerekítése',
};
}
1 change: 1 addition & 0 deletions lib/translation/it_it.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@ class ItIt {
'widgetText': 'Testo del widget',
'dewpoint': 'Punto di rugiada',
'shortwaveRadiation': 'Radiazione a onde corte',
'roundDegree': 'Arrotonda i gradi',
};
}
1 change: 1 addition & 0 deletions lib/translation/ka_ge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,6 @@ class KaGe {
'widgetText': 'ვიჯეტის ტექსტი',
'dewpoint': 'დევპოინტი',
'shortwaveRadiation': 'მოკლე ტალღის გამოსხივება',
'roundDegree': 'ხარისხი მიჯნურობა',
};
}
Loading

0 comments on commit d0464a5

Please sign in to comment.