Added feature for focus neighbours to simplify button navigation #450
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not sure if this is something people inherently want or if only I'd find some use, but alas:
FocusNeighbour
for top/bottom/left/right/next/previous to simplify navigation using something other than a mouse.This can hook into controller/keyboard using an input middleground, An example use case might be,
If you have a vertical list of buttons setup like so:
protected List<ButtonBase2> _listOfButtons = [];
in an abstract base class, (using theButtonBase2
abstract class as the list type to account for buttons or toggle buttons). The list would get populated whenever you add a button to the desktop. Then the following code to hook up the vertical navigation in the buttons.and later,
This can also be done in other cases; in a horizontal list you could just hook into the
FocusNeighbourLeft
andFocusNeighbourRight
. The next/previous bit could be used if you have something akin to tab/shift tab to focus whatever's after or before. The code above would work the same if you had a controller or a keyboard.It's something I'm personally using to create a focus flow for easier navigation.