horizontalStep function
Resolves a horizontal arrow key to a logical index step for the given
text dir. Returns +1 (next index) or -1 (previous index) for the
right/left arrows, mirrored under RTL, and 0 for any other key.
Implementation
int horizontalStep(LogicalKeyboardKey key, TextDirection dir) {
final rtl = dir == TextDirection.rtl;
if (key == LogicalKeyboardKey.arrowRight) return rtl ? -1 : 1;
if (key == LogicalKeyboardKey.arrowLeft) return rtl ? 1 : -1;
return 0;
}