Files
ReelShort/lib/pages/player/widgets/player_center_toggle.dart
T

45 lines
1.0 KiB
Dart

// Author: fruit.com.cn
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({
super.key,
required this.playing,
required this.onTap,
});
final bool playing;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return Semantics(
button: true,
label: playing ? 'Pause' : 'Play',
child: GestureDetector(
onTap: onTap,
child: SizedBox(
width: _toggleSize,
height: _toggleSize,
child: Icon(
playing ? Icons.pause_rounded : Icons.play_arrow_rounded,
color: AppColors.onPrimary,
size: _iconSize,
shadows: _iconShadows,
),
),
),
);
}
}