Skip to content

Commit d0464a5

Browse files
committed
issue #158
1 parent 42ad98d commit d0464a5

27 files changed

+135
-32
lines changed

lib/app/api/weather.freezed.dart

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/app/data/weather.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Settings {
1111
bool notifications = false;
1212
bool materialColor = false;
1313
bool amoledTheme = false;
14+
bool roundDegree = false;
1415
String? widgetBackgroundColor;
1516
String? widgetTextColor;
1617
String measurements = 'metric';

lib/app/data/weather.g.dart

Lines changed: 81 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/app/modules/settings/view/settings.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,21 @@ class _SettingsPageState extends State<SettingsPage> {
444444
),
445445
),
446446
),
447+
SettingCard(
448+
elevation: 4,
449+
icon: const Icon(Iconsax.cloud_notif),
450+
text: 'roundDegree'.tr,
451+
switcher: true,
452+
value: settings.roundDegree,
453+
onChange: (value) {
454+
settings.roundDegree = value;
455+
isar.writeTxnSync(
456+
() => isar.settings.putSync(settings));
457+
MyApp.updateAppState(context,
458+
newRoundDegree: value);
459+
setState(() {});
460+
},
461+
),
447462
SettingCard(
448463
elevation: 4,
449464
icon: const Icon(Iconsax.sun_1),

lib/app/widgets/now/weather_now.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class _WeatherNowState extends State<WeatherNow> {
4040
height: 200,
4141
),
4242
GlowText(
43-
'${widget.degree}',
43+
'${roundDegree ? widget.degree.round() : widget.degree}',
4444
style: context.textTheme.displayLarge?.copyWith(
4545
fontSize: 90,
4646
fontWeight: FontWeight.w800,

lib/main.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
3333

3434
bool amoledTheme = false;
3535
bool materialColor = false;
36+
bool roundDegree = false;
3637
Locale locale = const Locale('en', 'US');
3738
int timeRange = 1;
3839
String timeStart = '09:00';
@@ -149,6 +150,7 @@ class MyApp extends StatefulWidget {
149150
BuildContext context, {
150151
bool? newAmoledTheme,
151152
bool? newMaterialColor,
153+
bool? newRoundDegree,
152154
Locale? newLocale,
153155
int? newTimeRange,
154156
String? newTimeStart,
@@ -164,6 +166,9 @@ class MyApp extends StatefulWidget {
164166
if (newMaterialColor != null) {
165167
state.changeMarerialTheme(newMaterialColor);
166168
}
169+
if (newRoundDegree != null) {
170+
state.changeRoundDegree(newRoundDegree);
171+
}
167172
if (newLocale != null) {
168173
state.changeLocale(newLocale);
169174
}
@@ -203,6 +208,12 @@ class _MyAppState extends State<MyApp> {
203208
});
204209
}
205210

211+
void changeRoundDegree(bool newRoundDegree) {
212+
setState(() {
213+
roundDegree = newRoundDegree;
214+
});
215+
}
216+
206217
void changeTimeRange(int newTimeRange) {
207218
setState(() {
208219
timeRange = newTimeRange;
@@ -243,6 +254,7 @@ class _MyAppState extends State<MyApp> {
243254
void initState() {
244255
amoledTheme = settings.amoledTheme;
245256
materialColor = settings.materialColor;
257+
roundDegree = settings.roundDegree;
246258
locale = Locale(
247259
settings.language!.substring(0, 2), settings.language!.substring(3));
248260
timeRange = settings.timeRange ?? 1;

lib/translation/bn_in.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,6 @@ class BnIn {
121121
'dewpoint': 'তুষার বিন্দু',
122122
'shortwaveRadiation': 'সংক্ষেপণ তরঙ্গ প্রকৃতি',
123123
'W/m2': 'ডব্লিউ/মিটার বর্গ',
124+
'roundDegree': 'ডিগ্রি রাউন্ড করুন',
124125
};
125126
}

lib/translation/cs_cz.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,6 @@ class CsCz {
119119
'widgetText': 'Text widgetu',
120120
'dewpoint': 'Rosný bod',
121121
'shortwaveRadiation': 'Krátká vlnová radiace',
122+
'roundDegree': 'Zaokrouhlit stupně',
122123
};
123124
}

lib/translation/de_de.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,6 @@ class DeDe {
121121
'widgetText': 'Widget-Text',
122122
'dewpoint': 'Taupunkt',
123123
'shortwaveRadiation': 'Kurzwellenstrahlung',
124+
'roundDegree': 'Grad runden',
124125
};
125126
}

lib/translation/en_us.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,6 @@ class EnUs {
120120
'dewpoint': 'Dewpoint',
121121
'shortwaveRadiation': 'Shortwave radiation',
122122
'W/m2': 'W/m2',
123+
'roundDegree': 'Round degrees',
123124
};
124125
}

0 commit comments

Comments
 (0)