Unverified Commit b8833afc authored by Tong Mu's avatar Tong Mu Committed by GitHub

Migrate LogicalKeySet to SingleActivator (#80756)

Applies #78522 to existing code, by replacing all occurrences of LogicalKeySet to SingleActivator or ShortcutActivator.
parent 635c997a
...@@ -406,9 +406,9 @@ class _FocusDemoState extends State<FocusDemo> { ...@@ -406,9 +406,9 @@ class _FocusDemoState extends State<FocusDemo> {
child: FocusTraversalGroup( child: FocusTraversalGroup(
policy: ReadingOrderTraversalPolicy(), policy: ReadingOrderTraversalPolicy(),
child: Shortcuts( child: Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ shortcuts: <ShortcutActivator, Intent>{
LogicalKeySet(Platform.isMacOS ? LogicalKeyboardKey.meta : LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.keyZ): const RedoIntent(), SingleActivator(LogicalKeyboardKey.keyZ, meta: Platform.isMacOS, control: !Platform.isMacOS, shift: true): const RedoIntent(),
LogicalKeySet(Platform.isMacOS ? LogicalKeyboardKey.meta : LogicalKeyboardKey.control, LogicalKeyboardKey.keyZ): const UndoIntent(), SingleActivator(LogicalKeyboardKey.keyZ, meta: Platform.isMacOS, control: !Platform.isMacOS): const UndoIntent(),
}, },
child: FocusScope( child: FocusScope(
key: FocusDemo.appKey, key: FocusDemo.appKey,
......
...@@ -346,9 +346,9 @@ class CupertinoApp extends StatefulWidget { ...@@ -346,9 +346,9 @@ class CupertinoApp extends StatefulWidget {
/// ```dart /// ```dart
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// return WidgetsApp( /// return WidgetsApp(
/// shortcuts: <LogicalKeySet, Intent>{ /// shortcuts: <ShortcutActivator, Intent>{
/// ... WidgetsApp.defaultShortcuts, /// ... WidgetsApp.defaultShortcuts,
/// LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(), /// const SingleActivator(LogicalKeyboardKey.select): const ActivateIntent(),
/// }, /// },
/// color: const Color(0xFFFF0000), /// color: const Color(0xFFFF0000),
/// builder: (BuildContext context, Widget? child) { /// builder: (BuildContext context, Widget? child) {
...@@ -359,7 +359,7 @@ class CupertinoApp extends StatefulWidget { ...@@ -359,7 +359,7 @@ class CupertinoApp extends StatefulWidget {
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
/// {@macro flutter.widgets.widgetsApp.shortcuts.seeAlso} /// {@macro flutter.widgets.widgetsApp.shortcuts.seeAlso}
final Map<LogicalKeySet, Intent>? shortcuts; final Map<ShortcutActivator, Intent>? shortcuts;
/// {@macro flutter.widgets.widgetsApp.actions} /// {@macro flutter.widgets.widgetsApp.actions}
/// {@tool snippet} /// {@tool snippet}
......
...@@ -584,9 +584,9 @@ class MaterialApp extends StatefulWidget { ...@@ -584,9 +584,9 @@ class MaterialApp extends StatefulWidget {
/// ```dart /// ```dart
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// return WidgetsApp( /// return WidgetsApp(
/// shortcuts: <LogicalKeySet, Intent>{ /// shortcuts: <ShortcutActivator, Intent>{
/// ... WidgetsApp.defaultShortcuts, /// ... WidgetsApp.defaultShortcuts,
/// LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(), /// const SingleActivator(LogicalKeyboardKey.select): const ActivateIntent(),
/// }, /// },
/// color: const Color(0xFFFF0000), /// color: const Color(0xFFFF0000),
/// builder: (BuildContext context, Widget? child) { /// builder: (BuildContext context, Widget? child) {
...@@ -597,7 +597,7 @@ class MaterialApp extends StatefulWidget { ...@@ -597,7 +597,7 @@ class MaterialApp extends StatefulWidget {
/// ``` /// ```
/// {@end-tool} /// {@end-tool}
/// {@macro flutter.widgets.widgetsApp.shortcuts.seeAlso} /// {@macro flutter.widgets.widgetsApp.shortcuts.seeAlso}
final Map<LogicalKeySet, Intent>? shortcuts; final Map<ShortcutActivator, Intent>? shortcuts;
/// {@macro flutter.widgets.widgetsApp.actions} /// {@macro flutter.widgets.widgetsApp.actions}
/// {@tool snippet} /// {@tool snippet}
......
...@@ -495,7 +495,7 @@ class _MonthPickerState extends State<_MonthPicker> { ...@@ -495,7 +495,7 @@ class _MonthPickerState extends State<_MonthPicker> {
late PageController _pageController; late PageController _pageController;
late MaterialLocalizations _localizations; late MaterialLocalizations _localizations;
late TextDirection _textDirection; late TextDirection _textDirection;
Map<LogicalKeySet, Intent>? _shortcutMap; Map<ShortcutActivator, Intent>? _shortcutMap;
Map<Type, Action<Intent>>? _actionMap; Map<Type, Action<Intent>>? _actionMap;
late FocusNode _dayGridFocus; late FocusNode _dayGridFocus;
DateTime? _focusedDay; DateTime? _focusedDay;
...@@ -507,11 +507,11 @@ class _MonthPickerState extends State<_MonthPicker> { ...@@ -507,11 +507,11 @@ class _MonthPickerState extends State<_MonthPicker> {
_previousMonthDate = DateUtils.addMonthsToMonthDate(_currentMonth, -1); _previousMonthDate = DateUtils.addMonthsToMonthDate(_currentMonth, -1);
_nextMonthDate = DateUtils.addMonthsToMonthDate(_currentMonth, 1); _nextMonthDate = DateUtils.addMonthsToMonthDate(_currentMonth, 1);
_pageController = PageController(initialPage: DateUtils.monthDelta(widget.firstDate, _currentMonth)); _pageController = PageController(initialPage: DateUtils.monthDelta(widget.firstDate, _currentMonth));
_shortcutMap = <LogicalKeySet, Intent>{ _shortcutMap = const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const DirectionalFocusIntent(TraversalDirection.left), SingleActivator(LogicalKeyboardKey.arrowLeft): DirectionalFocusIntent(TraversalDirection.left),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const DirectionalFocusIntent(TraversalDirection.right), SingleActivator(LogicalKeyboardKey.arrowRight): DirectionalFocusIntent(TraversalDirection.right),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const DirectionalFocusIntent(TraversalDirection.down), SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const DirectionalFocusIntent(TraversalDirection.up), SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up),
}; };
_actionMap = <Type, Action<Intent>>{ _actionMap = <Type, Action<Intent>>{
NextFocusIntent: CallbackAction<NextFocusIntent>(onInvoke: _handleGridNextFocus), NextFocusIntent: CallbackAction<NextFocusIntent>(onInvoke: _handleGridNextFocus),
......
...@@ -496,9 +496,9 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix ...@@ -496,9 +496,9 @@ class _DatePickerDialogState extends State<DatePickerDialog> with RestorationMix
} }
} }
static final Map<LogicalKeySet, Intent> _formShortcutMap = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _formShortcutMap = <ShortcutActivator, Intent>{
// Pressing enter on the field will move focus to the next field or control. // Pressing enter on the field will move focus to the next field or control.
LogicalKeySet(LogicalKeyboardKey.enter): const NextFocusIntent(), SingleActivator(LogicalKeyboardKey.enter): NextFocusIntent(),
}; };
@override @override
...@@ -1902,7 +1902,12 @@ class _CalendarKeyboardNavigator extends StatefulWidget { ...@@ -1902,7 +1902,12 @@ class _CalendarKeyboardNavigator extends StatefulWidget {
class _CalendarKeyboardNavigatorState extends State<_CalendarKeyboardNavigator> { class _CalendarKeyboardNavigatorState extends State<_CalendarKeyboardNavigator> {
late Map<LogicalKeySet, Intent> _shortcutMap; final Map<ShortcutActivator, Intent> _shortcutMap = const <ShortcutActivator, Intent>{
SingleActivator(LogicalKeyboardKey.arrowLeft): DirectionalFocusIntent(TraversalDirection.left),
SingleActivator(LogicalKeyboardKey.arrowRight): DirectionalFocusIntent(TraversalDirection.right),
SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down),
SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up),
};
late Map<Type, Action<Intent>> _actionMap; late Map<Type, Action<Intent>> _actionMap;
late FocusNode _dayGridFocus; late FocusNode _dayGridFocus;
TraversalDirection? _dayTraversalDirection; TraversalDirection? _dayTraversalDirection;
...@@ -1912,12 +1917,6 @@ class _CalendarKeyboardNavigatorState extends State<_CalendarKeyboardNavigator> ...@@ -1912,12 +1917,6 @@ class _CalendarKeyboardNavigatorState extends State<_CalendarKeyboardNavigator>
void initState() { void initState() {
super.initState(); super.initState();
_shortcutMap = <LogicalKeySet, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const DirectionalFocusIntent(TraversalDirection.left),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const DirectionalFocusIntent(TraversalDirection.right),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const DirectionalFocusIntent(TraversalDirection.down),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const DirectionalFocusIntent(TraversalDirection.up),
};
_actionMap = <Type, Action<Intent>>{ _actionMap = <Type, Action<Intent>>{
NextFocusIntent: CallbackAction<NextFocusIntent>(onInvoke: _handleGridNextFocus), NextFocusIntent: CallbackAction<NextFocusIntent>(onInvoke: _handleGridNextFocus),
PreviousFocusIntent: CallbackAction<PreviousFocusIntent>(onInvoke: _handleGridPreviousFocus), PreviousFocusIntent: CallbackAction<PreviousFocusIntent>(onInvoke: _handleGridPreviousFocus),
......
...@@ -148,11 +148,11 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>> ...@@ -148,11 +148,11 @@ class _DropdownMenuItemButtonState<T> extends State<_DropdownMenuItemButton<T>>
); );
} }
static final Map<LogicalKeySet, Intent> _webShortcuts =<LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _webShortcuts = <ShortcutActivator, Intent>{
// On the web, up/down don't change focus, *except* in a <select> // On the web, up/down don't change focus, *except* in a <select>
// element, which is what a dropdown emulates. // element, which is what a dropdown emulates.
LogicalKeySet(LogicalKeyboardKey.arrowDown): const DirectionalFocusIntent(TraversalDirection.down), SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const DirectionalFocusIntent(TraversalDirection.up), SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up),
}; };
@override @override
......
...@@ -477,7 +477,12 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin { ...@@ -477,7 +477,12 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
final GlobalKey _renderObjectKey = GlobalKey(); final GlobalKey _renderObjectKey = GlobalKey();
// Keyboard mapping for a focused slider. // Keyboard mapping for a focused slider.
late Map<LogicalKeySet, Intent> _shortcutMap; final Map<ShortcutActivator, Intent> _shortcutMap = const <ShortcutActivator, Intent>{
SingleActivator(LogicalKeyboardKey.arrowUp): _AdjustSliderIntent.up(),
SingleActivator(LogicalKeyboardKey.arrowDown): _AdjustSliderIntent.down(),
SingleActivator(LogicalKeyboardKey.arrowLeft): _AdjustSliderIntent.left(),
SingleActivator(LogicalKeyboardKey.arrowRight): _AdjustSliderIntent.right(),
};
// Action mapping for a focused slider. // Action mapping for a focused slider.
late Map<Type, Action<Intent>> _actionMap; late Map<Type, Action<Intent>> _actionMap;
...@@ -506,12 +511,6 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin { ...@@ -506,12 +511,6 @@ class _SliderState extends State<Slider> with TickerProviderStateMixin {
); );
enableController.value = widget.onChanged != null ? 1.0 : 0.0; enableController.value = widget.onChanged != null ? 1.0 : 0.0;
positionController.value = _unlerp(widget.value); positionController.value = _unlerp(widget.value);
_shortcutMap = <LogicalKeySet, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowUp): const _AdjustSliderIntent.up(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const _AdjustSliderIntent.down(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const _AdjustSliderIntent.left(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const _AdjustSliderIntent.right(),
};
_actionMap = <Type, Action<Intent>>{ _actionMap = <Type, Action<Intent>>{
_AdjustSliderIntent: CallbackAction<_AdjustSliderIntent>( _AdjustSliderIntent: CallbackAction<_AdjustSliderIntent>(
onInvoke: _actionHandler, onInvoke: _actionHandler,
......
...@@ -81,9 +81,9 @@ export 'package:flutter/services.dart' show SmartQuotesType, SmartDashesType; ...@@ -81,9 +81,9 @@ export 'package:flutter/services.dart' show SmartQuotesType, SmartDashesType;
/// return Material( /// return Material(
/// child: Center( /// child: Center(
/// child: Shortcuts( /// child: Shortcuts(
/// shortcuts: <LogicalKeySet, Intent>{ /// shortcuts: const <ShortcutActivator, Intent>{
/// // Pressing space in the field will now move to the next field. /// // Pressing space in the field will now move to the next field.
/// LogicalKeySet(LogicalKeyboardKey.space): const NextFocusIntent(), /// SingleActivator(LogicalKeyboardKey.space): NextFocusIntent(),
/// }, /// },
/// child: FocusTraversalGroup( /// child: FocusTraversalGroup(
/// child: Form( /// child: Form(
......
...@@ -1136,8 +1136,10 @@ class _ActionsMarker extends InheritedWidget { ...@@ -1136,8 +1136,10 @@ class _ActionsMarker extends InheritedWidget {
/// bool _focused = false; /// bool _focused = false;
/// bool _hovering = false; /// bool _hovering = false;
/// bool _on = false; /// bool _on = false;
/// late Map<Type, Action<Intent>> _actionMap; /// late final Map<Type, Action<Intent>> _actionMap;
/// late Map<LogicalKeySet, Intent> _shortcutMap; /// final Map<ShortcutActivator, Intent> _shortcutMap = const <ShortcutActivator, Intent>{
/// SingleActivator(LogicalKeyboardKey.keyX): ActivateIntent(),
/// };
/// ///
/// @override /// @override
/// void initState() { /// void initState() {
...@@ -1147,9 +1149,6 @@ class _ActionsMarker extends InheritedWidget { ...@@ -1147,9 +1149,6 @@ class _ActionsMarker extends InheritedWidget {
/// onInvoke: (Intent intent) => _toggleState(), /// onInvoke: (Intent intent) => _toggleState(),
/// ), /// ),
/// }; /// };
/// _shortcutMap = <LogicalKeySet, Intent>{
/// LogicalKeySet(LogicalKeyboardKey.keyX): const ActivateIntent(),
/// };
/// } /// }
/// ///
/// Color get color { /// Color get color {
...@@ -1287,7 +1286,7 @@ class FocusableActionDetector extends StatefulWidget { ...@@ -1287,7 +1286,7 @@ class FocusableActionDetector extends StatefulWidget {
final Map<Type, Action<Intent>>? actions; final Map<Type, Action<Intent>>? actions;
/// {@macro flutter.widgets.shortcuts.shortcuts} /// {@macro flutter.widgets.shortcuts.shortcuts}
final Map<LogicalKeySet, Intent>? shortcuts; final Map<ShortcutActivator, Intent>? shortcuts;
/// A function that will be called when the focus highlight should be shown or /// A function that will be called when the focus highlight should be shown or
/// hidden. /// hidden.
......
...@@ -880,9 +880,9 @@ class WidgetsApp extends StatefulWidget { ...@@ -880,9 +880,9 @@ class WidgetsApp extends StatefulWidget {
/// ```dart /// ```dart
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// return WidgetsApp( /// return WidgetsApp(
/// shortcuts: <LogicalKeySet, Intent>{ /// shortcuts: <ShortcutActivator, Intent>{
/// ... WidgetsApp.defaultShortcuts, /// ... WidgetsApp.defaultShortcuts,
/// LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(), /// const SingleActivator(LogicalKeyboardKey.select): const ActivateIntent(),
/// }, /// },
/// color: const Color(0xFFFF0000), /// color: const Color(0xFFFF0000),
/// builder: (BuildContext context, Widget? child) { /// builder: (BuildContext context, Widget? child) {
...@@ -896,14 +896,14 @@ class WidgetsApp extends StatefulWidget { ...@@ -896,14 +896,14 @@ class WidgetsApp extends StatefulWidget {
/// {@template flutter.widgets.widgetsApp.shortcuts.seeAlso} /// {@template flutter.widgets.widgetsApp.shortcuts.seeAlso}
/// See also: /// See also:
/// ///
/// * [LogicalKeySet], a set of [LogicalKeyboardKey]s that make up the keys /// * [SingleActivator], which defines shortcut key combination of a single
/// for this map. /// key and modifiers, such as "Delete" or "Control+C".
/// * The [Shortcuts] widget, which defines a keyboard mapping. /// * The [Shortcuts] widget, which defines a keyboard mapping.
/// * The [Actions] widget, which defines the mapping from intent to action. /// * The [Actions] widget, which defines the mapping from intent to action.
/// * The [Intent] and [Action] classes, which allow definition of new /// * The [Intent] and [Action] classes, which allow definition of new
/// actions. /// actions.
/// {@endtemplate} /// {@endtemplate}
final Map<LogicalKeySet, Intent>? shortcuts; final Map<ShortcutActivator, Intent>? shortcuts;
/// {@template flutter.widgets.widgetsApp.actions} /// {@template flutter.widgets.widgetsApp.actions}
/// The default map of intent keys to actions for the application. /// The default map of intent keys to actions for the application.
...@@ -1003,91 +1003,91 @@ class WidgetsApp extends StatefulWidget { ...@@ -1003,91 +1003,91 @@ class WidgetsApp extends StatefulWidget {
/// with "s". /// with "s".
static bool debugAllowBannerOverride = true; static bool debugAllowBannerOverride = true;
static final Map<LogicalKeySet, Intent> _defaultShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _defaultShortcuts = <ShortcutActivator, Intent>{
// Activation // Activation
LogicalKeySet(LogicalKeyboardKey.enter): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.enter): ActivateIntent(),
LogicalKeySet(LogicalKeyboardKey.space): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.space): ActivateIntent(),
LogicalKeySet(LogicalKeyboardKey.gameButtonA): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.gameButtonA): ActivateIntent(),
// Dismissal // Dismissal
LogicalKeySet(LogicalKeyboardKey.escape): const DismissIntent(), SingleActivator(LogicalKeyboardKey.escape): DismissIntent(),
// Keyboard traversal. // Keyboard traversal.
LogicalKeySet(LogicalKeyboardKey.tab): const NextFocusIntent(), SingleActivator(LogicalKeyboardKey.tab): NextFocusIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab): const PreviousFocusIntent(), SingleActivator(LogicalKeyboardKey.tab, shift: true): PreviousFocusIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const DirectionalFocusIntent(TraversalDirection.left), SingleActivator(LogicalKeyboardKey.arrowLeft): DirectionalFocusIntent(TraversalDirection.left),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const DirectionalFocusIntent(TraversalDirection.right), SingleActivator(LogicalKeyboardKey.arrowRight): DirectionalFocusIntent(TraversalDirection.right),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const DirectionalFocusIntent(TraversalDirection.down), SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const DirectionalFocusIntent(TraversalDirection.up), SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up),
// Scrolling // Scrolling
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowUp): const ScrollIntent(direction: AxisDirection.up), SingleActivator(LogicalKeyboardKey.arrowUp, control: true): ScrollIntent(direction: AxisDirection.up),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowDown): const ScrollIntent(direction: AxisDirection.down), SingleActivator(LogicalKeyboardKey.arrowDown, control: true): ScrollIntent(direction: AxisDirection.down),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const ScrollIntent(direction: AxisDirection.left), SingleActivator(LogicalKeyboardKey.arrowLeft, control: true): ScrollIntent(direction: AxisDirection.left),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const ScrollIntent(direction: AxisDirection.right), SingleActivator(LogicalKeyboardKey.arrowRight, control: true): ScrollIntent(direction: AxisDirection.right),
LogicalKeySet(LogicalKeyboardKey.pageUp): const ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page), SingleActivator(LogicalKeyboardKey.pageUp): ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page),
LogicalKeySet(LogicalKeyboardKey.pageDown): const ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page), SingleActivator(LogicalKeyboardKey.pageDown): ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page),
}; };
// Default shortcuts for the web platform. // Default shortcuts for the web platform.
static final Map<LogicalKeySet, Intent> _defaultWebShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _defaultWebShortcuts = <ShortcutActivator, Intent>{
// Activation // Activation
LogicalKeySet(LogicalKeyboardKey.space): const PrioritizedIntents( SingleActivator(LogicalKeyboardKey.space): PrioritizedIntents(
orderedIntents: <Intent>[ orderedIntents: <Intent>[
ActivateIntent(), ActivateIntent(),
ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page), ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page),
], ],
), ),
// On the web, enter activates buttons, but not other controls. // On the web, enter activates buttons, but not other controls.
LogicalKeySet(LogicalKeyboardKey.enter): const ButtonActivateIntent(), SingleActivator(LogicalKeyboardKey.enter): ButtonActivateIntent(),
// Dismissal // Dismissal
LogicalKeySet(LogicalKeyboardKey.escape): const DismissIntent(), SingleActivator(LogicalKeyboardKey.escape): DismissIntent(),
// Keyboard traversal. // Keyboard traversal.
LogicalKeySet(LogicalKeyboardKey.tab): const NextFocusIntent(), SingleActivator(LogicalKeyboardKey.tab): NextFocusIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab): const PreviousFocusIntent(), SingleActivator(LogicalKeyboardKey.tab, shift: true): PreviousFocusIntent(),
// Scrolling // Scrolling
LogicalKeySet(LogicalKeyboardKey.arrowUp): const ScrollIntent(direction: AxisDirection.up), SingleActivator(LogicalKeyboardKey.arrowUp): ScrollIntent(direction: AxisDirection.up),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const ScrollIntent(direction: AxisDirection.down), SingleActivator(LogicalKeyboardKey.arrowDown): ScrollIntent(direction: AxisDirection.down),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const ScrollIntent(direction: AxisDirection.left), SingleActivator(LogicalKeyboardKey.arrowLeft): ScrollIntent(direction: AxisDirection.left),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const ScrollIntent(direction: AxisDirection.right), SingleActivator(LogicalKeyboardKey.arrowRight): ScrollIntent(direction: AxisDirection.right),
LogicalKeySet(LogicalKeyboardKey.pageUp): const ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page), SingleActivator(LogicalKeyboardKey.pageUp): ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page),
LogicalKeySet(LogicalKeyboardKey.pageDown): const ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page), SingleActivator(LogicalKeyboardKey.pageDown): ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page),
}; };
// Default shortcuts for the macOS platform. // Default shortcuts for the macOS platform.
static final Map<LogicalKeySet, Intent> _defaultAppleOsShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _defaultAppleOsShortcuts = <ShortcutActivator, Intent>{
// Activation // Activation
LogicalKeySet(LogicalKeyboardKey.enter): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.enter): ActivateIntent(),
LogicalKeySet(LogicalKeyboardKey.space): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.space): ActivateIntent(),
// Dismissal // Dismissal
LogicalKeySet(LogicalKeyboardKey.escape): const DismissIntent(), SingleActivator(LogicalKeyboardKey.escape): DismissIntent(),
// Keyboard traversal // Keyboard traversal
LogicalKeySet(LogicalKeyboardKey.tab): const NextFocusIntent(), SingleActivator(LogicalKeyboardKey.tab): NextFocusIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.tab): const PreviousFocusIntent(), SingleActivator(LogicalKeyboardKey.tab, shift: true): PreviousFocusIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const DirectionalFocusIntent(TraversalDirection.left), SingleActivator(LogicalKeyboardKey.arrowLeft): DirectionalFocusIntent(TraversalDirection.left),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const DirectionalFocusIntent(TraversalDirection.right), SingleActivator(LogicalKeyboardKey.arrowRight): DirectionalFocusIntent(TraversalDirection.right),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const DirectionalFocusIntent(TraversalDirection.down), SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const DirectionalFocusIntent(TraversalDirection.up), SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up),
// Scrolling // Scrolling
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowUp): const ScrollIntent(direction: AxisDirection.up), SingleActivator(LogicalKeyboardKey.arrowUp, meta: true): ScrollIntent(direction: AxisDirection.up),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowDown): const ScrollIntent(direction: AxisDirection.down), SingleActivator(LogicalKeyboardKey.arrowDown, meta: true): ScrollIntent(direction: AxisDirection.down),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowLeft): const ScrollIntent(direction: AxisDirection.left), SingleActivator(LogicalKeyboardKey.arrowLeft, meta: true): ScrollIntent(direction: AxisDirection.left),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowRight): const ScrollIntent(direction: AxisDirection.right), SingleActivator(LogicalKeyboardKey.arrowRight, meta: true): ScrollIntent(direction: AxisDirection.right),
LogicalKeySet(LogicalKeyboardKey.pageUp): const ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page), SingleActivator(LogicalKeyboardKey.pageUp): ScrollIntent(direction: AxisDirection.up, type: ScrollIncrementType.page),
LogicalKeySet(LogicalKeyboardKey.pageDown): const ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page), SingleActivator(LogicalKeyboardKey.pageDown): ScrollIntent(direction: AxisDirection.down, type: ScrollIncrementType.page),
}; };
/// Generates the default shortcut key bindings based on the /// Generates the default shortcut key bindings based on the
/// [defaultTargetPlatform]. /// [defaultTargetPlatform].
/// ///
/// Used by [WidgetsApp] to assign a default value to [WidgetsApp.shortcuts]. /// Used by [WidgetsApp] to assign a default value to [WidgetsApp.shortcuts].
static Map<LogicalKeySet, Intent> get defaultShortcuts { static Map<ShortcutActivator, Intent> get defaultShortcuts {
if (kIsWeb) { if (kIsWeb) {
return _defaultWebShortcuts; return _defaultWebShortcuts;
} }
......
...@@ -32,9 +32,9 @@ import 'text_editing_intents.dart'; ...@@ -32,9 +32,9 @@ import 'text_editing_intents.dart';
/// return DefaultTextEditingShortcuts( /// return DefaultTextEditingShortcuts(
/// child: Center( /// child: Center(
/// child: Shortcuts( /// child: Shortcuts(
/// shortcuts: <LogicalKeySet, Intent>{ /// shortcuts: const <ShortcutActivator, Intent>{
/// LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const NextFocusIntent(), /// SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): NextFocusIntent(),
/// LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const PreviousFocusIntent(), /// SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): PreviousFocusIntent(),
/// }, /// },
/// child: Column( /// child: Column(
/// children: const <Widget>[ /// children: const <Widget>[
...@@ -97,9 +97,9 @@ import 'text_editing_intents.dart'; ...@@ -97,9 +97,9 @@ import 'text_editing_intents.dart';
/// style: Theme.of(context).textTheme.headline4, /// style: Theme.of(context).textTheme.headline4,
/// ), /// ),
/// Shortcuts( /// Shortcuts(
/// shortcuts: <LogicalKeySet, Intent>{ /// shortcuts: <ShortcutActivator, Intent>{
/// LogicalKeySet(LogicalKeyboardKey.arrowUp): IncrementCounterIntent(), /// const SingleActivator(LogicalKeyboardKey.arrowUp): IncrementCounterIntent(),
/// LogicalKeySet(LogicalKeyboardKey.arrowDown): DecrementCounterIntent(), /// const SingleActivator(LogicalKeyboardKey.arrowDown): DecrementCounterIntent(),
/// }, /// },
/// child: Actions( /// child: Actions(
/// actions: <Type, Action<Intent>>{ /// actions: <Type, Action<Intent>>{
...@@ -160,33 +160,33 @@ class DefaultTextEditingShortcuts extends Shortcuts { ...@@ -160,33 +160,33 @@ class DefaultTextEditingShortcuts extends Shortcuts {
child: child, child: child,
); );
static final Map<LogicalKeySet, Intent> _androidShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _androidShortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(), SingleActivator(LogicalKeyboardKey.backspace): DeleteTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, control: true): DeleteByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, alt: true): DeleteByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(), SingleActivator(LogicalKeyboardKey.delete): DeleteForwardTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(), SingleActivator(LogicalKeyboardKey.delete, control: true): DeleteForwardByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(), SingleActivator(LogicalKeyboardKey.delete, alt: true): DeleteForwardByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): MoveSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, alt: true): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const MoveSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): MoveSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExpandSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, alt: true): ExpandSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExpandSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, alt: true): ExpandSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExpandSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, alt: true): ExpandSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExpandSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, alt: true): ExpandSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const MoveSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown): MoveSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): MoveSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const MoveSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): MoveSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const MoveSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp): MoveSelectionUpTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, control: true): MoveSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, control: true): MoveSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): ExtendSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): ExtendSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): ExtendSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): ExtendSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): ExtendSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): ExtendSelectionUpTextIntent(),
// The following key combinations have no effect on text editing on this // The following key combinations have no effect on text editing on this
// platform: // platform:
// * End // * End
...@@ -205,33 +205,33 @@ class DefaultTextEditingShortcuts extends Shortcuts { ...@@ -205,33 +205,33 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Meta + backspace // * Meta + backspace
}; };
static final Map<LogicalKeySet, Intent> _fuchsiaShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _fuchsiaShortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(), SingleActivator(LogicalKeyboardKey.backspace): DeleteTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, control: true): DeleteByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, alt: true): DeleteByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(), SingleActivator(LogicalKeyboardKey.delete): DeleteForwardTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(), SingleActivator(LogicalKeyboardKey.delete, control: true): DeleteForwardByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(), SingleActivator(LogicalKeyboardKey.delete, alt: true): DeleteForwardByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): MoveSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, alt: true): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const MoveSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): MoveSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExpandSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, alt: true): ExpandSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExpandSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, alt: true): ExpandSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExpandSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, alt: true): ExpandSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExpandSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, alt: true): ExpandSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const MoveSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown): MoveSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): MoveSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const MoveSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): MoveSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const MoveSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp): MoveSelectionUpTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, control: true): MoveSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, control: true): MoveSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): ExtendSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): ExtendSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): ExtendSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): ExtendSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): ExtendSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): ExtendSelectionUpTextIntent(),
// The following key combinations have no effect on text editing on this // The following key combinations have no effect on text editing on this
// platform: // platform:
// * Meta + arrow down // * Meta + arrow down
...@@ -250,33 +250,33 @@ class DefaultTextEditingShortcuts extends Shortcuts { ...@@ -250,33 +250,33 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Meta + backspace // * Meta + backspace
}; };
static final Map<LogicalKeySet, Intent> _iOSShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _iOSShortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(), SingleActivator(LogicalKeyboardKey.backspace): DeleteTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, control: true): DeleteByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, alt: true): DeleteByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(), SingleActivator(LogicalKeyboardKey.delete): DeleteForwardTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(), SingleActivator(LogicalKeyboardKey.delete, control: true): DeleteForwardByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(), SingleActivator(LogicalKeyboardKey.delete, alt: true): DeleteForwardByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): MoveSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, alt: true): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const MoveSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): MoveSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExpandSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, alt: true): ExpandSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExpandSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, alt: true): ExpandSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExpandSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, alt: true): ExpandSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExpandSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, alt: true): ExpandSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const MoveSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown): MoveSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): MoveSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const MoveSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): MoveSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const MoveSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp): MoveSelectionUpTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, control: true): MoveSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, control: true): MoveSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): ExtendSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): ExtendSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): ExtendSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): ExtendSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): ExtendSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): ExtendSelectionUpTextIntent(),
// The following key combinations have no effect on text editing on this // The following key combinations have no effect on text editing on this
// platform: // platform:
// * Meta + arrow down // * Meta + arrow down
...@@ -295,33 +295,33 @@ class DefaultTextEditingShortcuts extends Shortcuts { ...@@ -295,33 +295,33 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Meta + backspace // * Meta + backspace
}; };
static final Map<LogicalKeySet, Intent> _linuxShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _linuxShortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(), SingleActivator(LogicalKeyboardKey.backspace): DeleteTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, control: true): DeleteByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, alt: true): DeleteByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(), SingleActivator(LogicalKeyboardKey.delete): DeleteForwardTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(), SingleActivator(LogicalKeyboardKey.delete, control: true): DeleteForwardByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(), SingleActivator(LogicalKeyboardKey.delete, alt: true): DeleteForwardByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): MoveSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, alt: true): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const MoveSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): MoveSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExpandSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, alt: true): ExpandSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExpandSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, alt: true): ExpandSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExpandSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, alt: true): ExpandSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExpandSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, alt: true): ExpandSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const MoveSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown): MoveSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): MoveSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const MoveSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): MoveSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const MoveSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp): MoveSelectionUpTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, control: true): MoveSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, control: true): MoveSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): ExtendSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): ExtendSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): ExtendSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): ExtendSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): ExtendSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): ExtendSelectionUpTextIntent(),
// The following key combinations have no effect on text editing on this // The following key combinations have no effect on text editing on this
// platform: // platform:
// * Meta + arrow down // * Meta + arrow down
...@@ -340,37 +340,37 @@ class DefaultTextEditingShortcuts extends Shortcuts { ...@@ -340,37 +340,37 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Meta + backspace // * Meta + backspace
}; };
static final Map<LogicalKeySet, Intent> _macShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _macShortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(), SingleActivator(LogicalKeyboardKey.backspace): DeleteTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, alt: true): DeleteByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, meta: true): DeleteByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(), SingleActivator(LogicalKeyboardKey.delete): DeleteForwardTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(), SingleActivator(LogicalKeyboardKey.delete, alt: true): DeleteForwardByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(), SingleActivator(LogicalKeyboardKey.delete, meta: true): DeleteForwardByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): MoveSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, alt: true): MoveSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, alt: true): ExtendSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftByWordAndStopAtReversalTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, alt: true): ExtendSelectionLeftByWordAndStopAtReversalTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightByWordAndStopAtReversalTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, alt: true): ExtendSelectionRightByWordAndStopAtReversalTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, alt: true): ExtendSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const MoveSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown): MoveSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): MoveSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const MoveSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): MoveSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const MoveSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp): MoveSelectionUpTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, meta: true): MoveSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, meta: true): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, meta: true): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowUp): const MoveSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, meta: true): MoveSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExpandSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, meta: true): ExpandSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExpandSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, meta: true): ExpandSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExpandSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, meta: true): ExpandSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExpandSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, meta: true): ExpandSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): ExtendSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): ExtendSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): ExtendSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): ExtendSelectionUpTextIntent(),
// The following key combinations have no effect on text editing on this // The following key combinations have no effect on text editing on this
// platform: // platform:
// * Control + arrow left // * Control + arrow left
...@@ -385,37 +385,37 @@ class DefaultTextEditingShortcuts extends Shortcuts { ...@@ -385,37 +385,37 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// * Control + backspace // * Control + backspace
}; };
static final Map<LogicalKeySet, Intent> _windowsShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _windowsShortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.backspace): const DeleteTextIntent(), SingleActivator(LogicalKeyboardKey.backspace): DeleteTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DeleteByWordTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, control: true): DeleteByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DeleteByLineTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, alt: true): DeleteByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const DeleteForwardTextIntent(), SingleActivator(LogicalKeyboardKey.delete): DeleteForwardTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DeleteForwardByWordTextIntent(), SingleActivator(LogicalKeyboardKey.delete, control: true): DeleteForwardByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DeleteForwardByLineTextIntent(), SingleActivator(LogicalKeyboardKey.delete, alt: true): DeleteForwardByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const MoveSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): MoveSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, alt: true): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const MoveSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): MoveSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExpandSelectionToEndTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, alt: true): ExpandSelectionToEndTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExpandSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, alt: true): ExpandSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExpandSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, alt: true): ExpandSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExpandSelectionToStartTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, alt: true): ExpandSelectionToStartTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const MoveSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown): MoveSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): MoveSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const MoveSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): MoveSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const MoveSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp): MoveSelectionUpTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const MoveSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, control: true): MoveSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const MoveSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, control: true): MoveSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): ExtendSelectionLeftByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightByWordTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): ExtendSelectionRightByWordTextIntent(),
LogicalKeySet(LogicalKeyboardKey.end): const MoveSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.end): MoveSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.home): const MoveSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.home): MoveSelectionLeftByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const ExtendSelectionDownTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): ExtendSelectionDownTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const ExtendSelectionLeftTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): ExtendSelectionLeftTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const ExtendSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): ExtendSelectionRightTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const ExtendSelectionUpTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): ExtendSelectionUpTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.end): const ExpandSelectionRightByLineTextIntent(), SingleActivator(LogicalKeyboardKey.end, shift: true): ExpandSelectionRightByLineTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.home): const ExpandSelectionLeftByLineTextIntent(), SingleActivator(LogicalKeyboardKey.home, shift: true): ExpandSelectionLeftByLineTextIntent(),
// The following key combinations have no effect on text editing on this // The following key combinations have no effect on text editing on this
// platform: // platform:
// * Meta + arrow down // * Meta + arrow down
...@@ -432,51 +432,51 @@ class DefaultTextEditingShortcuts extends Shortcuts { ...@@ -432,51 +432,51 @@ class DefaultTextEditingShortcuts extends Shortcuts {
// Web handles its text selection natively and doesn't use any of these // Web handles its text selection natively and doesn't use any of these
// shortcuts in Flutter. // shortcuts in Flutter.
static final Map<LogicalKeySet, Intent> _webShortcuts = <LogicalKeySet, Intent>{ static const Map<ShortcutActivator, Intent> _webShortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.backspace): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.delete): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.delete, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, control: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.delete, control: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.backspace): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.backspace, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.delete): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.delete, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.arrowUp): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, alt: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowUp): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, control: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, control: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, control: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, control: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.end): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.end): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.home): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.home): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.arrowUp): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true, meta: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowDown): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowDown, shift: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowLeft): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft, shift: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight, shift: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.arrowUp): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowUp, shift: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.end): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.end, shift: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.shift, LogicalKeyboardKey.home): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.home, shift: true): DoNothingAndStopPropagationTextIntent(),
LogicalKeySet(LogicalKeyboardKey.space): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.space): DoNothingAndStopPropagationTextIntent(),
}; };
static Map<LogicalKeySet, Intent> get _shortcuts { static Map<ShortcutActivator, Intent> get _shortcuts {
if (kIsWeb) { if (kIsWeb) {
return _webShortcuts; return _webShortcuts;
} }
......
...@@ -355,7 +355,7 @@ class LogicalKeySet extends KeySet<LogicalKeyboardKey> with Diagnosticable ...@@ -355,7 +355,7 @@ class LogicalKeySet extends KeySet<LogicalKeyboardKey> with Diagnosticable
/// Intent>` (the same type as the [Shortcuts.shortcuts] property) so that its /// Intent>` (the same type as the [Shortcuts.shortcuts] property) so that its
/// diagnostic output is human-readable. /// diagnostic output is human-readable.
class ShortcutMapProperty extends DiagnosticsProperty<Map<ShortcutActivator, Intent>> { class ShortcutMapProperty extends DiagnosticsProperty<Map<ShortcutActivator, Intent>> {
/// Create a diagnostics property for `Map<LogicalKeySet, Intent>` objects, /// Create a diagnostics property for `Map<ShortcutActivator, Intent>` objects,
/// which are the same type as the [Shortcuts.shortcuts] property. /// which are the same type as the [Shortcuts.shortcuts] property.
ShortcutMapProperty( ShortcutMapProperty(
String name, String name,
......
...@@ -260,8 +260,8 @@ void main() { ...@@ -260,8 +260,8 @@ void main() {
Future<void> buildTest(Intent intent) async { Future<void> buildTest(Intent intent) async {
return tester.pumpWidget( return tester.pumpWidget(
Shortcuts( Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ shortcuts: <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.space): intent, const SingleActivator(LogicalKeyboardKey.space): intent,
}, },
child: Directionality( child: Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
...@@ -82,9 +82,9 @@ void main() { ...@@ -82,9 +82,9 @@ void main() {
await tester.pumpWidget(Directionality( await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Shortcuts( child: Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ shortcuts: const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.space): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.space): ActivateIntent(),
LogicalKeySet(LogicalKeyboardKey.enter): const ButtonActivateIntent(), SingleActivator(LogicalKeyboardKey.enter): ButtonActivateIntent(),
}, },
child: Material( child: Material(
child: Center( child: Center(
......
...@@ -46,9 +46,9 @@ void main() { ...@@ -46,9 +46,9 @@ void main() {
const Color splashColor = Color(0xff00ff00); const Color splashColor = Color(0xff00ff00);
await tester.pumpWidget( await tester.pumpWidget(
Shortcuts( Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ shortcuts: const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.enter): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.enter): ActivateIntent(),
LogicalKeySet(LogicalKeyboardKey.space): const ActivateIntent(), SingleActivator(LogicalKeyboardKey.space): ActivateIntent(),
}, },
child: Directionality( child: Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
...@@ -414,8 +414,8 @@ void main() { ...@@ -414,8 +414,8 @@ void main() {
child: FocusableActionDetector( child: FocusableActionDetector(
enabled: enabled, enabled: enabled,
focusNode: focusNode, focusNode: focusNode,
shortcuts: <LogicalKeySet, Intent>{ shortcuts: const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.enter): intent, SingleActivator(LogicalKeyboardKey.enter): intent,
}, },
actions: <Type, Action<Intent>>{ actions: <Type, Action<Intent>>{
TestIntent: testAction, TestIntent: testAction,
...@@ -789,8 +789,8 @@ void main() { ...@@ -789,8 +789,8 @@ void main() {
child: FocusableActionDetector( child: FocusableActionDetector(
enabled: enabled, enabled: enabled,
focusNode: focusNode, focusNode: focusNode,
shortcuts: <LogicalKeySet, Intent>{ shortcuts: const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.enter): intent, SingleActivator(LogicalKeyboardKey.enter): intent,
}, },
actions: <Type, Action<Intent>>{ actions: <Type, Action<Intent>>{
TestIntent: testAction, TestIntent: testAction,
......
...@@ -76,8 +76,8 @@ void main() { ...@@ -76,8 +76,8 @@ void main() {
actions: <Type, Action<Intent>>{ actions: <Type, Action<Intent>>{
TestIntent: action, TestIntent: action,
}, },
shortcuts: <LogicalKeySet, Intent> { shortcuts: const <ShortcutActivator, Intent> {
LogicalKeySet(LogicalKeyboardKey.space): const TestIntent(), SingleActivator(LogicalKeyboardKey.space): TestIntent(),
}, },
builder: (BuildContext context, Widget? child) { builder: (BuildContext context, Widget? child) {
return Material( return Material(
......
...@@ -6,8 +6,12 @@ import 'package:flutter/material.dart'; ...@@ -6,8 +6,12 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
class TestLeftIntent extends Intent {} class TestLeftIntent extends Intent {
class TestRightIntent extends Intent {} const TestLeftIntent();
}
class TestRightIntent extends Intent {
const TestRightIntent();
}
void main() { void main() {
testWidgets('DoNothingAndStopPropagationTextIntent', (WidgetTester tester) async { testWidgets('DoNothingAndStopPropagationTextIntent', (WidgetTester tester) async {
...@@ -25,13 +29,13 @@ void main() { ...@@ -25,13 +29,13 @@ void main() {
body: Builder( body: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return Shortcuts( return Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ shortcuts: const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowLeft): TestLeftIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): TestLeftIntent(),
LogicalKeySet(LogicalKeyboardKey.arrowRight): TestRightIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): TestRightIntent(),
}, },
child: Shortcuts( child: Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ shortcuts: const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowRight): const DoNothingAndStopPropagationTextIntent(), SingleActivator(LogicalKeyboardKey.arrowRight): DoNothingAndStopPropagationTextIntent(),
}, },
child: Actions( child: Actions(
// These Actions intercept default Intents, set a flag that they // These Actions intercept default Intents, set a flag that they
......
...@@ -7074,8 +7074,8 @@ void main() { ...@@ -7074,8 +7074,8 @@ void main() {
child: SizedBox( child: SizedBox(
width: 400, width: 400,
child: Shortcuts( child: Shortcuts(
shortcuts: <LogicalKeySet, Intent>{ shortcuts: const <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowLeft): const MoveSelectionRightTextIntent(), SingleActivator(LogicalKeyboardKey.arrowLeft): MoveSelectionRightTextIntent(),
}, },
child: EditableText( child: EditableText(
maxLines: 10, maxLines: 10,
......
...@@ -1893,11 +1893,11 @@ void main() { ...@@ -1893,11 +1893,11 @@ void main() {
final FocusNode focusNodeLowerRight = FocusNode(debugLabel: 'lowerRight'); final FocusNode focusNodeLowerRight = FocusNode(debugLabel: 'lowerRight');
Widget generateTestWidgets(bool ignoreTextFields) { Widget generateTestWidgets(bool ignoreTextFields) {
final Map<LogicalKeySet, Intent> shortcuts = <LogicalKeySet, Intent>{ final Map<ShortcutActivator, Intent> shortcuts = <ShortcutActivator, Intent>{
LogicalKeySet(LogicalKeyboardKey.arrowLeft): DirectionalFocusIntent(TraversalDirection.left, ignoreTextFields: ignoreTextFields), const SingleActivator(LogicalKeyboardKey.arrowLeft): DirectionalFocusIntent(TraversalDirection.left, ignoreTextFields: ignoreTextFields),
LogicalKeySet(LogicalKeyboardKey.arrowRight): DirectionalFocusIntent(TraversalDirection.right, ignoreTextFields: ignoreTextFields), const SingleActivator(LogicalKeyboardKey.arrowRight): DirectionalFocusIntent(TraversalDirection.right, ignoreTextFields: ignoreTextFields),
LogicalKeySet(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down, ignoreTextFields: ignoreTextFields), const SingleActivator(LogicalKeyboardKey.arrowDown): DirectionalFocusIntent(TraversalDirection.down, ignoreTextFields: ignoreTextFields),
LogicalKeySet(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up, ignoreTextFields: ignoreTextFields), const SingleActivator(LogicalKeyboardKey.arrowUp): DirectionalFocusIntent(TraversalDirection.up, ignoreTextFields: ignoreTextFields),
}; };
return MaterialApp( return MaterialApp(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment