Initial commit: monorepo Match Live TV.
Rails API, app Flutter, infrastruttura Docker/MediaMTX, sito marketing e documentazione di deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
97
mobile/lib/features/matches/resume_session_sheet.dart
Normal file
97
mobile/lib/features/matches/resume_session_sheet.dart
Normal file
@@ -0,0 +1,97 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../../app/theme.dart';
|
||||
import '../../providers/session_provider.dart';
|
||||
import '../../shared/models/match.dart';
|
||||
|
||||
/// Azioni per riprendere una diretta interrotta (crash, chiusura app, ecc.).
|
||||
void showResumeSessionSheet(
|
||||
BuildContext context,
|
||||
WidgetRef ref, {
|
||||
required MatchModel match,
|
||||
}) {
|
||||
final sessionId = match.activeSessionId;
|
||||
if (sessionId == null) return;
|
||||
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
backgroundColor: AppTheme.surface,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
builder: (ctx) {
|
||||
return SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 16, 20, 12),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Diretta in corso',
|
||||
style: Theme.of(ctx).textTheme.titleLarge,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${match.teamName} vs ${match.opponentName}',
|
||||
style: Theme.of(ctx).textTheme.bodyMedium,
|
||||
),
|
||||
if (match.activeSessionStatus != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Stato: ${match.activeSessionStatus}',
|
||||
style: Theme.of(ctx).textTheme.labelLarge?.copyWith(
|
||||
color: AppTheme.primaryRed,
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 20),
|
||||
if (match.canResumeCamera)
|
||||
FilledButton.icon(
|
||||
onPressed: () {
|
||||
ref.read(sessionProvider.notifier).setDeviceRole(DeviceRole.camera);
|
||||
Navigator.pop(ctx);
|
||||
context.push('/session/$sessionId/camera');
|
||||
},
|
||||
icon: const Icon(Icons.videocam),
|
||||
label: const Text('Riprendi camera e trasmetti'),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: AppTheme.primaryRed,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
),
|
||||
),
|
||||
if (match.activeSessionStatus == 'idle') ...[
|
||||
const SizedBox(height: 8),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
Navigator.pop(ctx);
|
||||
context.push('/setup/${match.id}/1');
|
||||
},
|
||||
icon: const Icon(Icons.settings),
|
||||
label: const Text('Continua configurazione'),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
ref.read(sessionProvider.notifier).setDeviceRole(DeviceRole.controller);
|
||||
Navigator.pop(ctx);
|
||||
context.push('/session/$sessionId/controller');
|
||||
},
|
||||
icon: const Icon(Icons.sports_esports),
|
||||
label: const Text('Apri regia (punteggio)'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
child: const Text('Annulla'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user