feat(app): 播放器增加清晰度档位入口
This commit is contained in:
1 parent
30a5fa0776
commit
2b2b7e9913
9 files changed
+242
-1
No files matched your search
@@ -28,6 +28,7 @@ import 'player_logic.dart';
|
||||
import 'widgets/home_feed_overlay.dart';
|
||||
import 'widgets/exit_clear_screen_button.dart';
|
||||
import 'widgets/player_center_toggle.dart';
|
||||
import 'widgets/quality_sheet.dart';
|
||||
import 'widgets/player_featured_comment.dart';
|
||||
import 'widgets/seek_progress_bar.dart';
|
||||
import '../../core/data/repositories/watch_history_repository.dart';
|
||||
@@ -402,6 +403,8 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
playing: logic.session.userWantsPlay,
|
||||
playbackSpeed: _playbackSpeed,
|
||||
onSpeedTap: () => unawaited(_openSpeedSheet(context)),
|
||||
qualities: logic.qualities,
|
||||
onQualityTap: () => unawaited(_openQualitySheet(context)),
|
||||
controlsVisible: _chromeVisible,
|
||||
onClear: () => setState(() => _chromeVisible = false),
|
||||
onExitClear: () => setState(() => _chromeVisible = true),
|
||||
@@ -500,6 +503,15 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
await logic.setPlaybackSpeed(selected);
|
||||
}
|
||||
|
||||
Future<void> _openQualitySheet(BuildContext context) async {
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: AppColors.card,
|
||||
showDragHandle: true,
|
||||
builder: (_) => QualitySheet(qualities: logic.qualities),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _unlockEpisode(BuildContext context, int index) async {
|
||||
if (!await ensureSignedIn(context)) return;
|
||||
if (!context.mounted) return;
|
||||
@@ -693,6 +705,8 @@ class _PlaybackOverlay extends StatefulWidget {
|
||||
required this.playing,
|
||||
required this.playbackSpeed,
|
||||
required this.onSpeedTap,
|
||||
required this.qualities,
|
||||
required this.onQualityTap,
|
||||
required this.controlsVisible,
|
||||
required this.onTogglePlay,
|
||||
required this.onClear,
|
||||
@@ -720,6 +734,8 @@ class _PlaybackOverlay extends StatefulWidget {
|
||||
final bool playing;
|
||||
final double playbackSpeed;
|
||||
final VoidCallback onSpeedTap;
|
||||
final List<String> qualities;
|
||||
final VoidCallback onQualityTap;
|
||||
final bool controlsVisible;
|
||||
final VoidCallback onTogglePlay;
|
||||
final VoidCallback onClear;
|
||||
@@ -953,7 +969,29 @@ class _PlaybackOverlayState extends State<_PlaybackOverlay> {
|
||||
});
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
if (widget.qualities.isNotEmpty)
|
||||
ListTile(
|
||||
key: const Key('player-more-quality'),
|
||||
leading: const Icon(
|
||||
Icons.high_quality_rounded,
|
||||
color: AppColors.secondary,
|
||||
),
|
||||
title: Text(widget.l10n.playbackQuality),
|
||||
trailing: Text(
|
||||
widget.qualities.contains(QualitySheet.autoQuality)
|
||||
? widget.l10n.qualityAuto
|
||||
: widget.qualities.first,
|
||||
style: const TextStyle(
|
||||
color: AppColors.blue,
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(sheetContext);
|
||||
widget.onQualityTap();
|
||||
},
|
||||
), ListTile(
|
||||
key: const Key('player-more-download'),
|
||||
leading: const Icon(
|
||||
Icons.download_outlined,
|
||||
|
||||
Reference in new issue
Block a user