Metti in pausa ferma RTMP lato app mantenendo la camera aperta, MediaMTX manda offline.mp4 agli spettatori e Chiudi termina definitivamente. Co-authored-by: Cursor <cursoragent@cursor.com>
67 lines
1.8 KiB
Dart
67 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../app/theme.dart';
|
|
|
|
/// Pill rossa con dot pulsante e timer diretta.
|
|
class LiveBadge extends StatelessWidget {
|
|
const LiveBadge({
|
|
super.key,
|
|
required this.elapsed,
|
|
this.compact = false,
|
|
this.paused = false,
|
|
});
|
|
|
|
final Duration elapsed;
|
|
final bool compact;
|
|
final bool paused;
|
|
|
|
String _format(Duration d) {
|
|
final h = d.inHours;
|
|
final m = d.inMinutes.remainder(60).toString().padLeft(2, '0');
|
|
final s = d.inSeconds.remainder(60).toString().padLeft(2, '0');
|
|
if (h > 0) return '$h:$m:$s';
|
|
return '$m:$s';
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
final bg = paused ? const Color(0xFF555555) : AppTheme.primaryRed;
|
|
final label = paused
|
|
? (compact ? 'PAUSA ${_format(elapsed)}' : 'IN PAUSA ${_format(elapsed)}')
|
|
: (compact ? 'LIVE ${_format(elapsed)}' : 'IN DIRETTA ${_format(elapsed)}');
|
|
return Container(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: compact ? 10 : 14,
|
|
vertical: compact ? 4 : 6,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: bg,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
if (!paused)
|
|
Container(
|
|
width: compact ? 6 : 8,
|
|
height: compact ? 6 : 8,
|
|
decoration: const BoxDecoration(
|
|
color: Colors.white,
|
|
shape: BoxShape.circle,
|
|
),
|
|
),
|
|
if (!paused) SizedBox(width: compact ? 6 : 8),
|
|
Text(
|
|
label,
|
|
style: theme.textTheme.labelLarge?.copyWith(
|
|
color: Colors.white,
|
|
fontSize: compact ? 11 : 13,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|