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