feat: Enhance trip management features and improve UI responsiveness
- Implemented AutomaticKeepAliveClientMixin in HomeContent to maintain state during navigation. - Modified trip loading logic to trigger after the first frame for better performance. - Updated trip loading events to use LoadTripsByUserId for consistency. - Added temporary success messages for trip creation and operations. - Improved UI elements for better user experience, including updated text styles and spacing. - Refactored trip model to support Firestore timestamps and improved error handling during parsing. - Streamlined trip repository methods for better clarity and performance. - Enhanced trip service methods to ensure correct mapping from Firestore documents. - Removed unnecessary trip reset logic on logout.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:travel_mate/components/home/create_trip_content.dart';
|
||||
import 'package:travel_mate/data/models/trip.dart';
|
||||
|
||||
class ShowTripDetailsContent extends StatefulWidget {
|
||||
@@ -12,7 +13,7 @@ class ShowTripDetailsContent extends StatefulWidget {
|
||||
class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Détecter le thème actuel
|
||||
|
||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||
final textColor = isDarkMode ? Colors.white : Colors.black;
|
||||
final secondaryTextColor = isDarkMode ? Colors.white70 : Colors.grey[600];
|
||||
@@ -85,8 +86,20 @@ class _ShowTripDetailsContentState extends State<ShowTripDetailsContent> {
|
||||
width: double.infinity,
|
||||
height: 50,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
// Handle button press
|
||||
onPressed: () async {
|
||||
final result = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CreateTripContent(
|
||||
tripToEdit: widget.trip,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
if (result == true && mounted) {
|
||||
Navigator.pop(context, true); // Retour avec flag
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Color.fromARGB(255, 0, 123, 255),
|
||||
|
||||
Reference in New Issue
Block a user