Refactor signup fields and update home page titles; add trip service and model

This commit is contained in:
Van Leemput Dayron
2025-10-04 17:42:21 +02:00
parent 6aaf2406b3
commit 02754f3506
6 changed files with 830 additions and 150 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:travel_mate/components/create_trip_content.dart';
import '../../providers/user_provider.dart';
class HomeContent extends StatelessWidget {
@@ -7,73 +8,83 @@ class HomeContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Consumer<UserProvider>(
builder: (context, userProvider, child) {
final user = userProvider.currentUser;
return Scaffold(
body: Consumer<UserProvider>(
builder: (context, userProvider, child) {
final user = userProvider.currentUser;
return SingleChildScrollView(
// Ajout du scroll
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header de bienvenue
Text(
'Bonjour ${user?.prenom ?? 'Voyageur'} !',
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
),
SizedBox(height: 8),
Text(
'Vos voyages en cours',
style: TextStyle(fontSize: 16, color: Colors.grey[600]),
),
SizedBox(height: 20),
return SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Header de bienvenue
Text(
'Bonjour ${user?.prenom ?? 'Voyageur'} !',
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
),
SizedBox(height: 8),
Text(
'Vos voyages en cours',
style: TextStyle(fontSize: 16, color: Colors.grey[600]),
),
SizedBox(height: 20),
// Liste des groupes/voyages
_buildTravelCard(
context,
title: 'Voyage à Paris',
location: 'Paris, France',
dates: '15-20 Juin 2024',
participants: ['Alice', 'Bob', 'Charlie'],
budget: 1200.50,
imageUrl:
'https://images.unsplash.com/photo-1502602898536-47ad22581b52',
color: Colors.blue,
),
// Liste des groupes/voyages
_buildTravelCard(
context,
title: 'Voyage à Paris',
location: 'Paris, France',
dates: '15-20 Juin 2024',
participants: ['Alice', 'Bob', 'Charlie'],
budget: 1200.50,
imageUrl:
'https://images.unsplash.com/photo-1502602898536-47ad22581b52',
color: Colors.blue,
),
_buildTravelCard(
context,
title: 'Road Trip Espagne',
location: 'Madrid, Espagne',
dates: '10-18 Août 2024',
participants: ['Marie', 'Paul', 'Sophie', 'Thomas'],
budget: 850.75,
imageUrl:
'https://images.unsplash.com/photo-1539037116277-4db20889f2d4',
color: Colors.orange,
),
_buildTravelCard(
context,
title: 'Road Trip Espagne',
location: 'Madrid, Espagne',
dates: '10-18 Août 2024',
participants: ['Marie', 'Paul', 'Sophie', 'Thomas'],
budget: 850.75,
imageUrl:
'https://images.unsplash.com/photo-1539037116277-4db20889f2d4',
color: Colors.orange,
),
_buildTravelCard(
context,
title: 'Weekend à Amsterdam',
location: 'Amsterdam, Pays-Bas',
dates: '3-5 Septembre 2024',
participants: ['Emma', 'Lucas'],
budget: 450.25,
imageUrl:
'https://images.unsplash.com/photo-1534351450181-ea9f78427fe8',
color: Colors.green,
),
_buildTravelCard(
context,
title: 'Weekend à Amsterdam',
location: 'Amsterdam, Pays-Bas',
dates: '3-5 Septembre 2024',
participants: ['Emma', 'Lucas'],
budget: 450.25,
imageUrl:
'https://images.unsplash.com/photo-1534351450181-ea9f78427fe8',
color: Colors.green,
),
SizedBox(height: 20),
// Espacement en bas pour éviter que le FAB cache le contenu
SizedBox(height: 80),
],
),
);
},
),
// Bouton pour créer un nouveau voyage
_buildCreateTravelCard(context),
],
),
);
},
// FloatingActionButton intégré directement dans HomeContent
floatingActionButton: FloatingActionButton(
onPressed: () {
_showCreateTravelDialog(context);
},
backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Colors.white,
child: Icon(Icons.add),
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
);
}
@@ -301,49 +312,6 @@ class HomeContent extends StatelessWidget {
);
}
Widget _buildCreateTravelCard(BuildContext context) {
return Card(
elevation: 2,
margin: EdgeInsets.only(bottom: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
side: BorderSide(
color: Colors.grey[300]!,
width: 2,
style: BorderStyle.solid,
),
),
child: InkWell(
onTap: () {
_showCreateTravelDialog(context);
},
borderRadius: BorderRadius.circular(12),
child: Container(
padding: EdgeInsets.all(24),
child: Column(
children: [
Icon(Icons.add_circle_outline, size: 48, color: Colors.grey[400]),
SizedBox(height: 12),
Text(
'Créer un nouveau voyage',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.grey[600],
),
),
SizedBox(height: 4),
Text(
'Organisez votre prochaine aventure',
style: TextStyle(fontSize: 14, color: Colors.grey[500]),
),
],
),
),
),
);
}
void _showTravelDetails(BuildContext context, String title) {
Navigator.push(
context,
@@ -359,29 +327,9 @@ class HomeContent extends StatelessWidget {
}
void _showCreateTravelDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Créer un voyage'),
content: Text(
'Fonctionnalité à implémenter pour créer un nouveau voyage.',
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text('Fermer'),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).pop();
// TODO: Naviguer vers le formulaire de création
},
child: Text('Créer'),
),
],
);
},
Navigator.push(
context,
MaterialPageRoute(builder: (context) => CreateTripContent()),
);
}
}