Semplifica condivisione link dopo test rete in app.
Mostra link diretta e regia solo a test completato; rimuove pulsante duplicato e nasconde «Avvia test rete». Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -36,6 +36,7 @@ class StepNetworkTest extends ConsumerStatefulWidget {
|
||||
|
||||
class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||
bool _testing = false;
|
||||
bool _testCompleted = false;
|
||||
bool _ready = false;
|
||||
double _downloadMbps = 0;
|
||||
double _uploadMbps = 0;
|
||||
@@ -79,6 +80,7 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_testing = false;
|
||||
_testCompleted = true;
|
||||
_downloadMbps = download;
|
||||
_uploadMbps = upload;
|
||||
_latencyMs = latency;
|
||||
@@ -139,6 +141,9 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final session = ref.watch(sessionProvider).session;
|
||||
final shareUrl = session != null ? watchShareUrl(session) : null;
|
||||
final shareTitle = 'Diretta — ${widget.match.teamName} vs ${widget.match.opponentName}';
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: ScreenInsets.contentPadding(context, horizontal: 20, vertical: 12),
|
||||
@@ -185,7 +190,7 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
if (_ready) ...[
|
||||
if (_testCompleted && _ready) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
@@ -201,86 +206,54 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
if (watchShareUrl(ref.read(sessionProvider).session!) != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.surfaceElevated,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
ref.read(sessionProvider).session!.platform == 'youtube'
|
||||
? 'Link video YouTube'
|
||||
: 'Link diretta Match Live TV',
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SelectableText(
|
||||
watchShareUrl(ref.read(sessionProvider).session!)!,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () => copyWatchLink(
|
||||
context,
|
||||
ref.read(sessionProvider).session!,
|
||||
),
|
||||
icon: const Icon(Icons.link, size: 18),
|
||||
label: const Text('COPIA'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () => shareWatchLink(
|
||||
context,
|
||||
session: ref.read(sessionProvider).session!,
|
||||
title:
|
||||
'Diretta — ${widget.match.teamName} vs ${widget.match.opponentName}',
|
||||
),
|
||||
icon: const Icon(Icons.share, size: 18),
|
||||
label: const Text('CONDIVIDI'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.surfaceElevated,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
'In caso di disconnessione, lo stream resta attivo con slate per massimo 5 minuti mentre il telefono riconnette.',
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
if (ref.read(sessionProvider).session != null) ...[
|
||||
OutlinedButton.icon(
|
||||
onPressed: () => shareWatchLink(
|
||||
context,
|
||||
session: ref.read(sessionProvider).session!,
|
||||
title: 'Diretta — ${widget.match.teamName} vs ${widget.match.opponentName}',
|
||||
if (_testCompleted && session != null && shareUrl != null) ...[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.surfaceElevated,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
icon: const Icon(Icons.live_tv),
|
||||
label: Text(
|
||||
ref.read(sessionProvider).session!.platform == 'youtube'
|
||||
? 'Condividi link YouTube'
|
||||
: 'Condividi link diretta',
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
session.platform == 'youtube'
|
||||
? 'Link video YouTube'
|
||||
: 'Link diretta Match Live TV',
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SelectableText(
|
||||
shareUrl,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () => copyWatchLink(context, session),
|
||||
icon: const Icon(Icons.link, size: 18),
|
||||
label: const Text('COPIA'),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () => shareWatchLink(
|
||||
context,
|
||||
session: session,
|
||||
title: shareTitle,
|
||||
),
|
||||
icon: const Icon(Icons.share, size: 18),
|
||||
label: const Text('CONDIVIDI'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -288,7 +261,7 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||
onPressed: () => shareRegiaLink(
|
||||
context,
|
||||
ref,
|
||||
sessionId: ref.read(sessionProvider).session!.id,
|
||||
sessionId: session.id,
|
||||
shareSubject:
|
||||
'Regia — ${widget.match.teamName} vs ${widget.match.opponentName}',
|
||||
),
|
||||
@@ -296,11 +269,27 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||
label: const Text('Condividi link regia (punteggio)'),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 24),
|
||||
OutlinedButton(
|
||||
onPressed: _testing ? null : _runTest,
|
||||
child: Text(_testing ? 'TEST IN CORSO...' : 'AVVIA TEST RETE'),
|
||||
),
|
||||
if (_testCompleted) ...[
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: AppTheme.surfaceElevated,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Text(
|
||||
'In caso di disconnessione, lo stream resta attivo con slate per massimo 5 minuti mentre il telefono riconnette.',
|
||||
style: theme.textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (!_testCompleted) ...[
|
||||
const SizedBox(height: 24),
|
||||
OutlinedButton(
|
||||
onPressed: _testing ? null : _runTest,
|
||||
child: Text(_testing ? 'TEST IN CORSO...' : 'AVVIA TEST RETE'),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 32),
|
||||
Row(
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user