@@ -869,6 +869,13 @@ class ShortcutManager with Diagnosticable, ChangeNotifier {
869
869
/// when invoking an [Action] via a keyboard key combination that maps to an
870
870
/// [Intent] .
871
871
///
872
+ /// This is similar to but more powerful than the [CallbackShortcuts] widget.
873
+ /// Unlike [CallbackShortcuts] , this widget separates key bindings and their
874
+ /// implementations. This separation allows [Shortcuts] to have key bindings
875
+ /// that adapt to the focused context. For example, the desired action for a
876
+ /// deletion intent may be to delete a character in a text input, or to delete
877
+ /// a file in a file menu.
878
+ ///
872
879
/// See the article on [Using Actions and
873
880
/// Shortcuts](https://docs.flutter.dev/development/ui/advanced/actions_and_shortcuts)
874
881
/// for a detailed explanation.
@@ -903,8 +910,8 @@ class ShortcutManager with Diagnosticable, ChangeNotifier {
903
910
///
904
911
/// See also:
905
912
///
906
- /// * [CallbackShortcuts] , a less complicated ( but less flexible) way of
907
- /// defining key bindings that just invoke callbacks.
913
+ /// * [CallbackShortcuts] , a simpler but less flexible widget that defines key
914
+ /// bindings that invoke callbacks.
908
915
/// * [Intent] , a class for containing a description of a user action to be
909
916
/// invoked.
910
917
/// * [Action] , a class for defining an invocation of a user action.
@@ -1038,32 +1045,32 @@ class _ShortcutsState extends State<Shortcuts> {
1038
1045
}
1039
1046
}
1040
1047
1041
- /// A widget that provides an uncomplicated mechanism for binding a key
1042
- /// combination to a specific callback.
1043
- ///
1044
- /// This is similar to the functionality provided by the [Shortcuts] widget, but
1045
- /// instead of requiring a mapping to an [Intent] , and an [Actions] widget
1046
- /// somewhere in the widget tree to bind the [Intent] to, it just takes a set of
1047
- /// bindings that bind the key combination directly to a [VoidCallback] .
1048
+ /// A widget that binds key combinations to specific callbacks.
1048
1049
///
1049
- /// Because it is a simpler mechanism, it doesn't provide the ability to disable
1050
- /// the callbacks, or to separate the definition of the shortcuts from the
1051
- /// definition of the code that is triggered by them (the role that actions play
1052
- /// in the [Shortcuts] /[Actions] system).
1050
+ /// This is similar to but simpler than the [Shortcuts] widget as it doesn't
1051
+ /// require [Intent] s and [Actions] widgets. Instead, it accepts a map
1052
+ /// of [ShortcutActivator] s to [VoidCallback] s.
1053
1053
///
1054
- /// However, for some applications the complexity and flexibility of the
1055
- /// [Shortcuts] and [Actions] mechanism is overkill, and this widget is here for
1056
- /// those apps.
1054
+ /// Unlike [Shortcuts] , this widget does not separate key bindings and their
1055
+ /// implementations. This separation allows [Shortcuts] to have key bindings
1056
+ /// that adapt to the focused context. For example, the desired action for a
1057
+ /// deletion intent may be to delete a character in a text input, or to delete
1058
+ /// a file in a file menu.
1057
1059
///
1058
1060
/// [Shortcuts] and [CallbackShortcuts] can both be used in the same app. As
1059
1061
/// with any key handling widget, if this widget handles a key event then
1060
1062
/// widgets above it in the focus chain will not receive the event. This means
1061
1063
/// that if this widget handles a key, then an ancestor [Shortcuts] widget (or
1062
- /// any other key handling widget) will not receive that key, and similarly , if
1064
+ /// any other key handling widget) will not receive that key. Similarly , if
1063
1065
/// a descendant of this widget handles the key, then the key event will not
1064
1066
/// reach this widget for handling.
1065
1067
///
1068
+ /// See the article on [Using Actions and
1069
+ /// Shortcuts](https://docs.flutter.dev/development/ui/advanced/actions_and_shortcuts)
1070
+ /// for a detailed explanation.
1071
+ ///
1066
1072
/// See also:
1073
+ /// * [Shortcuts] , a more powerful widget for defining key bindings.
1067
1074
/// * [Focus] , a widget that defines which widgets can receive keyboard focus.
1068
1075
class CallbackShortcuts extends StatelessWidget {
1069
1076
/// Creates a const [CallbackShortcuts] widget.
0 commit comments