From 708a1391e34398c15cb373524dfe9e069471cc04 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Mon, 4 May 2026 10:27:15 +0200 Subject: [PATCH] fix(desktop): hide hub hover arrows when row isn't scrollable --- .../horizontal_scroll_with_arrows.dart | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/lib/widgets/horizontal_scroll_with_arrows.dart b/lib/widgets/horizontal_scroll_with_arrows.dart index b443bbf5..422e2bc4 100644 --- a/lib/widgets/horizontal_scroll_with_arrows.dart +++ b/lib/widgets/horizontal_scroll_with_arrows.dart @@ -63,8 +63,9 @@ class _HorizontalScrollWithArrowsState extends State } final position = _scrollController.position; - final newLeft = position.pixels > 0; - final newRight = position.pixels < position.maxScrollExtent; + final isScrollable = position.maxScrollExtent > 0; + final newLeft = isScrollable && position.pixels > 0; + final newRight = isScrollable && position.pixels < position.maxScrollExtent; if (newLeft != _canScrollLeft || newRight != _canScrollRight) { setState(() { _canScrollLeft = newLeft; @@ -122,22 +123,28 @@ class _HorizontalScrollWithArrowsState extends State return MouseRegion( onEnter: (_) => setState(() => _isHovering = true), onExit: (_) => setState(() => _isHovering = false), - child: Stack( - children: [ - child, - _buildArrowButton( - position: 8, - icon: Symbols.chevron_left_rounded, - onPressed: _scrollLeft, - canScroll: _canScrollLeft, - ), - _buildArrowButton( - position: -8, - icon: Symbols.chevron_right_rounded, - onPressed: _scrollRight, - canScroll: _canScrollRight, - ), - ], + child: NotificationListener( + onNotification: (_) { + _updateScrollState(); + return false; + }, + child: Stack( + children: [ + child, + _buildArrowButton( + position: 8, + icon: Symbols.chevron_left_rounded, + onPressed: _scrollLeft, + canScroll: _canScrollLeft, + ), + _buildArrowButton( + position: -8, + icon: Symbols.chevron_right_rounded, + onPressed: _scrollRight, + canScroll: _canScrollRight, + ), + ], + ), ), ); }