fix: clarifie les libelles de stats et corrige le calcul de l etalement moyen
- score_card: "Pourcentage" -> "Reussite", ajoute "/10" sur la moyenne - grouping_stats: "Diametre" -> "Etalement", direction du decalage en toutes lettres (Droite, Haut-Droite...) au lieu de D/G/H/B - statistics: corrige le bug de priorite (... ?? 0 * 100) qui affichait un etalement moyen errone (~0.9% au lieu de ~90%) - ajoute un bouton d aide reutilisable (MetricInfoButton) expliquant chaque metrique, dont la distinction Precision (distance) / Reussite (score) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
76
lib/core/widgets/metric_info_button.dart
Normal file
76
lib/core/widgets/metric_info_button.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
/// Bouton d'information (ⓘ) qui explique des métriques à l'utilisateur.
|
||||
///
|
||||
/// Affiche une petite icône cliquable ; au clic, une boîte de dialogue
|
||||
/// détaille la signification de chaque statistique de la carte associée.
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Explication d'une métrique : un libellé et sa description.
|
||||
class MetricExplanation {
|
||||
final String label;
|
||||
final String description;
|
||||
|
||||
const MetricExplanation(this.label, this.description);
|
||||
}
|
||||
|
||||
class MetricInfoButton extends StatelessWidget {
|
||||
final String title;
|
||||
final List<MetricExplanation> explanations;
|
||||
|
||||
const MetricInfoButton({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.explanations,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IconButton(
|
||||
icon: Icon(Icons.info_outline, size: 18, color: Colors.grey[500]),
|
||||
visualDensity: VisualDensity.compact,
|
||||
padding: EdgeInsets.zero,
|
||||
constraints: const BoxConstraints(),
|
||||
tooltip: 'À quoi ça correspond ?',
|
||||
onPressed: () => _showInfo(context),
|
||||
);
|
||||
}
|
||||
|
||||
void _showInfo(BuildContext context) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text(title),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final e in explanations)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 14),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
e.label,
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(e.description),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Compris'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user