Refactoring + Version améliorée
This commit is contained in:
85
lib/presentation/widgets/event_menu.dart
Normal file
85
lib/presentation/widgets/event_menu.dart
Normal file
@@ -0,0 +1,85 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void showEventOptions(BuildContext context, GlobalKey key) {
|
||||
final RenderBox renderBox = key.currentContext!.findRenderObject() as RenderBox;
|
||||
final Offset offset = renderBox.localToGlobal(Offset.zero);
|
||||
final RelativeRect position = RelativeRect.fromLTRB(
|
||||
offset.dx,
|
||||
offset.dy,
|
||||
offset.dx + renderBox.size.width,
|
||||
offset.dy + renderBox.size.height,
|
||||
);
|
||||
|
||||
showMenu(
|
||||
context: context,
|
||||
position: position,
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
value: 'details',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline, color: Colors.blue.shade400, size: 18), // Icône plus petite et bleue
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'Voir les détails',
|
||||
style: TextStyle(
|
||||
color: Colors.blue.shade700, // Texte bleu foncé
|
||||
fontWeight: FontWeight.w500, // Poids de police plus fin
|
||||
fontSize: 14, // Taille légèrement réduite
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'edit',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.edit, color: Colors.orange.shade400, size: 18),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'Modifier l\'événement',
|
||||
style: TextStyle(
|
||||
color: Colors.orange.shade700,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'delete',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.delete_outline, color: Colors.red.shade400, size: 18),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'Supprimer l\'événement',
|
||||
style: TextStyle(
|
||||
color: Colors.red.shade700,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
elevation: 5.0, // Réduction de l'élévation pour une ombre plus subtile
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0), // Ajout de bordures arrondies
|
||||
side: BorderSide(color: Colors.grey.shade300), // Bordure fine et douce
|
||||
),
|
||||
color: Colors.white, // Fond blanc pur pour un contraste élégant
|
||||
).then((value) {
|
||||
// Gérer les actions en fonction de la sélection
|
||||
if (value == 'details') {
|
||||
print('Voir les détails');
|
||||
} else if (value == 'edit') {
|
||||
print('Modifier l\'événement');
|
||||
} else if (value == 'delete') {
|
||||
print('Supprimer l\'événement');
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user