feat: Improve UI responsiveness with dynamic text and icon colors based on theme

This commit is contained in:
Dayron
2025-10-09 09:38:36 +02:00
parent 56211e0b58
commit 8c515e64ba
2 changed files with 65 additions and 27 deletions

View File

@@ -78,7 +78,7 @@ class _HomeContentState extends State<HomeContent> {
children: [
// Header de bienvenue
Text(
'Bonjour ${user.prenom ?? 'Voyageur'} !',
'Bonjour ${user.prenom} !',
style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold),
),
SizedBox(height: 8),
@@ -181,6 +181,12 @@ class _HomeContentState extends State<HomeContent> {
Widget _buildTravelCard(Trip trip) {
final colors = [Colors.blue, Colors.orange, Colors.green, Colors.purple, Colors.red];
final color = colors[trip.title.hashCode.abs() % colors.length];
// 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[700];
final iconColor = isDarkMode ? Colors.white70 : Colors.grey[600];
return Card(
elevation: 4,
@@ -249,9 +255,9 @@ class _HomeContentState extends State<HomeContent> {
Expanded(
child: Text(
trip.location,
style: const TextStyle(
style: TextStyle(
fontSize: 14,
color: Colors.white,
color: textColor,
),
overflow: TextOverflow.ellipsis,
),
@@ -277,7 +283,7 @@ class _HomeContentState extends State<HomeContent> {
trip.description,
style: TextStyle(
fontSize: 14,
color: Colors.grey[700],
color: secondaryTextColor,
),
maxLines: 2,
overflow: TextOverflow.ellipsis,
@@ -291,14 +297,14 @@ class _HomeContentState extends State<HomeContent> {
Icon(
Icons.calendar_today,
size: 16,
color: Colors.grey[600],
color: iconColor,
),
SizedBox(width: 8),
Text(
'${trip.startDate.day}/${trip.startDate.month}/${trip.startDate.year} - ${trip.endDate.day}/${trip.endDate.month}/${trip.endDate.year}',
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
color: iconColor,
fontWeight: FontWeight.w500,
),
),
@@ -310,13 +316,13 @@ class _HomeContentState extends State<HomeContent> {
// Participants
Row(
children: [
Icon(Icons.group, size: 16, color: Colors.grey[600]),
Icon(Icons.group, size: 16, color: iconColor),
SizedBox(width: 8),
Text(
'${trip.participants.length} participant${trip.participants.length > 1 ? 's' : ''}',
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
color: iconColor,
fontWeight: FontWeight.w500,
),
),
@@ -332,13 +338,13 @@ class _HomeContentState extends State<HomeContent> {
if (trip.budget! > 0)
Row(
children: [
Icon(Icons.euro, size: 16, color: Colors.grey[600]),
Icon(Icons.euro, size: 16, color: iconColor),
SizedBox(width: 8),
Text(
'Budget: ${trip.budget?.toStringAsFixed(2)}',
style: TextStyle(
fontSize: 14,
color: Colors.grey[600],
color: iconColor,
fontWeight: FontWeight.w500,
),
),