v1.4.4+65
All checks were successful
Flutter Schmutter / build (push) Successful in 3m35s

This commit is contained in:
2025-06-22 03:02:18 +02:00
parent 7f0743808a
commit 95f6dcfe2b
13 changed files with 461 additions and 339 deletions

View File

@ -94,81 +94,99 @@ class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
),
),
),
_ControlButton(
widget.controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
() {
IconButton(
icon: Icon(
widget.controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
size: 64,
),
onPressed: () {
widget.onOverlayTap();
widget.controller.value.isPlaying
? widget.controller.pause()
: widget.controller.play();
},
size: 64,
),
Positioned(
right: 12,
bottom: 12,
child: _ControlButton(
widget.muted ? Icons.volume_off : Icons.volume_up,
() {
child: IconButton(
icon: Icon(
widget.muted ? Icons.volume_off : Icons.volume_up,
size: 16,
),
onPressed: () {
widget.onOverlayTap();
widget.onMuteToggle();
},
size: 16,
),
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.only(bottom: 0),
child: Stack(
clipBehavior: Clip.none,
children: [
Positioned(
left: 10,
bottom: 12,
child: Text(
'${_formatDuration(widget.controller.value.position)} / ${_formatDuration(widget.controller.value.duration)}',
style: const TextStyle(color: Colors.white, fontSize: 12),
),
),
Listener(
onPointerDown: (_) {
widget.onOverlayTap();
},
child: VideoProgressIndicator(
widget.controller,
allowScrubbing: true,
padding: const EdgeInsets.only(top: 25.0),
colors: const VideoProgressColors(
playedColor: Colors.red,
backgroundColor: Colors.grey,
bufferedColor: Colors.white54,
),
),
),
if (widget.controller.value.duration.inMilliseconds > 0)
Positioned(
left:
(widget.controller.value.position.inMilliseconds /
widget
.controller
.value
.duration
.inMilliseconds) *
MediaQuery.of(context).size.width -
6,
bottom: -4,
child: Container(
width: 12,
height: 12,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.red,
border: Border.all(color: Colors.red, width: 2),
child: LayoutBuilder(
builder: (context, constraints) {
return Stack(
clipBehavior: Clip.none,
children: [
Positioned(
left: 10,
bottom: 12,
child: Text(
'${_formatDuration(widget.controller.value.position)} / ${_formatDuration(widget.controller.value.duration)}',
style: const TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
],
Listener(
onPointerDown: (_) {
widget.onOverlayTap();
},
child: VideoProgressIndicator(
widget.controller,
allowScrubbing: true,
padding: const EdgeInsets.only(top: 25.0),
colors: VideoProgressColors(
playedColor: Theme.of(context).colorScheme.primary,
backgroundColor: Theme.of(
context,
).colorScheme.surface.withValues(alpha: 0.5),
bufferedColor: Theme.of(
context,
).colorScheme.secondary.withValues(alpha: 0.5),
),
),
),
if (widget.controller.value.duration.inMilliseconds > 0)
Positioned(
left:
(widget.controller.value.position.inMilliseconds /
widget
.controller
.value
.duration
.inMilliseconds) *
constraints.maxWidth -
6,
bottom: -4,
child: Container(
width: 12,
height: 12,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).colorScheme.primary,
border: Border.all(
color: Theme.of(context).colorScheme.primary,
width: 2,
),
),
),
),
],
);
},
),
),
),
@ -182,25 +200,3 @@ class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
return "${twoDigits(duration.inMinutes % 60)}:${twoDigits(duration.inSeconds % 60)}";
}
}
class _ControlButton extends StatelessWidget {
final IconData icon;
final VoidCallback onPressed;
final double size;
const _ControlButton(this.icon, this.onPressed, {this.size = 24});
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black.withValues(alpha: 0.4),
),
child: IconButton(
icon: Icon(icon, size: size),
onPressed: onPressed,
),
);
}
}