mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
chore: Shortcuts improvements (#446)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
d0d6a2ffa6
commit
70e346b8a2
15 changed files with 481 additions and 198 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue