mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
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>
50 lines
1.7 KiB
Dart
50 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:fladder/models/settings/client_settings_model.dart';
|
|
import 'package:fladder/providers/settings/client_settings_provider.dart';
|
|
import 'package:fladder/screens/settings/widgets/key_listener.dart';
|
|
import 'package:fladder/screens/settings/widgets/settings_label_divider.dart';
|
|
import 'package:fladder/screens/settings/widgets/settings_list_group.dart';
|
|
import 'package:fladder/util/localization_helper.dart';
|
|
|
|
List<Widget> buildClientSettingsShortCuts(
|
|
BuildContext context,
|
|
WidgetRef ref,
|
|
) {
|
|
final clientSettings = ref.watch(clientSettingsProvider);
|
|
return settingsListGroup(
|
|
context,
|
|
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,
|
|
),
|
|
),
|
|
Flexible(
|
|
child: KeyCombinationWidget(
|
|
currentKey: currentEntry,
|
|
defaultKey: defaultEntry,
|
|
onChanged: (value) =>
|
|
ref.read(clientSettingsProvider.notifier).setShortcuts(MapEntry(entry, value)),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
)
|
|
],
|
|
);
|
|
}
|