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> {
|
class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
||||||
bool _testing = false;
|
bool _testing = false;
|
||||||
|
bool _testCompleted = false;
|
||||||
bool _ready = false;
|
bool _ready = false;
|
||||||
double _downloadMbps = 0;
|
double _downloadMbps = 0;
|
||||||
double _uploadMbps = 0;
|
double _uploadMbps = 0;
|
||||||
@@ -79,6 +80,7 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_testing = false;
|
_testing = false;
|
||||||
|
_testCompleted = true;
|
||||||
_downloadMbps = download;
|
_downloadMbps = download;
|
||||||
_uploadMbps = upload;
|
_uploadMbps = upload;
|
||||||
_latencyMs = latency;
|
_latencyMs = latency;
|
||||||
@@ -139,6 +141,9 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(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(
|
return SingleChildScrollView(
|
||||||
padding: ScreenInsets.contentPadding(context, horizontal: 20, vertical: 12),
|
padding: ScreenInsets.contentPadding(context, horizontal: 20, vertical: 12),
|
||||||
@@ -185,7 +190,7 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
if (_ready) ...[
|
if (_testCompleted && _ready) ...[
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(14),
|
padding: const EdgeInsets.all(14),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -201,8 +206,9 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (watchShareUrl(ref.read(sessionProvider).session!) != null) ...[
|
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
],
|
||||||
|
if (_testCompleted && session != null && shareUrl != null) ...[
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(14),
|
padding: const EdgeInsets.all(14),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@@ -213,14 +219,14 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
ref.read(sessionProvider).session!.platform == 'youtube'
|
session.platform == 'youtube'
|
||||||
? 'Link video YouTube'
|
? 'Link video YouTube'
|
||||||
: 'Link diretta Match Live TV',
|
: 'Link diretta Match Live TV',
|
||||||
style: theme.textTheme.titleSmall,
|
style: theme.textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
watchShareUrl(ref.read(sessionProvider).session!)!,
|
shareUrl,
|
||||||
style: theme.textTheme.bodySmall,
|
style: theme.textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
@@ -228,10 +234,7 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: OutlinedButton.icon(
|
child: OutlinedButton.icon(
|
||||||
onPressed: () => copyWatchLink(
|
onPressed: () => copyWatchLink(context, session),
|
||||||
context,
|
|
||||||
ref.read(sessionProvider).session!,
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.link, size: 18),
|
icon: const Icon(Icons.link, size: 18),
|
||||||
label: const Text('COPIA'),
|
label: const Text('COPIA'),
|
||||||
),
|
),
|
||||||
@@ -241,9 +244,8 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
child: OutlinedButton.icon(
|
child: OutlinedButton.icon(
|
||||||
onPressed: () => shareWatchLink(
|
onPressed: () => shareWatchLink(
|
||||||
context,
|
context,
|
||||||
session: ref.read(sessionProvider).session!,
|
session: session,
|
||||||
title:
|
title: shareTitle,
|
||||||
'Diretta — ${widget.match.teamName} vs ${widget.match.opponentName}',
|
|
||||||
),
|
),
|
||||||
icon: const Icon(Icons.share, size: 18),
|
icon: const Icon(Icons.share, size: 18),
|
||||||
label: const Text('CONDIVIDI'),
|
label: const Text('CONDIVIDI'),
|
||||||
@@ -254,8 +256,20 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
OutlinedButton.icon(
|
||||||
|
onPressed: () => shareRegiaLink(
|
||||||
|
context,
|
||||||
|
ref,
|
||||||
|
sessionId: session.id,
|
||||||
|
shareSubject:
|
||||||
|
'Regia — ${widget.match.teamName} vs ${widget.match.opponentName}',
|
||||||
|
),
|
||||||
|
icon: const Icon(Icons.scoreboard),
|
||||||
|
label: const Text('Condividi link regia (punteggio)'),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
],
|
if (_testCompleted) ...[
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.all(14),
|
padding: const EdgeInsets.all(14),
|
||||||
@@ -268,39 +282,14 @@ class _StepNetworkTestState extends ConsumerState<StepNetworkTest> {
|
|||||||
style: theme.textTheme.bodyMedium,
|
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}',
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.live_tv),
|
|
||||||
label: Text(
|
|
||||||
ref.read(sessionProvider).session!.platform == 'youtube'
|
|
||||||
? 'Condividi link YouTube'
|
|
||||||
: 'Condividi link diretta',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
OutlinedButton.icon(
|
|
||||||
onPressed: () => shareRegiaLink(
|
|
||||||
context,
|
|
||||||
ref,
|
|
||||||
sessionId: ref.read(sessionProvider).session!.id,
|
|
||||||
shareSubject:
|
|
||||||
'Regia — ${widget.match.teamName} vs ${widget.match.opponentName}',
|
|
||||||
),
|
|
||||||
icon: const Icon(Icons.scoreboard),
|
|
||||||
label: const Text('Condividi link regia (punteggio)'),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
|
if (!_testCompleted) ...[
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
onPressed: _testing ? null : _runTest,
|
onPressed: _testing ? null : _runTest,
|
||||||
child: Text(_testing ? 'TEST IN CORSO...' : 'AVVIA TEST RETE'),
|
child: Text(_testing ? 'TEST IN CORSO...' : 'AVVIA TEST RETE'),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user