1. 20 Jan, 2023 1 commit
  2. 18 Jan, 2023 1 commit
  3. 31 Oct, 2022 1 commit
  4. 17 Oct, 2022 1 commit
  5. 17 Aug, 2022 1 commit
  6. 19 Jul, 2022 1 commit
  7. 15 Jun, 2022 1 commit
  8. 25 May, 2022 3 commits
    • Greg Spencer's avatar
      Removing Shorcuts.of and Shortctus.maybeOf (#104215) · da24f105
      Greg Spencer authored
      This removes Shorcuts.of and Shortctus.maybeOf because they're not especially useful, since the only thing you can really set on a ShortcutManager is the shortcuts, and the Shortcuts widget that you give it to manages those, so if it rebuilds, it overwrites what you set.
      
      Also, adds a Shortcuts.manager constructor and removes the manager argument to the Shortcuts widget.
      
      Removing these will also eliminate an InheritedWidget for each Shortcuts widget, improving memory usage.
      da24f105
    • Michael Goderbauer's avatar
      d5fbc375
    • Greg Spencer's avatar
      A bunch of cleanups and a missing `ShortcutRegistar` in `WidgetsApp` (#104560) · 0a417c3b
      Greg Spencer authored
      A bunch of random cleanup things I found while doing MenuBar development.
      
      Changes an if test to an assert in binding.dart, since the if should always be true.
      Adds the default ShortcutRegistrar that should have been in the ShortcutRegistry PR.
      Moves a debug message in the FocusManager to print the result after the focus change instead of before.
      Reorders the test parameters in theme_data_test.dart to match the order of the theme data fields everywhere else.
      0a417c3b
  9. 19 May, 2022 1 commit
    • Greg Spencer's avatar
      Add ShortcutsRegistry (#103456) · f6c3ee31
      Greg Spencer authored
      This adds a ShortcutsRegistry for ShortcutActivator to Intent mappings that can be modified from its descendants.
      
      This is so that descendants can make shortcuts dynamically available to a larger portion of the app than just their descendants. This is a precursor needed by the new MenuBar, for instance, so that the menu bar itself can be placed where it likes, but the shortcuts it defines can be in effect for most, if not all, of the UI surface in the app. For example, the "Ctrl-Q" quit binding would need to work even if the focused widget wasn't a child of the MenuBar.
      
      This just provides the shortcut to intent mapping, the actions activated by the intent are described in the context where they make sense. For example, defining a "Ctrl-C" shortcut mapped to a "CopyIntent" should perform different functions if it happens while a TextField has focus vs when a drawing has focus, so those different areas would need to define different actions mapped to "CopyIntent". A hypothetical "QuitIntent" would probably be active for the entire app, so would be mapped in an Actions widget near the top of the hierarchy.
      f6c3ee31
  10. 14 Apr, 2022 1 commit
  11. 30 Mar, 2022 1 commit
  12. 07 Jan, 2022 1 commit
  13. 14 Dec, 2021 1 commit
  14. 17 Nov, 2021 1 commit
  15. 29 Jul, 2021 1 commit
  16. 28 Jul, 2021 1 commit
  17. 26 Jul, 2021 1 commit
  18. 09 Jul, 2021 1 commit
  19. 19 May, 2021 1 commit
  20. 14 May, 2021 1 commit
  21. 28 Apr, 2021 1 commit
  22. 15 Apr, 2021 1 commit
    • Tong Mu's avatar
      Shortcut activator (#78522) · eb735167
      Tong Mu authored
      This PR introduced a new class, ShortcutActivator, and refactored the the definition and lookup system of shortcuts, in order to solve a few issues of the previous algorithm.
      eb735167
  23. 14 Apr, 2021 1 commit
    • Greg Spencer's avatar
      Handle null primary focus when receiving key events (#80302) · 6b06943c
      Greg Spencer authored
      This allows the key handling code in the shortcut manager to function when there is a null primaryFocus. The primary focus can be null only in some special circumstances (e.g. when an app hasn't set any focus at all), but that shouldn't cause a crash.
      6b06943c
  24. 28 Mar, 2021 1 commit
  25. 27 Mar, 2021 1 commit
  26. 25 Mar, 2021 1 commit
  27. 24 Mar, 2021 2 commits
  28. 04 Mar, 2021 1 commit
  29. 17 Feb, 2021 1 commit
  30. 05 Jan, 2021 1 commit
  31. 29 Oct, 2020 1 commit
    • Greg Spencer's avatar
      Remove nullOk parameter from Shortcuts.of, Actions.find, and Actions.handler (#68921) · 4f586fa3
      Greg Spencer authored
      This removes the nullOk parameter from Shortcuts.of, Actions.find and Actions.handler and created Shortcuts.maybeOf and Actions.maybeFind. Shortcuts.of and Actions.find now return non-nullable values, and the maybe versions return a nullable value. I didn't create a non-nullable version of Actions.handler, since it needs to be able to return null if an action is not enabled, but I did remove the nullOk parameter, effectively setting it to true permanently, since setting it to false doesn't make much sense if the function can still return null when the action is not enabled.
      4f586fa3
  32. 19 Oct, 2020 1 commit
    • Greg Spencer's avatar
      Mark keys that match a shortcut, but have no action defined as "not handled". (#67359) · 8c03ff8c
      Greg Spencer authored
      - - When I added notification of key events before processing them as text, it made it so that shortcut key bindings like the spacebar would prevent spaces from being inserted into text fields, which is obviously not desirable (and so that change was reverted). At the same time, we do want to make it possible to override key events so that they can do things like intercept a tab key or arrow keys that change the focus.
      
      This PR changes the behavior of the Shortcuts widget so that if it has a shortcut defined, but no action is bound to the intent, then instead of responding that the key is "handled", it responds as if nothing handled it. This allows the engine to continue to process the key as text entry.
      
      This PR includes:
      
      - Modification of the callback type for key handlers to return a KeyEventResult instead of a bool, so that we can return more information (i.e. the extra state of "stop propagation").
      - Modification of the ActionDispatcher.invokeAction contract to require that Action.isEnabled return true before calling it. It will now assert if the action isn't enabled when invokeAction is called. This is to allow optimization of the number of calls to isEnabled, since the shortcuts widget now wants to know if the action was enabled before deciding to either handle the key or to return ignored.
      - Modification to ShortcutManager.handleKeypress to return KeyEventResult.ignored for keys which don't have an enabled action associated with them.
      - Adds an attribute to DoNothingAction that allows it to mark a key as not handled, even though it does have an action associated with it. This will allow disabling of a shortcut for a subtree.
      8c03ff8c
  33. 15 Oct, 2020 1 commit
  34. 11 Jun, 2020 1 commit
  35. 03 Jun, 2020 1 commit
  36. 07 Apr, 2020 1 commit
    • Greg Spencer's avatar
      Revise Action API (#42940) · 0f68b46f
      Greg Spencer authored
      This updates the Action API in accordance with the design doc for the changes: flutter.dev/go/actions-and-shortcuts-design-revision
      
      Fixes #53276
      0f68b46f
  37. 06 Apr, 2020 1 commit