From f25ed59a37ffcb11fb1eae8a2d76e5c12e8d9627 Mon Sep 17 00:00:00 2001 From: PartyDonut Date: Fri, 17 Oct 2025 22:18:52 +0200 Subject: [PATCH] fix: Duplicate focusing issue --- lib/widgets/shared/horizontal_list.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/widgets/shared/horizontal_list.dart b/lib/widgets/shared/horizontal_list.dart index e5d768f..79fdeae 100644 --- a/lib/widgets/shared/horizontal_list.dart +++ b/lib/widgets/shared/horizontal_list.dart @@ -61,6 +61,7 @@ class _HorizontalListState extends ConsumerState with TickerProv final contentPadding = 8.0; double? contentWidth; double? _firstItemWidth; + bool hasFocus = false; AnimationController? _scrollAnimation; @@ -246,7 +247,8 @@ class _HorizontalListState extends ConsumerState with TickerProv Focus( focusNode: parentNode, onFocusChange: (value) { - if (value) { + if (value && hasFocus != value) { + hasFocus = value; final nodesOnSameRow = _nodesInRow(parentNode); final currentNode = nodesOnSameRow.contains(lastFocused) ? lastFocused : _firstFullyVisibleNode(context, nodesOnSameRow); @@ -262,9 +264,10 @@ class _HorizontalListState extends ConsumerState with TickerProv } else { context.ensureVisible(); } - currentNode.requestFocus(); } + } else { + hasFocus = false; } }, child: SizedBox(