fix(flutter): 放大透明播放按钮

This commit is contained in:
Zhou Weidong committed 2026-10-20 12:27:13 +08:00
1 parent 02763c3dfb
commit 8013cc18ad
2 files changed
+17 -6

No files matched your search

@@ -4,6 +4,12 @@ import 'package:flutter/material.dart';
import '../../../core/theme/app_colors.dart';
const double _toggleSize = 72;
const double _iconSize = 40;
const List<Shadow> _iconShadows = [
Shadow(color: Colors.black54, blurRadius: 12),
];
/// 首页沉浸流与全屏播放器共用的播放/暂停按钮。
class PlayerCenterToggle extends StatelessWidget {
const PlayerCenterToggle({
@@ -23,12 +29,13 @@ class PlayerCenterToggle extends StatelessWidget {
child: GestureDetector(
onTap: onTap,
child: SizedBox(
width: 52,
height: 52,
width: _toggleSize,
height: _toggleSize,
child: Icon(
playing ? Icons.pause_rounded : Icons.play_arrow_rounded,
color: AppColors.onPrimary,
size: 26,
size: _iconSize,
shadows: _iconShadows,
),
),
),
+7 -3
View File
@@ -6,7 +6,9 @@ import 'package:fruitshorts/core/theme/app_colors.dart';
import 'package:fruitshorts/pages/player/widgets/player_center_toggle.dart';
void main() {
testWidgets('should_use_one_shared_52px_center_toggle_style', (tester) async {
testWidgets('should_use_one_shared_72px_transparent_toggle_style', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
@@ -32,7 +34,7 @@ void main() {
Key('test-center-toggle-a'),
Key('player-play-toggle'),
]) {
expect(tester.getSize(find.byKey(key)), const Size(52, 52));
expect(tester.getSize(find.byKey(key)), const Size(72, 72));
// 暂停按钮改为透明背景,容器已不再绘制任何底色或装饰。
expect(
find.descendant(of: find.byKey(key), matching: find.byType(Container)),
@@ -41,8 +43,10 @@ void main() {
final icon = tester.widget<Icon>(
find.descendant(of: find.byKey(key), matching: find.byType(Icon)),
);
expect(icon.size, 26);
expect(icon.size, 40);
expect(icon.color, AppColors.onPrimary);
expect(icon.shadows, isNotNull);
expect(icon.shadows, isNotEmpty);
}
});
}