Refactoring + Checkpoint

This commit is contained in:
DahoudG
2024-11-17 23:00:18 +00:00
parent 1e888f41e8
commit 77ab8a02a2
56 changed files with 1904 additions and 790 deletions

View File

@@ -0,0 +1,98 @@
import 'package:flutter/material.dart';
import '../../../../../core/constants/colors.dart';
/// [EditOptionsCard] permet à l'utilisateur d'accéder aux options d'édition du profil,
/// incluant la modification du profil, la photo et le mot de passe.
/// Les interactions sont entièrement loguées pour une traçabilité complète.
class EditOptionsCard extends StatelessWidget {
const EditOptionsCard({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
debugPrint("[LOG] Initialisation de EditOptionsCard");
return Card(
color: AppColors.cardColor.withOpacity(0.95),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
elevation: 4,
shadowColor: AppColors.darkPrimary.withOpacity(0.3),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_buildOption(
context,
icon: Icons.edit,
label: 'Éditer le profil',
logMessage: "Édition du profil",
onTap: () => debugPrint("[LOG] Édition du profil activée."),
),
_buildDivider(),
_buildOption(
context,
icon: Icons.camera_alt,
label: 'Changer la photo de profil',
logMessage: "Changement de la photo de profil",
onTap: () =>
debugPrint("[LOG] Changement de la photo de profil activé."),
),
_buildDivider(),
_buildOption(
context,
icon: Icons.lock,
label: 'Changer le mot de passe',
logMessage: "Changement du mot de passe",
onTap: () => debugPrint("[LOG] Changement du mot de passe activé."),
),
],
),
);
}
/// Construit chaque option de la carte avec une animation de feedback visuel.
Widget _buildOption(
BuildContext context, {
required IconData icon,
required String label,
required String logMessage,
required VoidCallback onTap,
}) {
return InkWell(
onTap: () {
debugPrint("[LOG] $logMessage");
onTap();
},
splashColor: AppColors.accentColor.withOpacity(0.3),
highlightColor: AppColors.accentColor.withOpacity(0.1),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0),
child: Row(
children: [
Icon(icon, color: AppColors.accentColor),
const SizedBox(width: 16),
Text(
label,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
const Spacer(),
const Icon(Icons.arrow_forward_ios, color: Colors.white, size: 16),
],
),
),
);
}
/// Construit un séparateur entre les options pour une meilleure structure visuelle.
Widget _buildDivider() {
return Divider(
color: Colors.white.withOpacity(0.2),
height: 1,
indent: 16,
endIndent: 16,
);
}
}