Skip to content

Commit 076edf0

Browse files
committed
settings [nfc]: Reorder GlobalSettingsStore members to group by setting
As we add more settings, this will keep things better clustered logically together.
1 parent cb9a849 commit 076edf0

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lib/model/settings.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,23 @@ class GlobalSettingsStore extends ChangeNotifier {
6060
/// A cache of the [GlobalSettingsData] singleton in the underlying data store.
6161
GlobalSettingsData _data;
6262

63+
Future<void> _update(GlobalSettingsCompanion data) async {
64+
await _backend.doUpdateGlobalSettings(data);
65+
_data = _data.copyWithCompanion(data);
66+
notifyListeners();
67+
}
68+
6369
/// The user's choice of [ThemeSetting];
6470
/// null means the device-level choice of theme.
6571
///
6672
/// See also [setThemeSetting].
6773
ThemeSetting? get themeSetting => _data.themeSetting;
6874

75+
/// Set [themeSetting], persistently for future runs of the app.
76+
Future<void> setThemeSetting(ThemeSetting? value) async {
77+
await _update(GlobalSettingsCompanion(themeSetting: Value(value)));
78+
}
79+
6980
/// The user's choice of [BrowserPreference];
7081
/// null means use our default choice.
7182
///
@@ -74,6 +85,11 @@ class GlobalSettingsStore extends ChangeNotifier {
7485
/// See also [setBrowserPreference].
7586
BrowserPreference? get browserPreference => _data.browserPreference;
7687

88+
/// Set [browserPreference], persistently for future runs of the app.
89+
Future<void> setBrowserPreference(BrowserPreference? value) async {
90+
await _update(GlobalSettingsCompanion(browserPreference: Value(value)));
91+
}
92+
7793
/// The value of [BrowserPreference] to use:
7894
/// the user's choice [browserPreference] if any, else our default.
7995
///
@@ -113,20 +129,4 @@ class GlobalSettingsStore extends ChangeNotifier {
113129
return UrlLaunchMode.externalApplication;
114130
}
115131
}
116-
117-
Future<void> _update(GlobalSettingsCompanion data) async {
118-
await _backend.doUpdateGlobalSettings(data);
119-
_data = _data.copyWithCompanion(data);
120-
notifyListeners();
121-
}
122-
123-
/// Set [themeSetting], persistently for future runs of the app.
124-
Future<void> setThemeSetting(ThemeSetting? value) async {
125-
await _update(GlobalSettingsCompanion(themeSetting: Value(value)));
126-
}
127-
128-
/// Set [browserPreference], persistently for future runs of the app.
129-
Future<void> setBrowserPreference(BrowserPreference? value) async {
130-
await _update(GlobalSettingsCompanion(browserPreference: Value(value)));
131-
}
132132
}

0 commit comments

Comments
 (0)