50 lines
1.2 KiB
Dart
50 lines
1.2 KiB
Dart
// Author: fruit.com.cn
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../../core/theme/app_colors.dart';
|
|
|
|
const double _toggleSize = 68;
|
|
const double _iconSize = 36;
|
|
const Color _toggleBackground = Colors.black26;
|
|
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: Container(
|
|
width: _toggleSize,
|
|
height: _toggleSize,
|
|
decoration: const BoxDecoration(
|
|
color: _toggleBackground,
|
|
shape: BoxShape.circle,
|
|
),
|
|
child: Icon(
|
|
playing ? Icons.pause_rounded : Icons.play_arrow_rounded,
|
|
color: AppColors.onPrimary,
|
|
size: _iconSize,
|
|
shadows: _iconShadows,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|