fAdd phone number support to user authentication events and methods
This commit is contained in:
@@ -126,7 +126,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
}
|
||||
|
||||
if (state is ActivityLoaded) {
|
||||
print('✅ Activités chargées: ${state.activities.length}');
|
||||
// Stocker les activités localement
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
@@ -137,28 +136,18 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
_isLoadingTripActivities = false;
|
||||
});
|
||||
|
||||
print(
|
||||
'🔄 [ActivityLoaded] Activités du voyage mises à jour: ${_tripActivities.length}',
|
||||
);
|
||||
// Vérifier si on a besoin de charger plus d'activités dans les suggestions
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
print(
|
||||
'🚀 [ActivityLoaded] Déclenchement de la vérification auto-reload',
|
||||
);
|
||||
_checkAndLoadMoreActivitiesIfNeeded();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (state is ActivitySearchResults) {
|
||||
print('🔍 Résultats Google: ${state.searchResults.length}');
|
||||
// Déclencher l'auto-reload uniquement pour la recherche initiale (6 résultats)
|
||||
// et pas pour les rechargements automatiques
|
||||
if (state.searchResults.length <= 6 && !_autoReloadInProgress) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
print(
|
||||
'🎯 [ActivitySearchResults] Première recherche avec peu de résultats, vérification auto-reload',
|
||||
);
|
||||
Future.delayed(const Duration(milliseconds: 500), () {
|
||||
_checkAndLoadMoreActivitiesIfNeeded();
|
||||
});
|
||||
@@ -167,13 +156,11 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
}
|
||||
|
||||
if (state is ActivityVoteRecorded) {
|
||||
print('<EFBFBD>️ Vote enregistré pour activité: ${state.activityId}');
|
||||
// Recharger les activités du voyage pour mettre à jour les votes
|
||||
_loadActivities();
|
||||
}
|
||||
|
||||
if (state is ActivityAdded) {
|
||||
print('✅ Activité ajoutée avec succès: ${state.activity.name}');
|
||||
// Recharger automatiquement les activités du voyage
|
||||
_loadActivities();
|
||||
}
|
||||
@@ -654,10 +641,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
);
|
||||
}).toList();
|
||||
|
||||
print(
|
||||
'🔍 [Google Search] ${googleActivities.length} résultats trouvés, ${filteredActivities.length} après filtrage',
|
||||
);
|
||||
|
||||
if (filteredActivities.isEmpty && googleActivities.isNotEmpty) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -764,18 +747,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
print(
|
||||
'🧪 [DEBUG] Force auto-reload check - État actuel:',
|
||||
);
|
||||
print(
|
||||
'🧪 [DEBUG] _tripActivities: ${_tripActivities.length}',
|
||||
);
|
||||
print(
|
||||
'🧪 [DEBUG] _autoReloadInProgress: $_autoReloadInProgress',
|
||||
);
|
||||
print(
|
||||
'🧪 [DEBUG] _lastAutoReloadTriggerCount: $_lastAutoReloadTriggerCount',
|
||||
);
|
||||
_checkAndLoadMoreActivitiesIfNeeded();
|
||||
},
|
||||
icon: const Icon(Icons.bug_report, size: 16),
|
||||
@@ -1251,8 +1222,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
}
|
||||
|
||||
void _voteForActivity(String activityId, int vote) {
|
||||
print('🗳️ Vote pour activité $activityId: $vote');
|
||||
|
||||
// TODO: Récupérer l'ID utilisateur actuel
|
||||
// Pour l'instant, on utilise un ID temporaire
|
||||
final userId = 'current_user_id';
|
||||
@@ -1275,8 +1244,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
}
|
||||
|
||||
void _addGoogleActivityToTrip(Activity activity) {
|
||||
print('➕ [Add Activity] Adding ${activity.name} to trip');
|
||||
|
||||
// Créer une nouvelle activité avec l'ID du voyage
|
||||
final newActivity = activity.copyWith(
|
||||
tripId: widget.trip.id,
|
||||
@@ -1307,7 +1274,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
void _checkAndLoadMoreActivitiesIfNeeded() {
|
||||
// Protection contre les rechargements en boucle
|
||||
if (_autoReloadInProgress) {
|
||||
print('⏸️ [Auto-reload] Auto-reload déjà en cours, skip');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1315,13 +1281,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
if (currentState is ActivitySearchResults) {
|
||||
final googleActivities = currentState.searchResults;
|
||||
|
||||
print(
|
||||
'🔍 [Auto-reload] Activités du voyage en mémoire: ${_tripActivities.length}',
|
||||
);
|
||||
print(
|
||||
'🔍 [Auto-reload] Activités Google total: ${googleActivities.length}',
|
||||
);
|
||||
|
||||
// Filtrer les activités déjà présentes dans le voyage
|
||||
final filteredActivities = googleActivities.where((googleActivity) {
|
||||
final isDuplicate = _tripActivities.any(
|
||||
@@ -1329,21 +1288,12 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
tripActivity.name.toLowerCase().trim() ==
|
||||
googleActivity.name.toLowerCase().trim(),
|
||||
);
|
||||
if (isDuplicate) {
|
||||
print('🔍 [Auto-reload] Activité filtrée: ${googleActivity.name}');
|
||||
}
|
||||
if (isDuplicate) {}
|
||||
return !isDuplicate;
|
||||
}).toList();
|
||||
|
||||
print(
|
||||
'🔍 [Auto-reload] ${filteredActivities.length} activités visibles après filtrage sur ${googleActivities.length} total',
|
||||
);
|
||||
|
||||
// Protection: ne pas redéclencher pour le même nombre d'activités Google
|
||||
if (googleActivities.length == _lastAutoReloadTriggerCount) {
|
||||
print(
|
||||
'🔒 [Auto-reload] Même nombre qu\'avant (${googleActivities.length}), skip pour éviter la boucle',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1360,13 +1310,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
activitiesNeeded +
|
||||
6; // Activités actuelles + ce qui manque + buffer de 6
|
||||
|
||||
print(
|
||||
'🔄 [Auto-reload] DÉCLENCHEMENT: Besoin de $activitiesNeeded activités supplémentaires',
|
||||
);
|
||||
print(
|
||||
'📊 [Auto-reload] Demande totale: $newTotalToRequest activités (actuellement: ${googleActivities.length})',
|
||||
);
|
||||
|
||||
// Mettre à jour le compteur et recharger avec le nouveau total
|
||||
_totalGoogleActivitiesRequested = newTotalToRequest;
|
||||
_loadMoreGoogleActivitiesWithTotal(newTotalToRequest);
|
||||
@@ -1374,35 +1317,19 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
// Libérer le verrou après un délai
|
||||
Future.delayed(const Duration(seconds: 3), () {
|
||||
_autoReloadInProgress = false;
|
||||
print('🔓 [Auto-reload] Verrou libéré');
|
||||
});
|
||||
} else if (filteredActivities.length >= 4) {
|
||||
print(
|
||||
'✅ [Auto-reload] Suffisamment d\'activités visibles (${filteredActivities.length} >= 4)',
|
||||
);
|
||||
} else {
|
||||
print(
|
||||
'🚫 [Auto-reload] Trop d\'activités Google déjà chargées (${googleActivities.length} >= 20), arrêt auto-reload',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
print(
|
||||
'⚠️ [Auto-reload] État pas prêt pour auto-chargement: ${currentState.runtimeType}',
|
||||
);
|
||||
}
|
||||
} else {}
|
||||
} else {}
|
||||
}
|
||||
|
||||
void _searchGoogleActivities() {
|
||||
print('🔍 [Google Search] Initializing first search with 6 results');
|
||||
_totalGoogleActivitiesRequested = 6; // Reset du compteur
|
||||
_autoReloadInProgress = false; // Reset des protections
|
||||
_lastAutoReloadTriggerCount = 0;
|
||||
|
||||
// Utiliser les coordonnées pré-géolocalisées du voyage si disponibles
|
||||
if (widget.trip.hasCoordinates) {
|
||||
print(
|
||||
'🌍 [Google Search] Using pre-geocoded coordinates: ${widget.trip.latitude}, ${widget.trip.longitude}',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivitiesWithCoordinates(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1414,9 +1341,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
),
|
||||
);
|
||||
} else {
|
||||
print(
|
||||
'⚠️ [Google Search] No coordinates available, falling back to destination geocoding',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivities(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1431,16 +1355,12 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
}
|
||||
|
||||
void _resetAndSearchGoogleActivities() {
|
||||
print('🔄 [Google Search] Resetting and starting fresh search');
|
||||
_totalGoogleActivitiesRequested = 6; // Reset du compteur
|
||||
_autoReloadInProgress = false; // Reset des protections
|
||||
_lastAutoReloadTriggerCount = 0;
|
||||
|
||||
// Utiliser les coordonnées pré-géolocalisées du voyage si disponibles
|
||||
if (widget.trip.hasCoordinates) {
|
||||
print(
|
||||
'🌍 [Google Search] Using pre-geocoded coordinates: ${widget.trip.latitude}, ${widget.trip.longitude}',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivitiesWithCoordinates(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1452,9 +1372,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
),
|
||||
);
|
||||
} else {
|
||||
print(
|
||||
'⚠️ [Google Search] No coordinates available, falling back to destination geocoding',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivities(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1469,23 +1386,16 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
}
|
||||
|
||||
void _loadMoreGoogleActivities() {
|
||||
print('📄 [Google Search] Loading more activities (next 6 results)');
|
||||
final currentState = context.read<ActivityBloc>().state;
|
||||
|
||||
if (currentState is ActivitySearchResults) {
|
||||
final currentCount = currentState.searchResults.length;
|
||||
final newTotal = currentCount + 6;
|
||||
print(
|
||||
'📊 [Google Search] Current results count: $currentCount, requesting total: $newTotal',
|
||||
);
|
||||
|
||||
_totalGoogleActivitiesRequested = newTotal;
|
||||
|
||||
// Utiliser les coordonnées pré-géolocalisées du voyage si disponibles
|
||||
if (widget.trip.hasCoordinates) {
|
||||
print(
|
||||
'🌍 [Google Search] Using pre-geocoded coordinates for more results',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivitiesWithCoordinates(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1497,9 +1407,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
),
|
||||
);
|
||||
} else {
|
||||
print(
|
||||
'⚠️ [Google Search] No coordinates available, falling back to destination geocoding',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivities(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1514,26 +1421,15 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
}
|
||||
|
||||
void _loadMoreGoogleActivitiesWithTotal(int totalToRequest) {
|
||||
print(
|
||||
'📈 [Google Search] Loading activities with specific total: $totalToRequest',
|
||||
);
|
||||
|
||||
// Au lieu de reset, on utilise l'offset et append pour forcer plus de résultats
|
||||
final currentState = context.read<ActivityBloc>().state;
|
||||
if (currentState is ActivitySearchResults) {
|
||||
final currentCount = currentState.searchResults.length;
|
||||
final additionalNeeded = totalToRequest - currentCount;
|
||||
|
||||
print(
|
||||
'📊 [Google Search] Current: $currentCount, Total demandé: $totalToRequest, Additional: $additionalNeeded',
|
||||
);
|
||||
|
||||
if (additionalNeeded > 0) {
|
||||
// Utiliser les coordonnées pré-géolocalisées du voyage si disponibles
|
||||
if (widget.trip.hasCoordinates) {
|
||||
print(
|
||||
'🌍 [Google Search] Using pre-geocoded coordinates for additional results',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivitiesWithCoordinates(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1546,9 +1442,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
),
|
||||
);
|
||||
} else {
|
||||
print(
|
||||
'⚠️ [Google Search] No coordinates available, falling back to destination geocoding',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivities(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1560,15 +1453,10 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
print('⚠️ [Google Search] Pas besoin de charger plus (déjà suffisant)');
|
||||
}
|
||||
} else {}
|
||||
} else {
|
||||
// Si pas de résultats existants, faire une recherche complète
|
||||
if (widget.trip.hasCoordinates) {
|
||||
print(
|
||||
'🌍 [Google Search] Using pre-geocoded coordinates for fresh search',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivitiesWithCoordinates(
|
||||
tripId: widget.trip.id!,
|
||||
@@ -1580,9 +1468,6 @@ class _ActivitiesPageState extends State<ActivitiesPage>
|
||||
),
|
||||
);
|
||||
} else {
|
||||
print(
|
||||
'⚠️ [Google Search] No coordinates available, falling back to destination geocoding',
|
||||
);
|
||||
context.read<ActivityBloc>().add(
|
||||
SearchActivities(
|
||||
tripId: widget.trip.id!,
|
||||
|
||||
158
lib/components/loading/laoding_content.dart
Normal file
158
lib/components/loading/laoding_content.dart
Normal file
@@ -0,0 +1,158 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoadingContent extends StatefulWidget {
|
||||
final Future<void> Function()? onBackgroundTask;
|
||||
final String? loadingText;
|
||||
final VoidCallback? onComplete;
|
||||
|
||||
const LoadingContent({
|
||||
Key? key,
|
||||
this.onBackgroundTask,
|
||||
this.loadingText = "Chargement en cours...",
|
||||
this.onComplete,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LoadingContent> createState() => _LoadingContentState();
|
||||
}
|
||||
|
||||
class _LoadingContentState extends State<LoadingContent>
|
||||
with TickerProviderStateMixin {
|
||||
late AnimationController _rotationController;
|
||||
late AnimationController _pulseController;
|
||||
late Animation<double> _rotationAnimation;
|
||||
late Animation<double> _pulseAnimation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
_rotationController = AnimationController(
|
||||
duration: const Duration(seconds: 2),
|
||||
vsync: this,
|
||||
)..repeat();
|
||||
|
||||
_pulseController = AnimationController(
|
||||
duration: const Duration(milliseconds: 1500),
|
||||
vsync: this,
|
||||
)..repeat(reverse: true);
|
||||
|
||||
_rotationAnimation = Tween<double>(
|
||||
begin: 0,
|
||||
end: 1,
|
||||
).animate(_rotationController);
|
||||
|
||||
_pulseAnimation = Tween<double>(begin: 0.8, end: 1.2).animate(
|
||||
CurvedAnimation(parent: _pulseController, curve: Curves.easeInOut),
|
||||
);
|
||||
|
||||
_executeBackgroundTask();
|
||||
}
|
||||
|
||||
Future<void> _executeBackgroundTask() async {
|
||||
if (widget.onBackgroundTask != null) {
|
||||
try {
|
||||
await widget.onBackgroundTask!();
|
||||
if (widget.onComplete != null) {
|
||||
widget.onComplete!();
|
||||
}
|
||||
} catch (e) {
|
||||
// Gérer les erreurs si nécessaire
|
||||
print('Erreur lors de la tâche en arrière-plan: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_rotationController.dispose();
|
||||
_pulseController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Animation de rotation et pulsation
|
||||
AnimatedBuilder(
|
||||
animation: Listenable.merge([
|
||||
_rotationAnimation,
|
||||
_pulseAnimation,
|
||||
]),
|
||||
builder: (context, child) {
|
||||
return Transform.scale(
|
||||
scale: _pulseAnimation.value,
|
||||
child: RotationTransition(
|
||||
turns: _rotationAnimation,
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
Colors.blue.shade400,
|
||||
Colors.purple.shade400,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.blue.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
spreadRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.travel_explore,
|
||||
color: Colors.white,
|
||||
size: 40,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
|
||||
// Texte de chargement avec animation
|
||||
AnimatedBuilder(
|
||||
animation: _pulseController,
|
||||
builder: (context, child) {
|
||||
return Opacity(
|
||||
opacity: _pulseAnimation.value - 0.3,
|
||||
child: Text(
|
||||
widget.loadingText ?? "Chargement en cours...",
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey.shade700,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Indicateur de progression linéaire
|
||||
SizedBox(
|
||||
width: 200,
|
||||
child: LinearProgressIndicator(
|
||||
backgroundColor: Colors.grey.shade300,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue.shade400),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
232
lib/components/signup/sign_up_platform_content.dart
Normal file
232
lib/components/signup/sign_up_platform_content.dart
Normal file
@@ -0,0 +1,232 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SignUpPlatformContent extends StatefulWidget {
|
||||
final String platform; // 'google' ou 'apple'
|
||||
final String? email;
|
||||
final String? phoneNumber;
|
||||
final String? name;
|
||||
final String? firstName;
|
||||
|
||||
const SignUpPlatformContent({
|
||||
Key? key,
|
||||
required this.platform,
|
||||
this.email,
|
||||
this.phoneNumber,
|
||||
this.name,
|
||||
this.firstName,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<SignUpPlatformContent> createState() => _SignUpPlatformContentState();
|
||||
}
|
||||
|
||||
class _SignUpPlatformContentState extends State<SignUpPlatformContent> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
late TextEditingController _nameController;
|
||||
late TextEditingController _firstNameController;
|
||||
late TextEditingController _emailController;
|
||||
late TextEditingController _phoneController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_nameController = TextEditingController(text: widget.name ?? '');
|
||||
_firstNameController = TextEditingController(text: widget.firstName ?? '');
|
||||
_emailController = TextEditingController(text: widget.email ?? '');
|
||||
_phoneController = TextEditingController(text: widget.phoneNumber ?? '');
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameController.dispose();
|
||||
_firstNameController.dispose();
|
||||
_emailController.dispose();
|
||||
_phoneController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
String? _validateField(String? value, String fieldName) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return '$fieldName est requis';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void _submitForm() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// Traitement de l'inscription
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Profil complété avec succès!')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildPlatformIndicator() {
|
||||
Color platformColor = widget.platform == 'google'
|
||||
? Colors.red
|
||||
: Colors.black;
|
||||
IconData platformIcon = widget.platform == 'google'
|
||||
? Icons.g_mobiledata
|
||||
: Icons.apple;
|
||||
String platformName = widget.platform == 'google' ? 'Google' : 'Apple';
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: widget.platform == 'google'
|
||||
? Colors.red.shade50
|
||||
: Colors.black.withValues(alpha: 0.05),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: platformColor, width: 1),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(platformIcon, color: platformColor, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Connecté avec $platformName',
|
||||
style: TextStyle(
|
||||
color: platformColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.black),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
// Indicateur de plateforme
|
||||
_buildPlatformIndicator(),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Titre
|
||||
const Text(
|
||||
'Complétez votre profil',
|
||||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
Text(
|
||||
'Vérifiez et complétez vos informations',
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey[600]),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Champ Nom
|
||||
TextFormField(
|
||||
controller: _nameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Nom',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.person_outline),
|
||||
),
|
||||
validator: (value) => _validateField(value, 'Nom'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Champ Prénom
|
||||
TextFormField(
|
||||
controller: _firstNameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Prénom',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.person_outline),
|
||||
),
|
||||
validator: (value) => _validateField(value, 'Prénom'),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Champ Email (non modifiable)
|
||||
TextFormField(
|
||||
controller: _emailController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Email',
|
||||
border: const OutlineInputBorder(),
|
||||
prefixIcon: const Icon(Icons.email_outlined),
|
||||
suffixIcon: Icon(
|
||||
Icons.lock_outline,
|
||||
color: Colors.grey[400],
|
||||
),
|
||||
),
|
||||
enabled: false,
|
||||
style: TextStyle(color: Colors.grey[600]),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Email fourni par ${widget.platform == 'google' ? 'Google' : 'Apple'}',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Champ Téléphone
|
||||
TextFormField(
|
||||
controller: _phoneController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Numéro de téléphone',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.phone_outlined),
|
||||
hintText: '+33 6 12 34 56 78',
|
||||
),
|
||||
keyboardType: TextInputType.phone,
|
||||
validator: (value) =>
|
||||
_validateField(value, 'Numéro de téléphone'),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Bouton de confirmation
|
||||
ElevatedButton(
|
||||
onPressed: _submitForm,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.blue,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Confirmer mon inscription',
|
||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Bouton secondaire
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text(
|
||||
'Modifier la méthode de connexion',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 14),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user