fix: 使用点击序号防止双击误暂停
This commit is contained in:
1 parent
9ddd7fc833
commit
bbc759473c
7 files changed
+113
-61
No files matched your search
@@ -17,13 +17,11 @@ class PlayerVideoSurface extends StatefulWidget {
|
||||
required this.controller,
|
||||
required this.videoUrl,
|
||||
required this.theater,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final VideoPlayerController? controller;
|
||||
final String videoUrl;
|
||||
final bool theater;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
State<PlayerVideoSurface> createState() => _PlayerVideoSurfaceState();
|
||||
@@ -69,7 +67,6 @@ class _PlayerVideoSurfaceState extends State<PlayerVideoSurface> {
|
||||
controller: controller,
|
||||
value: value!,
|
||||
theater: widget.theater,
|
||||
onTap: widget.onTap,
|
||||
)
|
||||
: const SizedBox.expand(),
|
||||
),
|
||||
@@ -141,17 +138,15 @@ class _VideoLayer extends StatelessWidget {
|
||||
required this.controller,
|
||||
required this.value,
|
||||
required this.theater,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final VideoPlayerController controller;
|
||||
final VideoPlayerValue value;
|
||||
final bool theater;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final child = FittedBox(
|
||||
return FittedBox(
|
||||
fit: theater ? BoxFit.contain : BoxFit.cover,
|
||||
child: SizedBox(
|
||||
width: value.size.width,
|
||||
@@ -159,12 +154,5 @@ class _VideoLayer extends StatelessWidget {
|
||||
child: VideoPlayer(controller, key: ValueKey(controller)),
|
||||
),
|
||||
);
|
||||
final tap = onTap;
|
||||
if (tap == null) return child;
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: tap,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user