fix(player): 修复清晰度切换闪屏与还原黑屏

This commit is contained in:
Vicky authored and trae-solo-agent committed 2026-10-28 16:36:55 +08:00
1 parent 43e60e29ec
commit 85dedf20fa
8 files changed
+249 -296

No files matched your search

@@ -10,9 +10,9 @@ import '../../../l10n/app_localizations.dart';
import '../../home/widgets/home_drama_classification.dart';
import 'interaction_rail.dart';
const double _seriesFont = 21;
const double _tagFont = 14;
const double _synopsisFont = 15;
const double _seriesFont = 17;
const double _tagFont = 12;
const double _synopsisFont = 14;
const double _watchAllHeight = 44;
const List<Shadow> _textShadows = [
Shadow(color: AppColors.shadow, blurRadius: 6, offset: Offset(0, 1)),
@@ -90,7 +90,7 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
style: const TextStyle(
color: AppColors.textPrimary,
fontSize: _seriesFont,
fontWeight: FontWeight.w700,
fontWeight: FontWeight.w400,
shadows: _textShadows,
),
),
@@ -98,7 +98,7 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
const SizedBox(width: 2),
const Icon(
Icons.chevron_right_rounded,
size: 20,
size: 18,
color: AppColors.textPrimary,
),
],
@@ -127,13 +127,13 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
];
return SizedBox(
key: const Key('home-feed-tags'),
height: 25,
height: 22,
child: ListView.separated(
scrollDirection: Axis.horizontal,
physics: const NeverScrollableScrollPhysics(),
physics: const BouncingScrollPhysics(),
shrinkWrap: true,
itemCount: chips.length,
separatorBuilder: (_, _) => const SizedBox(width: 8),
separatorBuilder: (_, _) => const SizedBox(width: 6),
itemBuilder: (_, index) => chips[index],
),
);
@@ -151,7 +151,15 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
children: [
TextSpan(
text: prefix,
style: baseStyle.copyWith(fontWeight: FontWeight.w600),
style: baseStyle,
),
TextSpan(
text: ' | ',
style: baseStyle.copyWith(
color: AppColors.textPrimary.withValues(alpha: 0.45),
fontSize: _synopsisFont - 2,
fontWeight: FontWeight.w400,
),
),
TextSpan(text: synopsis, style: baseStyle),
],
@@ -164,6 +172,7 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
final toggle = _synopsisToggle(
key: const Key('home-feed-synopsis-more'),
label: l10n.expandSynopsis,
padding: const EdgeInsets.only(left: 6),
);
final painter = TextPainter(
text: span,
@@ -180,21 +189,28 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
);
}
// 设计稿:单行省略号 + 行内固定「展开」。
return Row(
key: const Key('home-feed-synopsis-collapsed'),
children: [
Expanded(
child: Text.rich(
span,
key: const Key('home-feed-synopsis'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: baseStyle,
// 整行可点:真机上不必精确命中两个小字,点简介任意位置都能展开。
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () => setState(() => _synopsisExpanded = true),
child: Row(
key: const Key('home-feed-synopsis-collapsed'),
// 顶对齐:文字位置不变,toggle 的 bottom 留白把触控区向下扩到空白处。
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text.rich(
span,
key: const Key('home-feed-synopsis'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: baseStyle,
),
),
),
const SizedBox(width: 2),
toggle,
],
const SizedBox(width: 2),
toggle,
],
),
);
},
);
@@ -205,38 +221,50 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
TextStyle style,
AppLocalizations l10n,
) {
return Column(
key: const Key('home-feed-synopsis-expanded'),
crossAxisAlignment: CrossAxisAlignment.start,
// 「收起」内联在简介最后一行末尾,避免独占一行导致多行简介与进度条间
// 出现大片空白;垂直方向只留少量触控留白(仅撑高最后一行)。
final expandedSpan = TextSpan(
style: style,
children: [
Text.rich(
span,
key: const Key('home-feed-synopsis'),
style: style,
),
const SizedBox(height: 2),
Align(
alignment: Alignment.centerRight,
span,
WidgetSpan(
alignment: PlaceholderAlignment.baseline,
baseline: TextBaseline.alphabetic,
child: _synopsisToggle(
key: const Key('home-feed-synopsis-more'),
label: l10n.showLess,
padding: const EdgeInsets.only(left: 8),
),
),
],
);
return Text.rich(
expandedSpan,
key: const Key('home-feed-synopsis-expanded'),
);
}
Widget _synopsisToggle({required Key key, required String label}) {
Widget _synopsisToggle({
required Key key,
required String label,
required EdgeInsets padding,
}) {
return GestureDetector(
key: key,
// opaque + 留白扩大命中区;留白方向由调用方决定,
// 展开态不能加 top padding,否则「收起」距简介正文过远。
behavior: HitTestBehavior.opaque,
onTap: () => setState(() => _synopsisExpanded = !_synopsisExpanded),
child: Text(
label,
style: const TextStyle(
color: AppColors.textPrimary,
fontSize: _synopsisFont,
fontWeight: FontWeight.w600,
shadows: _textShadows,
child: Padding(
padding: padding,
child: Text(
label,
style: const TextStyle(
color: AppColors.textPrimary,
fontSize: _synopsisFont,
fontWeight: FontWeight.w600,
shadows: _textShadows,
),
),
),
);
@@ -317,7 +345,7 @@ class _TagChip extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 2),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
alignment: Alignment.center,
decoration: BoxDecoration(
color: filled
@@ -426,11 +454,11 @@ class HomeFeedActionRail extends StatelessWidget {
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return InteractionRail(
itemGap: 18,
itemGap: 12,
buttonSize: 48,
iconSize: 36,
countFontSize: 15,
iconCountGap: 6,
iconCountGap: 2,
items: [
InteractionRailItem(
key: const Key('rail-save'),
@@ -462,8 +490,7 @@ class HomeFeedActionRail extends StatelessWidget {
),
InteractionRailItem(
key: const Key('rail-share'),
icon: Icons.reply_rounded,
mirrorIcon: true,
asset: 'assets/icon/rail/rail_share.png',
label: l10n.share,
countKey: const Key('rail-share-label'),
onTap: onShare,