Refactoring - Version OK
This commit is contained in:
@@ -301,16 +301,21 @@ class EventDetailPage extends StatelessWidget {
|
||||
evenement.participantsActuels;
|
||||
final isComplet = placesRestantes <= 0 && evenement.maxParticipants != null;
|
||||
|
||||
return FloatingActionButton.extended(
|
||||
onPressed: (isInscrit || !isComplet)
|
||||
? () => _showInscriptionDialog(context, isInscrit)
|
||||
: null,
|
||||
backgroundColor: isInscrit ? Colors.red : const Color(0xFF3B82F6),
|
||||
icon: Icon(isInscrit ? Icons.cancel : Icons.check),
|
||||
label: Text(
|
||||
isInscrit ? 'Se désinscrire' : (isComplet ? 'Complet' : 'S\'inscrire'),
|
||||
),
|
||||
);
|
||||
if (!isComplet) {
|
||||
return FloatingActionButton.extended(
|
||||
onPressed: () => _showInscriptionDialog(context, isInscrit),
|
||||
backgroundColor: const Color(0xFF3B82F6),
|
||||
icon: const Icon(Icons.check),
|
||||
label: const Text('S\'inscrire'),
|
||||
);
|
||||
} else {
|
||||
return const FloatingActionButton.extended(
|
||||
onPressed: null,
|
||||
backgroundColor: Colors.grey,
|
||||
icon: Icon(Icons.block),
|
||||
label: Text('Complet'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _showInscriptionDialog(BuildContext context, bool isInscrit) {
|
||||
|
||||
Reference in New Issue
Block a user