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

@ -60,14 +60,6 @@ class ClientSettingsNotifier extends StateNotifier<ClientSettingsModel> {
void setRequireWifi(bool value) => state = state.copyWith(requireWifi: value);
void setShortcuts(MapEntry<GlobalHotKeys, KeyCombination?> mapEntry) {
final newShortCuts = Map.fromEntries(state.shortcuts.entries);
newShortCuts.update(
mapEntry.key,
(value) => mapEntry.value,
ifAbsent: () => mapEntry.value,
);
newShortCuts.removeWhere((key, value) => value == null);
state = state.copyWith(shortcuts: newShortCuts);
}
void setShortcuts(MapEntry<GlobalHotKeys, KeyCombination> newEntry) =>
state = state.copyWith(shortcuts: state.shortcuts.setOrRemove(newEntry, state.defaultShortCuts));
}

View file

@ -70,15 +70,8 @@ class VideoPlayerSettingsProviderNotifier extends StateNotifier<VideoPlayerSetti
void toggleOrientation(Set<DeviceOrientation>? orientation) =>
state = state.copyWith(allowedOrientations: orientation);
void setShortcuts(MapEntry<VideoHotKeys, KeyCombination?> newEntry) {
final currentShortcuts = Map.fromEntries(state.hotKeys.entries);
currentShortcuts.update(
newEntry.key,
(value) => newEntry.value,
ifAbsent: () => newEntry.value,
);
currentShortcuts.removeWhere((key, value) => value == null);
state = state.copyWith(hotKeys: currentShortcuts);
void setShortcuts(MapEntry<VideoHotKeys, KeyCombination> newEntry) {
state = state.copyWith(hotKeys: state.hotKeys.setOrRemove(newEntry, state.defaultShortCuts));
}
void nextChapter() {