fix(recommend): 修正标题与观看全集跳转
This commit is contained in:
1 parent
23799353b5
commit
357492acb2
6 files changed
+82
-52
No files matched your search
@@ -50,38 +50,44 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final dramaTitle = localizedDramaTitle(l10n, widget.drama);
|
||||
final episodeTitle = widget.episode.title.trim();
|
||||
final headline = episodeTitle.isEmpty ? dramaTitle : episodeTitle;
|
||||
final headline = _headline(l10n, dramaTitle, episodeTitle);
|
||||
final synopsis = localizedDramaSynopsis(l10n, widget.drama).trim();
|
||||
final genres = _genreValues();
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
headline,
|
||||
key: const Key('home-feed-title'),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: _headlineFont,
|
||||
fontWeight: FontWeight.w700,
|
||||
height: 1.2,
|
||||
letterSpacing: 0,
|
||||
shadows: _textShadows,
|
||||
GestureDetector(
|
||||
key: const Key('home-feed-title-open'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: widget.onOpenFullPlayer,
|
||||
child: Text(
|
||||
headline,
|
||||
key: const Key('home-feed-title'),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: AppColors.textPrimary,
|
||||
fontSize: _headlineFont,
|
||||
fontWeight: FontWeight.w700,
|
||||
height: 1.2,
|
||||
letterSpacing: 0,
|
||||
shadows: _textShadows,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
GestureDetector(
|
||||
key: const Key('home-feed-series-name'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: widget.onDetail,
|
||||
onTap: widget.onOpenFullPlayer,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
dramaTitle,
|
||||
key: const Key('home-feed-series-title'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
@@ -113,6 +119,23 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
|
||||
);
|
||||
}
|
||||
|
||||
String _headline(
|
||||
AppLocalizations l10n,
|
||||
String dramaTitle,
|
||||
String episodeTitle,
|
||||
) {
|
||||
if (episodeTitle.isEmpty) return dramaTitle;
|
||||
final normalized = episodeTitle.toLowerCase().replaceAll(' ', '');
|
||||
final localizedEpisode = l10n
|
||||
.episodeLabel(widget.episode.number)
|
||||
.toLowerCase()
|
||||
.replaceAll(' ', '');
|
||||
final episodeOnly = RegExp(r'^(第?\d+集|episode\d+)$').hasMatch(normalized);
|
||||
return normalized == localizedEpisode || episodeOnly
|
||||
? dramaTitle
|
||||
: episodeTitle;
|
||||
}
|
||||
|
||||
Widget _tagMetaRow(AppLocalizations l10n, List<String> genres) {
|
||||
return Row(
|
||||
key: const Key('home-feed-tags'),
|
||||
|
||||
@@ -171,11 +171,12 @@ class _SeekProgressBarState extends State<SeekProgressBar> {
|
||||
}
|
||||
|
||||
Future<void> _finish(double fraction, Duration duration) async {
|
||||
if (widget.locked || !_dragging) return;
|
||||
final startedAt = _dragStartFraction;
|
||||
_dragStartFraction = null;
|
||||
if (widget.locked || !_dragging || startedAt == null) return;
|
||||
setState(() => _dragging = false);
|
||||
_pointerMoved = false;
|
||||
_pointerStart = null;
|
||||
_dragStartFraction = null;
|
||||
widget.thumbnailService?.cancelPending();
|
||||
_previewFraction.value = null;
|
||||
widget.onScrubEnd?.call();
|
||||
|
||||
@@ -6,15 +6,12 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../core/data/models/drama.dart';
|
||||
import '../../core/data/services/catalog_controller.dart';
|
||||
import '../../core/data/services/category_controller.dart';
|
||||
import '../../core/data/services/download_controller.dart';
|
||||
import '../../core/data/services/home_feed_controller.dart';
|
||||
import '../../core/data/services/wallet_controller.dart';
|
||||
import '../../core/navigation/fade_page_route.dart';
|
||||
import '../../core/theme/app_colors.dart';
|
||||
import '../../core/widgets/empty_state.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../player/open_player.dart';
|
||||
import '../player/player_view.dart';
|
||||
import 'recommend_types.dart';
|
||||
import 'widgets/all_dramas_filter_grid.dart';
|
||||
@@ -187,30 +184,6 @@ class _RecommendPageState extends State<RecommendPage> {
|
||||
}
|
||||
|
||||
Future<void> _openDrama(Drama drama, {String? episodeId}) async {
|
||||
final catalog = context.read<CatalogController>();
|
||||
final wallet = context.read<WalletController>();
|
||||
final downloads = context.read<DownloadController>();
|
||||
var playable = drama;
|
||||
try {
|
||||
playable = await catalog.requireDetail(drama);
|
||||
} catch (_) {
|
||||
// 卡片预览仍可直接进入播放器。
|
||||
}
|
||||
if (!mounted) return;
|
||||
final episodeIndex = episodeId == null
|
||||
? 0
|
||||
: playable.episodes.indexWhere((episode) => episode.id == episodeId);
|
||||
await Navigator.of(context).push<void>(
|
||||
FadePageRoute(
|
||||
builder: (_) => PlayerPage(
|
||||
drama: playable,
|
||||
initialIndex: episodeIndex < 0 ? 0 : episodeIndex,
|
||||
homeMode: true,
|
||||
feedDramas: [playable],
|
||||
wallet: wallet,
|
||||
downloads: downloads,
|
||||
),
|
||||
),
|
||||
);
|
||||
await playDramaFromCatalog(context, drama, episodeId: episodeId);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user