style(recommend): 收窄观看全集按钮

This commit is contained in:
Zhou Weidong committed 2026-10-22 20:16:13 +08:00
1 parent 3690fb1bc4
commit 5abee5f69a
3 files changed
+45 -29

No files matched your search

+1 -1
View File
@@ -1186,4 +1186,4 @@ $ flutter test
- 拖动仅控制视频浮层内容,顶部导航与根底栏保持常驻。
- 进度条固定中心并动画到 6 高,时间气泡限制在左右 12;end/cancel/pointer 兜底均恢复拖动前状态。
- 修复 `scrubCancelRequest` 误置于 `initState` 的编译错误,并清理推荐页未使用变量;`flutter analyze` 无问题。
- 观看全集按钮相对进度条上移 8,间距调整为 20;`flutter analyze` 无问题。
- 观看全集按钮相对进度条上移 8,间距调整为 20;按钮改为屏幕宽度 70% 左对齐,`flutter analyze` 无问题。
@@ -1,5 +1,7 @@
// Author: fruit.com.cn
import 'dart:math' as math;
import 'package:flutter/material.dart';
import '../../../core/data/models/drama.dart';
@@ -106,7 +108,7 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
_synopsis(l10n, synopsis),
],
const SizedBox(height: 12),
_watchAll(l10n),
_watchAll(context, l10n),
],
);
}
@@ -245,37 +247,46 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
);
}
Widget _watchAll(AppLocalizations l10n) {
return SizedBox(
width: double.infinity,
height: _watchAllHeight,
child: DecoratedBox(
key: const Key('home-feed-full-series-bg'),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [AppColors.actionRed, AppColors.blue],
),
borderRadius: BorderRadius.circular(8),
),
child: Material(
color: AppColors.transparent,
child: InkWell(
key: const Key('home-feed-full-series'),
onTap: widget.onOpenFullPlayer,
borderRadius: BorderRadius.circular(8),
child: Center(
child: Text(
l10n.homeWatchAll,
style: const TextStyle(
color: AppColors.textPrimary,
fontSize: 15,
fontWeight: FontWeight.w600,
Widget _watchAll(BuildContext context, AppLocalizations l10n) {
final screenWidth = MediaQuery.sizeOf(context).width;
return LayoutBuilder(
builder: (context, constraints) {
final buttonWidth = math.min(screenWidth * 0.7, constraints.maxWidth);
return Align(
alignment: Alignment.centerLeft,
child: SizedBox(
width: buttonWidth,
height: _watchAllHeight,
child: DecoratedBox(
key: const Key('home-feed-full-series-bg'),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [AppColors.actionRed, AppColors.blue],
),
borderRadius: BorderRadius.circular(8),
),
child: Material(
color: AppColors.transparent,
child: InkWell(
key: const Key('home-feed-full-series'),
onTap: widget.onOpenFullPlayer,
borderRadius: BorderRadius.circular(8),
child: Center(
child: Text(
l10n.homeWatchAll,
style: const TextStyle(
color: AppColors.textPrimary,
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
),
),
),
),
),
),
),
);
},
);
}
+5
View File
@@ -659,6 +659,11 @@ void main() {
final bar = tester.getRect(find.byKey(const Key('home-feed-full-series')));
expect(bar.height, 44);
final overlayRect = tester.getRect(
find.byKey(const Key('home-feed-gesture')),
);
expect(bar.left, closeTo(overlayRect.left + 14, 0.1));
expect(bar.width, closeTo(overlayRect.width * 0.7, 1));
final buttonBackground =
tester
.widget<DecoratedBox>(