This commit is contained in:
@ -1,17 +1,18 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cached_video_player_plus/cached_video_player_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/controller/settingscontroller.dart';
|
||||
|
||||
class VideoControlsOverlay extends StatefulWidget {
|
||||
final CachedVideoPlayerPlusController controller;
|
||||
final VoidCallback? onDoubleTap;
|
||||
|
||||
const VideoControlsOverlay({
|
||||
super.key,
|
||||
required this.controller,
|
||||
this.onDoubleTap,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -121,37 +122,37 @@ class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: _toggleControlsVisibility,
|
||||
onHorizontalDragStart: _controlsVisible ? _onHorizontalDragStart : null,
|
||||
onHorizontalDragUpdate: _controlsVisible ? _onHorizontalDragUpdate : null,
|
||||
onHorizontalDragEnd: _controlsVisible ? _onHorizontalDragEnd : null,
|
||||
onHorizontalDragCancel: _controlsVisible ? _onHorizontalDragCancel : null,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
color: _controlsVisible && !_isScrubbing
|
||||
? Colors.black.withValues(alpha: 0.5)
|
||||
: Colors.transparent,
|
||||
),
|
||||
AnimatedOpacity(
|
||||
opacity: _isScrubbing ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: _buildScrubbingIndicator(),
|
||||
),
|
||||
AnimatedOpacity(
|
||||
opacity: _controlsVisible && !_isScrubbing ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: _buildBottomBar(),
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: _toggleControlsVisibility,
|
||||
onHorizontalDragStart: _controlsVisible ? _onHorizontalDragStart : null,
|
||||
onHorizontalDragUpdate: _controlsVisible ? _onHorizontalDragUpdate : null,
|
||||
onHorizontalDragEnd: _controlsVisible ? _onHorizontalDragEnd : null,
|
||||
onHorizontalDragCancel: _controlsVisible ? _onHorizontalDragCancel : null,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
color: _controlsVisible && !_isScrubbing
|
||||
? Colors.black.withValues(alpha: 0.5)
|
||||
: Colors.transparent,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
AnimatedOpacity(
|
||||
opacity: _isScrubbing ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: _buildScrubbingIndicator(),
|
||||
),
|
||||
AnimatedOpacity(
|
||||
opacity: _controlsVisible && !_isScrubbing ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: _buildBottomBar(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -192,7 +193,7 @@ class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
|
||||
|
||||
Widget _buildBottomBar() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 5),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
@ -201,7 +202,7 @@ class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
|
||||
? Icons.pause
|
||||
: Icons.play_arrow,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 20,
|
||||
size: 24,
|
||||
),
|
||||
onPressed: _handlePlayPause,
|
||||
constraints: const BoxConstraints(),
|
||||
@ -243,7 +244,7 @@ class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
|
||||
? Icons.volume_off
|
||||
: Icons.volume_up,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 20,
|
||||
size: 24,
|
||||
),
|
||||
onPressed: () {
|
||||
_settingsController.toggleMuted();
|
||||
|
Reference in New Issue
Block a user