chore: Shortcuts improvements (#446)

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-08-09 16:17:14 +02:00 committed by GitHub
parent d0d6a2ffa6
commit 70e346b8a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 481 additions and 198 deletions

View file

@ -19,31 +19,26 @@ List<Widget> buildClientSettingsShortCuts(
SettingsLabelDivider(label: context.localized.shortCuts),
[
...GlobalHotKeys.values.map(
(entry) {
final currentEntry = clientSettings.shortcuts[entry];
final defaultEntry = clientSettings.defaultShortCuts[entry]!;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Expanded(
child: Text(
entry.label(context),
style: Theme.of(context).textTheme.titleLarge,
),
(entry) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Expanded(
child: Text(
entry.label(context),
style: Theme.of(context).textTheme.titleLarge,
),
Flexible(
child: KeyCombinationWidget(
currentKey: currentEntry,
defaultKey: defaultEntry,
onChanged: (value) =>
ref.read(clientSettingsProvider.notifier).setShortcuts(MapEntry(entry, value)),
),
)
],
),
);
},
),
Flexible(
child: KeyCombinationWidget(
currentKey: clientSettings.shortcuts[entry],
defaultKey: clientSettings.defaultShortCuts[entry]!,
onChanged: (value) => ref.read(clientSettingsProvider.notifier).setShortcuts(MapEntry(entry, value)),
),
)
],
),
),
)
],
);