fix(player): 增加退出清屏浮动按钮
This commit is contained in:
1 parent
3fcfd68660
commit
e2e809e2d5
10 files changed
+111
-5
No files matched your search
@@ -24,6 +24,7 @@ import '../../l10n/app_localizations.dart';
|
||||
import 'player_binding.dart';
|
||||
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/player_featured_comment.dart';
|
||||
import 'widgets/seek_progress_bar.dart';
|
||||
@@ -213,9 +214,8 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
child: GestureDetector(
|
||||
key: const Key('home-feed-video-toggle'),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => logic.session.setUserWantsPlay(
|
||||
!logic.session.userWantsPlay,
|
||||
),
|
||||
onTap: () =>
|
||||
logic.session.setUserWantsPlay(!logic.session.userWantsPlay),
|
||||
),
|
||||
),
|
||||
if (widget.homeMode &&
|
||||
@@ -447,6 +447,16 @@ class _PlayerPageState extends State<PlayerPage> with WidgetsBindingObserver {
|
||||
onTap: () => setState(() => _feedChromeVisible = true),
|
||||
),
|
||||
),
|
||||
if (widget.homeMode && !_feedChromeVisible)
|
||||
Positioned(
|
||||
top: 8,
|
||||
right: 12,
|
||||
child: ExitClearScreenButton(
|
||||
key: const Key('home-feed-exit-clear-screen'),
|
||||
tooltip: l10n.exitClearScreen,
|
||||
onPressed: () => setState(() => _feedChromeVisible = true),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -762,6 +772,16 @@ class _PlaybackOverlayState extends State<_PlaybackOverlay> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!_controlsVisible)
|
||||
Positioned(
|
||||
top: 8,
|
||||
right: 12,
|
||||
child: ExitClearScreenButton(
|
||||
key: const Key('player-exit-clear-screen'),
|
||||
tooltip: widget.l10n.exitClearScreen,
|
||||
onPressed: () => setState(() => _controlsVisible = true),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Shared floating action used to leave clear-screen mode.
|
||||
class ExitClearScreenButton extends StatelessWidget {
|
||||
const ExitClearScreenButton({
|
||||
super.key,
|
||||
required this.tooltip,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
final String tooltip;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 36,
|
||||
height: 36,
|
||||
child: IconButton(
|
||||
tooltip: tooltip,
|
||||
onPressed: onPressed,
|
||||
padding: EdgeInsets.zero,
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor: const Color(0x80000000),
|
||||
foregroundColor: Colors.white,
|
||||
shape: const CircleBorder(),
|
||||
),
|
||||
icon: const Icon(Icons.fullscreen_exit_rounded, size: 18),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user