mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-14 17:55:58 -07:00
feat: Customizable shortcuts/hotkeys (#439)
This implements the logic for allowing hotkeys with modifiers. Implemented globalhotkeys and videocontrol hotkeys Also implements saving the forward backwards seconds to the user. Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
23385d8e62
commit
fa30e634b4
29 changed files with 1360 additions and 162 deletions
|
|
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'package:fladder/models/settings/client_settings_model.dart';
|
||||
import 'package:fladder/models/settings/key_combinations.dart';
|
||||
import 'package:fladder/providers/shared_provider.dart';
|
||||
import 'package:fladder/util/custom_color_themes.dart';
|
||||
import 'package:fladder/util/debouncer.dart';
|
||||
|
|
@ -58,4 +59,15 @@ class ClientSettingsNotifier extends StateNotifier<ClientSettingsModel> {
|
|||
state = state.copyWith(schemeVariant: type ?? state.schemeVariant);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue