Skip to content

Commit

Permalink
Merge pull request #120 from shatanikmahanty/feat/widget_bg_persistence
Browse files Browse the repository at this point in the history
Feat/widget bg persistence
  • Loading branch information
Leonavichus authored Oct 12, 2023
2 parents 7af186d + d90d63f commit 232178f
Show file tree
Hide file tree
Showing 6 changed files with 304 additions and 88 deletions.
9 changes: 7 additions & 2 deletions lib/app/controller/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class WeatherController extends GetxController {
final _city = ''.obs;
final _latitude = 0.0.obs;
final _longitude = 0.0.obs;
final widgetBackgroundColor = ''.obs;

String get district => _district.value;
String get city => _city.value;
Expand Down Expand Up @@ -462,8 +461,14 @@ class WeatherController extends GetxController {
}

Future<bool> updateWidgetBackgroundColor(String color) async {
widgetBackgroundColor.value = color;
print(settings.widgetBackgroundColor);

settings.widgetBackgroundColor = color;
isar.writeTxnSync(() {
isar.settings.putSync(settings);
});

print(settings.widgetBackgroundColor);
return Future.wait<bool?>([
HomeWidget.saveWidgetData(
'background_color',
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 @@ -10,6 +10,7 @@ class Settings {
bool notifications = false;
bool materialColor = false;
bool amoledTheme = false;
String? widgetBackgroundColor;
String measurements = 'metric';
String degrees = 'celsius';
String timeformat = '24';
Expand Down
211 changes: 211 additions & 0 deletions lib/app/data/weather.g.dart

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

Loading

0 comments on commit 232178f

Please sign in to comment.