df
This commit is contained in:
38
.gitea/workflows/deploy.yml
Normal file
38
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,38 @@
|
||||
name: Deploy to Cloudflare Pages
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main # O il nome del tuo branch principale
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest # O il runner configurato sul tuo Gitea
|
||||
steps:
|
||||
- name: Checkout del codice
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: 'stable'
|
||||
|
||||
- name: Crea il file .env per flutter_dotenv
|
||||
run: |
|
||||
echo "SUPABASE_URL=${{ secrets.SUPABASE_URL }}" >> .env
|
||||
echo "SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}" >> .env
|
||||
|
||||
- name: Ottieni le dipendenze
|
||||
run: flutter pub get
|
||||
|
||||
- name: Compila per il Web
|
||||
run: flutter build web --release
|
||||
|
||||
- name: Crea file _redirects per Cloudflare
|
||||
run: echo "/* /index.html 200" > build/web/_redirects
|
||||
|
||||
- name: Deploy su Cloudflare Pages
|
||||
env:
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
# QUESTA È LA RIGA MAGICA: Gli diciamo di prendere SOLO la cartella build/web
|
||||
run: npx wrangler@latest pages deploy build/web --project-name Flux --branch main
|
||||
@@ -7,6 +7,7 @@ import 'package:flux/core/layout/app_shell.dart';
|
||||
import 'package:flux/core/utils/extensions.dart';
|
||||
import 'package:flux/core/widgets/set_password_screen.dart';
|
||||
import 'package:flux/core/widgets/shared_forms/mobile_upload_screen.dart';
|
||||
import 'package:flux/core/widgets/shared_forms/upload_success_screen.dart';
|
||||
import 'package:flux/features/auth/ui/auth_screen.dart';
|
||||
import 'package:flux/features/customers/blocs/customers_cubit.dart';
|
||||
import 'package:flux/features/customers/models/customer_model.dart';
|
||||
@@ -195,6 +196,10 @@ class AppRouter {
|
||||
);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/upload-success',
|
||||
builder: (context, state) => const UploadSuccessScreen(),
|
||||
),
|
||||
GoRoute(
|
||||
path: '/customer/:id',
|
||||
builder: (context, state) {
|
||||
|
||||
@@ -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) {
|
||||
// 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("Tutti i file caricati con successo! ✅"),
|
||||
),
|
||||
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);
|
||||
|
||||
52
lib/core/widgets/shared_forms/upload_success_screen.dart
Normal file
52
lib/core/widgets/shared_forms/upload_success_screen.dart
Normal 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
web/_redirects
Normal file
1
web/_redirects
Normal file
@@ -0,0 +1 @@
|
||||
/* /index.html 200
|
||||
Reference in New Issue
Block a user