mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
chore: Android TV UI clean-up
This commit is contained in:
parent
fedc00c65b
commit
721fc28060
9 changed files with 119 additions and 74 deletions
|
|
@ -219,15 +219,17 @@ class _HorizontalListState extends ConsumerState<HorizontalList> {
|
|||
onFocusChange: (value) {
|
||||
if (value) {
|
||||
final nodesOnSameRow = _nodesInRow(parentNode);
|
||||
final focusNode = lastFocused ?? _firstFullyVisibleNode(context, nodesOnSameRow);
|
||||
final currentNode =
|
||||
nodesOnSameRow.contains(lastFocused) ? lastFocused : _firstFullyVisibleNode(context, nodesOnSameRow);
|
||||
|
||||
if (focusNode != null) {
|
||||
if (currentNode != null) {
|
||||
lastFocused = currentNode;
|
||||
if (widget.onFocused != null) {
|
||||
widget.onFocused!(nodesOnSameRow.indexOf(focusNode));
|
||||
widget.onFocused!(nodesOnSameRow.indexOf(currentNode));
|
||||
} else {
|
||||
context.ensureVisible();
|
||||
}
|
||||
focusNode.requestFocus();
|
||||
currentNode.requestFocus();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -240,7 +242,7 @@ class _HorizontalListState extends ConsumerState<HorizontalList> {
|
|||
child: FocusTraversalGroup(
|
||||
policy: HorizontalRailFocus(
|
||||
parentNode: parentNode,
|
||||
throttle: Throttler(duration: const Duration(milliseconds: 125)),
|
||||
throttle: Throttler(duration: const Duration(milliseconds: 100)),
|
||||
onFocused: (node) {
|
||||
lastFocused = node;
|
||||
final nodesOnSameRow = _nodesInRow(parentNode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue