fix(tv): stabilize long rail focus scrolling

This commit is contained in:
edde746
2026-05-22 23:55:54 +02:00
parent cbea1c8d8f
commit 8ec2795da1
4 changed files with 187 additions and 32 deletions
+3
View File
@@ -86,9 +86,12 @@ void scrollKeyedChildToHorizontalCenter(
GlobalKey key, {
bool animate = true,
int maxAttempts = 2,
bool Function()? isCurrent,
}) {
void schedule(int attempt) {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (isCurrent?.call() == false) return;
final context = key.currentContext;
if (context == null) {
if (attempt < maxAttempts) schedule(attempt + 1);