feat: Version 3.5.2 - Configuration Stripe et gestion des immeubles
- Configuration complète Stripe pour les 3 environnements (DEV/REC/PROD) * DEV: Clés TEST Pierre (mode test) * REC: Clés TEST Client (mode test) * PROD: Clés LIVE Client (mode live) - Ajout de la gestion des bases de données immeubles/bâtiments * Configuration buildings_database pour DEV/REC/PROD * Service BuildingService pour enrichissement des adresses - Optimisations pages et améliorations ergonomie - Mises à jour des dépendances Composer - Nettoyage des fichiers obsolètes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'dart:math' as math;
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb, kDebugMode, debugPrint;
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:geosector_app/core/services/js_stub.dart'
|
||||
if (dart.library.js) 'dart:js' as js;
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -13,7 +14,8 @@ import 'package:geosector_app/core/constants/app_keys.dart';
|
||||
import 'package:geosector_app/presentation/widgets/custom_button.dart';
|
||||
import 'package:geosector_app/presentation/widgets/custom_text_field.dart';
|
||||
import 'package:geosector_app/presentation/widgets/connectivity_indicator.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:geosector_app/presentation/widgets/loading_spin_overlay.dart';
|
||||
import 'package:geosector_app/presentation/widgets/result_dialog.dart';
|
||||
import 'package:geosector_app/app.dart'; // Pour accéder aux instances globales
|
||||
import 'package:geosector_app/core/services/hive_service.dart'; // Pour vérifier l'initialisation
|
||||
|
||||
@@ -31,7 +33,7 @@ class DotsPainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final paint = Paint()
|
||||
..color = Colors.white.withValues(alpha: 0.5)
|
||||
..color = Colors.white.withOpacity(0.5)
|
||||
..style = PaintingStyle.fill;
|
||||
|
||||
final random = math.Random(42); // Seed fixe pour consistance
|
||||
@@ -66,23 +68,11 @@ class _LoginPageState extends State<LoginPage> {
|
||||
bool _isConnected = true; // Par défaut, on suppose qu'il y a une connexion
|
||||
|
||||
Future<void> _getAppVersion() async {
|
||||
try {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = packageInfo.version;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Erreur lors de la récupération de la version: $e');
|
||||
// Fallback sur la version du AppInfoService si elle existe
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = AppInfoService.fullVersion
|
||||
.split(' ')
|
||||
.last; // Extraire juste le numéro
|
||||
});
|
||||
}
|
||||
// Utilise directement AppInfoService (remplace package_info_plus)
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = AppInfoService.version;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,15 +384,19 @@ class _LoginPageState extends State<LoginPage> {
|
||||
if (confirm == true) {
|
||||
setState(() => _isCleaningCache = true);
|
||||
debugPrint('👤 Utilisateur a demandé un nettoyage du cache');
|
||||
|
||||
|
||||
// Nettoyer le cache Hive
|
||||
await HiveService.instance.cleanDataOnLogout();
|
||||
|
||||
setState(() => _isCleaningCache = false);
|
||||
|
||||
// Rediriger vers la page splash pour réinitialiser
|
||||
if (context.mounted) {
|
||||
context.go('/');
|
||||
|
||||
// Forcer le rechargement complet de la page sur Web
|
||||
if (kIsWeb) {
|
||||
html.window.location.reload();
|
||||
} else {
|
||||
// Sur mobile, rediriger vers splash
|
||||
setState(() => _isCleaningCache = false);
|
||||
if (context.mounted) {
|
||||
context.go('/');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -432,8 +426,8 @@ class _LoginPageState extends State<LoginPage> {
|
||||
child: Card(
|
||||
elevation: 8,
|
||||
shadowColor: _loginType == 'user'
|
||||
? Colors.green.withValues(alpha: 0.5)
|
||||
: Colors.red.withValues(alpha: 0.5),
|
||||
? Colors.green.withOpacity(0.5)
|
||||
: Colors.red.withOpacity(0.5),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16.0)),
|
||||
child: Padding(
|
||||
@@ -474,7 +468,7 @@ class _LoginPageState extends State<LoginPage> {
|
||||
'Bienvenue sur GEOSECTOR',
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color:
|
||||
theme.colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
theme.colorScheme.onSurface.withOpacity(0.7),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -489,11 +483,11 @@ class _LoginPageState extends State<LoginPage> {
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.error.withValues(alpha: 0.1),
|
||||
color: theme.colorScheme.error.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color:
|
||||
theme.colorScheme.error.withValues(alpha: 0.3),
|
||||
theme.colorScheme.error.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
@@ -591,13 +585,10 @@ class _LoginPageState extends State<LoginPage> {
|
||||
debugPrint(
|
||||
'ERREUR: Utilisateur non trouvé après connexion réussie');
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Erreur de connexion. Veuillez réessayer.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'Erreur de connexion. Veuillez réessayer.',
|
||||
);
|
||||
}
|
||||
return;
|
||||
@@ -636,26 +627,20 @@ class _LoginPageState extends State<LoginPage> {
|
||||
// Un user (rôle 1) ne peut pas se connecter en mode admin
|
||||
debugPrint('Erreur: User (rôle 1) tentant de se connecter en mode admin');
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Accès administrateur non autorisé pour ce compte.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'Accès administrateur non autorisé pour ce compte.',
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Échec de la connexion. Vérifiez vos identifiants.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'Échec de la connexion. Vérifiez vos identifiants.',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -714,15 +699,10 @@ class _LoginPageState extends State<LoginPage> {
|
||||
if (connectivityService
|
||||
.isConnected &&
|
||||
context.mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Connexion Internet ${connectivityService.connectionType} détectée.'),
|
||||
backgroundColor:
|
||||
Colors.green,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: true,
|
||||
message: 'Connexion Internet ${connectivityService.connectionType} détectée.',
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -767,13 +747,10 @@ class _LoginPageState extends State<LoginPage> {
|
||||
debugPrint(
|
||||
'ERREUR: Utilisateur non trouvé après connexion réussie');
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Erreur de connexion. Veuillez réessayer.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'Erreur de connexion. Veuillez réessayer.',
|
||||
);
|
||||
}
|
||||
return;
|
||||
@@ -812,26 +789,20 @@ class _LoginPageState extends State<LoginPage> {
|
||||
// Un user (rôle 1) ne peut pas se connecter en mode admin
|
||||
debugPrint('Erreur: User (rôle 1) tentant de se connecter en mode admin');
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Accès administrateur non autorisé pour ce compte.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'Accès administrateur non autorisé pour ce compte.',
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Échec de la connexion. Vérifiez vos identifiants.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'Échec de la connexion. Vérifiez vos identifiants.',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -925,17 +896,17 @@ class _LoginPageState extends State<LoginPage> {
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.1),
|
||||
color: theme.colorScheme.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.3),
|
||||
color: theme.colorScheme.primary.withOpacity(0.3),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'v$_appVersion',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.8),
|
||||
color: theme.colorScheme.primary.withOpacity(0.8),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -1024,6 +995,12 @@ class _LoginPageState extends State<LoginPage> {
|
||||
isLoading = true;
|
||||
});
|
||||
|
||||
// Afficher le loading overlay
|
||||
final overlay = LoadingSpinOverlayUtils.show(
|
||||
context: context,
|
||||
message: 'Envoi en cours...',
|
||||
);
|
||||
|
||||
try {
|
||||
// Vérifier la connexion Internet
|
||||
await connectivityService.checkConnectivity();
|
||||
@@ -1087,6 +1064,9 @@ class _LoginPageState extends State<LoginPage> {
|
||||
|
||||
// Traiter la réponse
|
||||
if (response.statusCode == 200) {
|
||||
// Masquer le loading
|
||||
LoadingSpinOverlayUtils.hideSpecific(overlay);
|
||||
|
||||
// Modifier le contenu de la boîte de dialogue pour afficher le message de succès
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
@@ -1128,6 +1108,9 @@ class _LoginPageState extends State<LoginPage> {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Masquer le loading
|
||||
LoadingSpinOverlayUtils.hideSpecific(overlay);
|
||||
|
||||
// Fermer la boîte de dialogue actuelle
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop();
|
||||
@@ -1139,17 +1122,17 @@ class _LoginPageState extends State<LoginPage> {
|
||||
'Erreur lors de la récupération du mot de passe');
|
||||
}
|
||||
} catch (e) {
|
||||
// Masquer le loading
|
||||
LoadingSpinOverlayUtils.hideSpecific(overlay);
|
||||
|
||||
// Afficher un message d'erreur
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(e
|
||||
.toString()
|
||||
.contains('Exception:')
|
||||
? e.toString().split('Exception: ')[1]
|
||||
: 'Erreur lors de la récupération du mot de passe'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: e.toString().contains('Exception:')
|
||||
? e.toString().split('Exception: ')[1]
|
||||
: 'Erreur lors de la récupération du mot de passe',
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
|
||||
@@ -10,10 +10,11 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:geosector_app/presentation/widgets/custom_button.dart';
|
||||
import 'package:geosector_app/presentation/widgets/custom_text_field.dart';
|
||||
import 'package:geosector_app/presentation/widgets/connectivity_indicator.dart';
|
||||
import 'package:geosector_app/presentation/widgets/loading_spin_overlay.dart';
|
||||
import 'package:geosector_app/presentation/widgets/result_dialog.dart';
|
||||
import 'package:geosector_app/core/services/app_info_service.dart';
|
||||
import 'package:geosector_app/core/services/hive_service.dart';
|
||||
import 'package:geosector_app/core/constants/app_keys.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:geosector_app/app.dart'; // Pour accéder aux instances globales
|
||||
|
||||
class RegisterPage extends StatefulWidget {
|
||||
@@ -28,7 +29,7 @@ class DotsPainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final paint = Paint()
|
||||
..color = Colors.white.withValues(alpha: 0.5)
|
||||
..color = Colors.white.withOpacity(0.5)
|
||||
..style = PaintingStyle.fill;
|
||||
|
||||
final random = math.Random(42); // Seed fixe pour consistance
|
||||
@@ -91,23 +92,11 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
bool _isLoadingCities = false;
|
||||
|
||||
Future<void> _getAppVersion() async {
|
||||
try {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = packageInfo.version;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Erreur lors de la récupération de la version: $e');
|
||||
// Fallback sur la version du AppInfoService si elle existe
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = AppInfoService.fullVersion
|
||||
.split(' ')
|
||||
.last; // Extraire juste le numéro
|
||||
});
|
||||
}
|
||||
// Utilise directement AppInfoService (remplace package_info_plus)
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = AppInfoService.version;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +203,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
try {
|
||||
// Utiliser l'API interne de geosector pour récupérer les villes par code postal
|
||||
final baseUrl = Uri
|
||||
.base.origin; // Récupère l'URL de base (ex: https://app.geosector.fr)
|
||||
.base.origin; // Récupère l'URL de base (ex: https://app3.geosector.fr)
|
||||
final apiUrl = '$baseUrl/api/villes?code_postal=$postalCode';
|
||||
|
||||
final response = await http.get(
|
||||
@@ -327,7 +316,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
Text(
|
||||
'Enregistrez votre amicale sur GeoSector',
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.7),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
@@ -352,10 +341,10 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
margin: const EdgeInsets.only(top: 16),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.error.withValues(alpha: 0.1),
|
||||
color: theme.colorScheme.error.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.error.withValues(alpha: 0.3),
|
||||
color: theme.colorScheme.error.withOpacity(0.3),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
@@ -385,12 +374,10 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
onPressed: () async {
|
||||
await _checkConnectivity();
|
||||
if (_isConnected && context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Connexion Internet $_connectionType détectée.'),
|
||||
backgroundColor: Colors.green,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: true,
|
||||
message: 'Connexion Internet $_connectionType détectée.',
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -520,7 +507,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
color: const Color(0xFFECEFF1),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.05),
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -535,7 +522,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
),
|
||||
)
|
||||
: DropdownButtonFormField<City>(
|
||||
initialValue: _selectedCity,
|
||||
value: _selectedCity,
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.location_city_outlined,
|
||||
@@ -685,15 +672,10 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
if (connectivityService
|
||||
.isConnected &&
|
||||
context.mounted) {
|
||||
ScaffoldMessenger.of(
|
||||
context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Connexion Internet ${connectivityService.connectionType} détectée.'),
|
||||
backgroundColor:
|
||||
Colors.green,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: true,
|
||||
message: 'Connexion Internet ${connectivityService.connectionType} détectée.',
|
||||
);
|
||||
}
|
||||
},
|
||||
@@ -709,13 +691,10 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
if (captchaAnswer !=
|
||||
_captchaNum1 + _captchaNum2) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'La vérification de sécurité a échoué. Veuillez réessayer.'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'La vérification de sécurité a échoué. Veuillez réessayer.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -742,6 +721,12 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
_isLoading = true;
|
||||
});
|
||||
|
||||
// Afficher le loading overlay
|
||||
final overlay = LoadingSpinOverlayUtils.show(
|
||||
context: context,
|
||||
message: 'Inscription en cours...',
|
||||
);
|
||||
|
||||
try {
|
||||
// Envoyer les données à l'API
|
||||
final baseUrl = Uri.base.origin;
|
||||
@@ -757,6 +742,9 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
body: json.encode(formData),
|
||||
);
|
||||
|
||||
// Masquer le loading overlay
|
||||
LoadingSpinOverlayUtils.hideSpecific(overlay);
|
||||
|
||||
// Masquer l'indicateur de chargement
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
@@ -879,7 +867,7 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
color: theme
|
||||
.colorScheme
|
||||
.onSurface
|
||||
.withValues(alpha: 0.7),
|
||||
.withOpacity(0.7),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -940,33 +928,45 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
// Afficher également un SnackBar
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Gérer les erreurs HTTP
|
||||
// Gérer les erreurs HTTP (409, 400, etc.)
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Erreur ${response.statusCode}: ${response.reasonPhrase ?? "Échec de l'inscription"}'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
// Essayer d'extraire le message de l'API
|
||||
String errorMessage = 'Échec de l\'inscription';
|
||||
try {
|
||||
final errorData = json.decode(response.body);
|
||||
errorMessage = errorData['message'] ?? errorMessage;
|
||||
} catch (e) {
|
||||
// Si le parsing échoue, utiliser le message par défaut
|
||||
errorMessage = response.reasonPhrase ?? errorMessage;
|
||||
}
|
||||
|
||||
// Afficher une AlertDialog pour plus de visibilité
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Erreur d\'inscription'),
|
||||
content: Text(errorMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Masquer le loading overlay
|
||||
LoadingSpinOverlayUtils.hideSpecific(overlay);
|
||||
|
||||
// Masquer l'indicateur de chargement
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
@@ -974,13 +974,10 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
|
||||
// Gérer les exceptions
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Erreur: ${e.toString()}'),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
await ResultDialog.show(
|
||||
context: context,
|
||||
success: false,
|
||||
message: 'Erreur: ${e.toString()}',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1079,17 +1076,17 @@ class _RegisterPageState extends State<RegisterPage> {
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.1),
|
||||
color: theme.colorScheme.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.3),
|
||||
color: theme.colorScheme.primary.withOpacity(0.3),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'v$_appVersion',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.8),
|
||||
color: theme.colorScheme.primary.withOpacity(0.8),
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:hive_flutter/hive_flutter.dart';
|
||||
import 'dart:async';
|
||||
import 'dart:math' as math;
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
// Import conditionnel pour le web
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
@@ -37,7 +36,7 @@ class DotsPainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final paint = Paint()
|
||||
..color = Colors.white.withValues(alpha: 0.5)
|
||||
..color = Colors.white.withOpacity(0.5)
|
||||
..style = PaintingStyle.fill;
|
||||
|
||||
final random = math.Random(42); // Seed fixe pour consistance
|
||||
@@ -68,20 +67,11 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
bool _isCleaningCache = false;
|
||||
|
||||
Future<void> _getAppVersion() async {
|
||||
try {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = packageInfo.version;
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('Erreur lors de la récupération de la version: $e');
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = AppInfoService.fullVersion.split(' ').last;
|
||||
});
|
||||
}
|
||||
// Utilise directement AppInfoService (remplace package_info_plus)
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_appVersion = AppInfoService.version;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +311,9 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
ApiService.instance.setSessionId(sessionId);
|
||||
|
||||
// Appeler le nouvel endpoint API pour restaurer la session
|
||||
final response = await ApiService.instance.get(
|
||||
// IMPORTANT: Utiliser getWithoutQueue() pour ne JAMAIS mettre cette requête en file d'attente
|
||||
// Les refresh de session sont liés à une session spécifique et ne doivent pas être rejoués
|
||||
final response = await ApiService.instance.getWithoutQueue(
|
||||
'/api/user/session',
|
||||
queryParameters: {'mode': displayMode},
|
||||
);
|
||||
@@ -858,7 +850,7 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
'Une application puissante et intuitive de gestion de vos distributions de calendriers',
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.7),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -878,7 +870,7 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.2),
|
||||
color: theme.colorScheme.primary.withOpacity(0.2),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -893,7 +885,7 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
builder: (context, value, child) {
|
||||
return LinearProgressIndicator(
|
||||
value: value,
|
||||
backgroundColor: Colors.grey.withValues(alpha: 0.15),
|
||||
backgroundColor: Colors.grey.withOpacity(0.15),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
theme.colorScheme.primary,
|
||||
),
|
||||
@@ -923,7 +915,7 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
_statusMessage,
|
||||
key: ValueKey(_statusMessage),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
color: theme.colorScheme.onSurface.withOpacity(0.7),
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
@@ -1188,8 +1180,13 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
// Reset du cache des repositories après nettoyage
|
||||
_resetAllRepositoriesCache();
|
||||
|
||||
// Après le nettoyage, relancer l'initialisation
|
||||
_startInitialization();
|
||||
// Forcer le rechargement complet de la page
|
||||
if (kIsWeb) {
|
||||
html.window.location.reload();
|
||||
} else {
|
||||
// Sur mobile, relancer l'initialisation normalement
|
||||
_startInitialization();
|
||||
}
|
||||
}
|
||||
},
|
||||
icon: Icon(
|
||||
@@ -1229,7 +1226,7 @@ class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateM
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.colorScheme.primary.withValues(alpha: 0.1),
|
||||
color: theme.colorScheme.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: theme.colorScheme.primary,
|
||||
|
||||
Reference in New Issue
Block a user