make refresh rate selectable

This commit is contained in:
Fabian Freund
2026-06-10 09:22:58 +02:00
parent 73ac6fd400
commit 912c15e063
10 changed files with 281 additions and 4 deletions
@@ -53,7 +53,8 @@ const List<SettingsSectionDefinition> generalSettingsSections = [
),
SettingsEntryDefinition(
title: 'Pure Black (OLED)',
subtitle: 'Use true-black surfaces in dark mode to save power on OLED '
subtitle:
'Use true-black surfaces in dark mode to save power on OLED '
'screens',
keywords: ['oled', 'amoled', 'high contrast', 'black', 'dark'],
child: _PureBlackTile(),
@@ -64,6 +65,24 @@ const List<SettingsSectionDefinition> generalSettingsSections = [
keywords: ['ui scale', 'zoom'],
child: _UiZoomSection(),
),
SettingsEntryDefinition(
title: 'Refresh Rate',
subtitle: 'Request a high or low display refresh rate (Android)',
keywords: [
'fps',
'hz',
'hertz',
'frame rate',
'framerate',
'60hz',
'90hz',
'120hz',
'smooth',
'high refresh',
'display mode',
],
child: _RefreshRateSection(),
),
SettingsEntryDefinition(
title: 'Disable Animations',
subtitle: 'Reduce motion and turn off app animations',
@@ -78,7 +97,8 @@ const List<SettingsSectionDefinition> generalSettingsSections = [
),
SettingsEntryDefinition(
title: 'Show Close Button',
subtitle: 'Add a button to dismiss the search / new-tab page without '
subtitle:
'Add a button to dismiss the search / new-tab page without '
'a back gesture',
keywords: [
'back',
@@ -421,6 +441,66 @@ class _ThemeSection extends HookConsumerWidget {
}
}
class _RefreshRateSection extends HookConsumerWidget {
const _RefreshRateSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
final refreshRateMode = ref.watch(
generalSettingsWithDefaultsProvider.select((s) => s.refreshRateMode),
);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const ListTile(
title: Text('Refresh Rate'),
subtitle: Text(
'Choose "High" for the smoothest scrolling and animations on '
'90/120Hz screens, or "Low" to save battery.',
),
leading: Icon(Icons.speed),
contentPadding: EdgeInsets.zero,
),
Center(
child: SegmentedButton<RefreshRateMode>(
segments: const [
ButtonSegment(
value: RefreshRateMode.system,
icon: Icon(Icons.smartphone),
label: Text('System'),
),
ButtonSegment(
value: RefreshRateMode.high,
icon: Icon(Icons.bolt),
label: Text('High'),
),
ButtonSegment(
value: RefreshRateMode.low,
icon: Icon(Icons.battery_saver),
label: Text('Low'),
),
],
selected: {refreshRateMode},
onSelectionChanged: (value) async {
await ref
.read(saveGeneralSettingsControllerProvider.notifier)
.save(
(currentSettings) =>
currentSettings.copyWith.refreshRateMode(value.first),
);
},
),
),
],
),
);
}
}
class _ExternalDownloadManagerTile extends HookConsumerWidget {
const _ExternalDownloadManagerTile();