fix: Improved logic horizontal list navigation

This commit is contained in:
PartyDonut 2025-10-16 22:22:50 +02:00
parent b4e68c9e15
commit 47128eb3b6
4 changed files with 40 additions and 15 deletions

View file

@ -10,6 +10,7 @@ import 'package:fladder/util/adaptive_layout/adaptive_layout.dart';
import 'package:fladder/util/localization_helper.dart';
import 'package:fladder/util/sticky_header_text.dart';
import 'package:fladder/util/string_extensions.dart';
import 'package:fladder/widgets/shared/ensure_visible.dart';
class NextUpEpisode extends ConsumerWidget {
final EpisodeModel nextEpisode;
@ -49,6 +50,11 @@ class NextUpEpisode extends ConsumerWidget {
showLabel: false,
onTap: () => nextEpisode.navigateTo(context),
actions: const [],
onFocusChanged: (value) {
if (value) {
context.ensureVisible();
}
},
isCurrentEpisode: false,
),
const SizedBox(height: 16),
@ -71,6 +77,11 @@ class NextUpEpisode extends ConsumerWidget {
showLabel: false,
onTap: () => nextEpisode.navigateTo(context),
actions: const [],
onFocusChanged: (value) {
if (value) {
context.ensureVisible();
}
},
isCurrentEpisode: false,
),
),

View file

@ -134,6 +134,7 @@ class EpisodePoster extends ConsumerWidget {
final Function()? onLongPress;
final bool blur;
final List<ItemAction> actions;
final Function(bool value)? onFocusChanged;
final bool isCurrentEpisode;
final Object? heroTag;
@ -145,6 +146,7 @@ class EpisodePoster extends ConsumerWidget {
this.onLongPress,
this.blur = false,
required this.actions,
this.onFocusChanged,
required this.isCurrentEpisode,
this.heroTag,
});
@ -167,6 +169,7 @@ class EpisodePoster extends ConsumerWidget {
child: FocusButton(
onTap: onTap,
onLongPress: onLongPress,
onFocusChanged: onFocusChanged,
onSecondaryTapDown: (details) async {
Offset localPosition = details.globalPosition;
RelativeRect position =