Enhance User model with optional fields and update authentication methods to include profile picture and phone number
This commit is contained in:
@@ -21,9 +21,8 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MapContent(
|
||||
initialSearchQuery: widget.trip.location,
|
||||
),
|
||||
builder: (context) =>
|
||||
MapContent(initialSearchQuery: widget.trip.location),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -32,7 +31,7 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
Future<void> _openGoogleMaps() async {
|
||||
final location = Uri.encodeComponent(widget.trip.location);
|
||||
final url = 'https://www.google.com/maps/search/?api=1&query=$location';
|
||||
|
||||
|
||||
try {
|
||||
final uri = Uri.parse(url);
|
||||
if (await canLaunchUrl(uri)) {
|
||||
@@ -48,7 +47,9 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Impossible d\'ouvrir Google Maps. Vérifiez que l\'application est installée.'),
|
||||
content: Text(
|
||||
'Impossible d\'ouvrir Google Maps. Vérifiez que l\'application est installée.',
|
||||
),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
);
|
||||
@@ -69,15 +70,12 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||
final textColor = isDarkMode ? Colors.white : Colors.black;
|
||||
final secondaryTextColor = isDarkMode ? Colors.white70 : Colors.grey[600];
|
||||
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.trip.title),
|
||||
),
|
||||
appBar: AppBar(title: Text(widget.trip.title)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
@@ -92,10 +90,7 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Text(
|
||||
widget.trip.description,
|
||||
style: TextStyle(color: textColor),
|
||||
),
|
||||
Text(widget.trip.description, style: TextStyle(color: textColor)),
|
||||
SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
@@ -125,10 +120,7 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
SizedBox(width: 8),
|
||||
Text(
|
||||
'${widget.trip.participants.length} participant${widget.trip.participants.length > 1 ? 's' : ''}',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: secondaryTextColor,
|
||||
),
|
||||
style: TextStyle(fontSize: 14, color: secondaryTextColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -166,7 +158,7 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.primary,
|
||||
backgroundColor: const Color.fromARGB(255, 102, 102, 102),
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -175,7 +167,7 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
|
||||
|
||||
// Bouton Google Maps
|
||||
Expanded(
|
||||
child: ElevatedButton.icon(
|
||||
@@ -189,7 +181,7 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.green[700],
|
||||
backgroundColor: const Color.fromARGB(255, 102, 102, 102),
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -211,13 +203,11 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
final result = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CreateTripContent(
|
||||
tripToEdit: widget.trip,
|
||||
),
|
||||
builder: (context) =>
|
||||
CreateTripContent(tripToEdit: widget.trip),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (result == true && mounted) {
|
||||
Navigator.pop(context, true); // Retour avec flag
|
||||
}
|
||||
@@ -249,7 +239,8 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text('Confirmer la suppression'),
|
||||
content: Text(
|
||||
'Êtes-vous sûr de vouloir supprimer ce voyage ? Cette action est irréversible.'),
|
||||
'Êtes-vous sûr de vouloir supprimer ce voyage ? Cette action est irréversible.',
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
@@ -257,9 +248,14 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
context.read<TripBloc>().add(TripDeleteRequested(tripId: widget.trip.id!));
|
||||
context.read<TripBloc>().add(
|
||||
TripDeleteRequested(tripId: widget.trip.id!),
|
||||
);
|
||||
Navigator.pop(context); // Fermer le dialogue
|
||||
Navigator.pop(context, true); // Retourner à l'écran précédent
|
||||
Navigator.pop(
|
||||
context,
|
||||
true,
|
||||
); // Retourner à l'écran précédent
|
||||
},
|
||||
child: Text(
|
||||
'Supprimer',
|
||||
@@ -285,10 +281,10 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user