Bon checkpoint + Refactoring
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../../core/constants/colors.dart';
|
||||
import '../../../../domain/entities/user.dart';
|
||||
import '../../data/providers/user_provider.dart';
|
||||
|
||||
/// [UserInfoCard] affiche les informations essentielles de l'utilisateur de manière concise.
|
||||
/// Conçu pour minimiser les répétitions tout en garantissant une expérience utilisateur fluide.
|
||||
class UserInfoCard extends StatelessWidget {
|
||||
final User user;
|
||||
|
||||
@@ -9,38 +13,64 @@ class UserInfoCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("[LOG] Initialisation de UserInfoCard pour l'utilisateur : ${user.userFirstName} ${user.userLastName}");
|
||||
|
||||
return Card(
|
||||
color: AppColors.cardColor,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||
elevation: 2,
|
||||
color: AppColors.cardColor.withOpacity(0.9),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
|
||||
elevation: 5,
|
||||
shadowColor: AppColors.darkPrimary.withOpacity(0.4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 50,
|
||||
backgroundImage: NetworkImage(user.profileImageUrl),
|
||||
backgroundColor: Colors.transparent,
|
||||
TweenAnimationBuilder<double>(
|
||||
duration: const Duration(milliseconds: 600),
|
||||
tween: Tween<double>(begin: 0, end: 1),
|
||||
curve: Curves.elasticOut,
|
||||
builder: (context, scale, child) {
|
||||
return Transform.scale(
|
||||
scale: scale,
|
||||
child: CircleAvatar(
|
||||
radius: 50,
|
||||
backgroundImage: NetworkImage(user.profileImageUrl),
|
||||
backgroundColor: Colors.transparent,
|
||||
onBackgroundImageError: (error, stackTrace) {
|
||||
debugPrint("[ERROR] Erreur de chargement de l'image de profil : $error");
|
||||
},
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.person, size: 50, color: Colors.grey.shade300),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
'${user.userFirstName} ${user.userLastName}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
color: AppColors.accentColor,
|
||||
letterSpacing: 1.2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
user.email,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey[600],
|
||||
decoration: TextDecoration.underline,
|
||||
if (!context.select((UserProvider provider) => provider.isEmailDisplayedElsewhere)) // Afficher seulement si non affiché ailleurs
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
debugPrint("[LOG] Clic sur l'email de l'utilisateur : ${user.email}");
|
||||
},
|
||||
child: Text(
|
||||
user.email,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade300,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppColors.accentColor.withOpacity(0.5),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user