This commit is contained in:
2026-05-07 16:26:50 +02:00
parent 0af51aae10
commit 6b038a94e2
5 changed files with 110 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flux/features/attachments/blocs/attachments_bloc.dart';
@@ -34,12 +35,19 @@ class _SharedMobileUploadScreenState extends State<SharedMobileUploadScreen> {
listener: (context, state) {
// Quando il BLoC ci dice che ha finito l'upload (Success), chiudiamo la pagina!
if (state.status == AttachmentsStatus.success && _isUploading) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text("Tutti i file caricati con successo! ✅"),
),
);
Navigator.of(context).pop();
// CONTROLLO MAGICO: C'è una pagina dietro di noi?
if (Navigator.of(context).canPop()) {
// Modalità "App Nativa": siamo entrati dal tasto "Aggiungi"
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text("File caricati con successo! ✅")),
);
Navigator.of(context).pop();
} else {
// Modalità "Web/QR Code": Navighiamo alla pagina di successo!
// Assicurati di aver importato go_router in questo file
context.go('/upload-success');
}
}
if (state.status == AttachmentsStatus.failure) {
setState(() => _isUploading = false);

View File

@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
class UploadSuccessScreen extends StatelessWidget {
const UploadSuccessScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.green.shade50,
body: Center(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.green.withValues(alpha: 0.3),
blurRadius: 20,
spreadRadius: 5,
),
],
),
child: const Icon(Icons.check, size: 80, color: Colors.white),
),
const SizedBox(height: 32),
const Text(
"Upload Completato!",
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.green,
),
),
const SizedBox(height: 16),
const Text(
"I file sono stati caricati con successo sulla pratica.\nPuoi chiudere questa pagina o finestra del browser.",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, color: Colors.black54),
),
],
),
),
),
);
}
}