diff --git a/lib/screens/media_detail_screen.dart b/lib/screens/media_detail_screen.dart index c94db2f1..dc7d7819 100644 --- a/lib/screens/media_detail_screen.dart +++ b/lib/screens/media_detail_screen.dart @@ -1205,7 +1205,7 @@ class _MediaDetailScreenState extends State final isAlways = flattenSeasons == flattenSeasonsAlways; final isSingleSeason = flattenSeasons == flattenSeasonsSingleSeason; final shouldShowEpisodesDirectly = - isAlways || (isSingleSeason && seasonsWithServerId.length == 1); + isAlways || seasonsWithServerId.length <= 1 || (isSingleSeason && seasonsWithServerId.length == 1); // Create focus nodes for season tabs _updateSeasonTabFocusNodes(seasonsWithServerId.length); @@ -1460,6 +1460,12 @@ class _MediaDetailScreenState extends State return KeyEventResult.handled; } + if (_episodes.isNotEmpty) { + _firstEpisodeFocusNode.requestFocus(); + _scrollSectionIntoView(_seasonsSectionKey); + return KeyEventResult.handled; + } + if (metadata.role != null && metadata.role!.isNotEmpty) { _castFocusNode.requestFocus(); _scrollSectionIntoView(_castSectionKey); @@ -1504,6 +1510,9 @@ class _MediaDetailScreenState extends State if (metadata.isShow && !_showEpisodesDirectly && _seasons.isNotEmpty && _seasonTabFocusNodes.isNotEmpty) { _seasonTabFocusNodes[_selectedSeasonIndex].requestFocus(); _scrollSectionIntoView(_seasonsSectionKey); + } else if (_episodes.isNotEmpty) { + _firstEpisodeFocusNode.requestFocus(); + _scrollSectionIntoView(_seasonsSectionKey); } else if (metadata.role != null && metadata.role!.isNotEmpty) { _castFocusNode.requestFocus(); _scrollSectionIntoView(_castSectionKey); @@ -1798,7 +1807,20 @@ class _MediaDetailScreenState extends State : index == _episodes.length - 1 && _episodes.length > 1 ? _lastEpisodeFocusNode : null, - onNavigateUp: index == 0 ? _focusSelectedSeasonTab : null, + onNavigateUp: index == 0 + ? () { + if (!_showEpisodesDirectly) { + _focusSelectedSeasonTab(); + } else if ((_fullMetadata ?? widget.metadata).summary?.isNotEmpty == true) { + _overviewFocusNode.requestFocus(); + _scrollSectionIntoView(_overviewSectionKey); + } else { + _scrollController.animateTo(0, + duration: const Duration(milliseconds: 200), curve: Curves.easeOut); + _playButtonFocusNode.requestFocus(); + } + } + : null, localPosterPath: localPosterPath, onTap: () async { await navigateToVideoPlayerWithRefresh(