Skip to content

Commit

Permalink
perf: Remove unneeded stream
Browse files Browse the repository at this point in the history
  • Loading branch information
enrique-lozano committed Jan 9, 2025
1 parent c13a109 commit 2a57c40
Showing 1 changed file with 23 additions and 26 deletions.
49 changes: 23 additions & 26 deletions lib/app/settings/appearance_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ class _AdvancedSettingsPageState extends State<AdvancedSettingsPage> {
},
),
createListSeparator(context, t.settings.theme_and_colors),
StreamBuilder(
stream: UserSettingService.instance
.getSettingFromDB(SettingKey.themeMode),
builder: (context, snapshot) {
final theme = getThemeFromString(snapshot.data);
Builder(
builder: (context) {
final theme =
getThemeFromString(appStateSettings[SettingKey.themeMode]);

return ListTile(
title: Row(
Expand Down Expand Up @@ -240,26 +239,24 @@ class _AdvancedSettingsPageState extends State<AdvancedSettingsPage> {
}

Widget _buildThemeDropdown(ThemeMode theme) {
return LayoutBuilder(builder: (context, constraints) {
return MonekinDropdownSelect(
initial: theme,
compact: true,
expanded: false,
items: const [
ThemeMode.system,
ThemeMode.light,
ThemeMode.dark,
],
getLabel: (x) => x.displayName(context),
onChanged: (mode) {
UserSettingService.instance
.setItem(
SettingKey.themeMode,
mode.name,
updateGlobalState: true,
)
.then((value) => null);
});
});
return MonekinDropdownSelect(
initial: theme,
compact: true,
expanded: false,
items: const [
ThemeMode.system,
ThemeMode.light,
ThemeMode.dark,
],
getLabel: (x) => x.displayName(context),
onChanged: (mode) {
UserSettingService.instance
.setItem(
SettingKey.themeMode,
mode.name,
updateGlobalState: true,
)
.then((value) => null);
});
}
}

0 comments on commit 2a57c40

Please sign in to comment.