Remove LogicalKeySet usage in one Shortcuts example (#156941)

## Description

This PR replaces `LogicalKeySet` by `SingleActivator` in one of the Shortcuts example.
According to [LogicalKeySet documentation](https://api.flutter.dev/flutter/widgets/LogicalKeySet-class.html) :
"prefer [SingleActivator](https://api.flutter.dev/flutter/widgets/SingleActivator-class.html) when possible, whose behavior more closely resembles that of typical platforms".

## Related Issue

Related to [LogicalKeySet Not Working on Linux Environment](https://github.com/flutter/flutter/issues/156806).

## Tests

Adds 1 test.
This commit is contained in:
Bruno Leroux
2024-10-16 19:15:06 +02:00
committed by GitHub
parent 5644c032b3
commit e08ad36dd9
2 changed files with 24 additions and 3 deletions

View File

@@ -85,9 +85,9 @@ class _ShortcutsExampleState extends State<ShortcutsExample> {
@override
Widget build(BuildContext context) {
return Shortcuts(
shortcuts: <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowUp): const IncrementIntent(2),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const DecrementIntent(2),
shortcuts: const <ShortcutActivator, Intent>{
SingleActivator(LogicalKeyboardKey.arrowUp): IncrementIntent(2),
SingleActivator(LogicalKeyboardKey.arrowDown): DecrementIntent(2),
},
child: Actions(
actions: <Type, Action<Intent>>{