Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ccb149dda | |||
| 972474750f | |||
| 2f69ff4ecf |
25
CHANGELOG.md
Normal file
25
CHANGELOG.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## [v0.0.1] - 2026-01-29
|
||||||
|
|
||||||
|
### Ajouté
|
||||||
|
- **Interface d'Analyse** :
|
||||||
|
- Implémentation d'un bouton de sauvegarde "Morphing" : le bouton flottant se transforme en un bouton large en bas de page lors du défilement.
|
||||||
|
- Ajout de la gestion du défilement et de l'espacement pour une meilleure ergonomie.
|
||||||
|
- Visualisation des impacts et statistiques de groupement.
|
||||||
|
- **Support Desktop (Windows)** :
|
||||||
|
- Configuration de la base de données SQLite pour fonctionner sur Windows via `sqflite_common_ffi`.
|
||||||
|
- Initialisation conditionnelle selon la plateforme.
|
||||||
|
|
||||||
|
### Corrigé
|
||||||
|
- **Crash Windows** : Résolution du plantage dû à l'initialisation manquante de la factory de base de données FFI.
|
||||||
|
- **Dépendances** : Fixation de la version de `sqflite_common_ffi` à `2.3.3` pour contourner un problème de cache/corruption avec la version `2.4.0+2`.
|
||||||
|
- **UI/UX** :
|
||||||
|
- Correction des débordements de texte ("zebra stripes") dans le bouton de sauvegarde lors de l'animation grâce à `FittedBox`.
|
||||||
|
- Optimisation de l'affichage du titre "Groupement" dans les statistiques pour éviter les dépassements sur petits écrans.
|
||||||
|
- Nettoyage des appels redondants (`super.initState`) et correction de la structure des widgets (`Stack` mal fermé).
|
||||||
|
|
||||||
|
### Historique des Commits
|
||||||
|
- `db7160b` - +désactivation (2026-01-29)
|
||||||
|
- `f1a8eef` - ajout correctif (2026-01-28)
|
||||||
|
- `031d4a4` - premier app version beta (2026-01-18)
|
||||||
40
README.md
40
README.md
@@ -1,17 +1,35 @@
|
|||||||
# bully
|
# Bully - Analyseur de Cible
|
||||||
|
|
||||||
A new Flutter project.
|
Application Flutter multiplateforme pour l'analyse et le suivi de vos séances de tir.
|
||||||
|
|
||||||
## Getting Started
|
## Fonctionnalités Principales
|
||||||
|
|
||||||
This project is a starting point for a Flutter application.
|
* **Capture et Analyse** : Prenez une photo de votre cible et analysez vos impacts.
|
||||||
|
* **Détection Automatique** : Utilise des algorithmes pour détecter automatiquement les impacts de balle sur la cible.
|
||||||
|
* **Calibration** : Outils de calibration précis pour définir la taille et le centre de la cible, assurant des mesures exactes.
|
||||||
|
* **Statistiques Détaillées** :
|
||||||
|
* Calcul du score total.
|
||||||
|
* Analyse du groupement (H+L, diamètre moyen).
|
||||||
|
* Visualisation graphique de la dispersion.
|
||||||
|
* **Historique** : Sauvegardez vos sessions avec des notes et consultez votre progression au fil du temps.
|
||||||
|
* **Interface Intuitive** : Design moderne et fluide, avec un bouton de sauvegarde dynamique qui s'adapte à votre navigation.
|
||||||
|
|
||||||
A few resources to get you started if this is your first Flutter project:
|
## Détails Techniques
|
||||||
|
|
||||||
- [Learn Flutter](https://docs.flutter.dev/get-started/learn-flutter)
|
* **Framework** : Flutter (Compatible Android, iOS, Windows, Linux, macOS).
|
||||||
- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
* **Base de Données** : SQLite (via `sqflite` et `sqflite_common_ffi` pour le support Desktop).
|
||||||
- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources)
|
* **Graphiques** : `fl_chart` pour la visualisation des données.
|
||||||
|
* **Architecture** : Provider pour la gestion d'état.
|
||||||
|
|
||||||
For help getting started with Flutter development, view the
|
## Installation
|
||||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
|
||||||
samples, guidance on mobile development, and a full API reference.
|
1. Assurez-vous d'avoir Flutter installé.
|
||||||
|
2. Clonez le dépôt.
|
||||||
|
3. Installez les dépendances :
|
||||||
|
```bash
|
||||||
|
flutter pub get
|
||||||
|
```
|
||||||
|
4. Lancez l'application :
|
||||||
|
```bash
|
||||||
|
flutter run
|
||||||
|
```
|
||||||
|
|||||||
3
devtools_options.yaml
Normal file
3
devtools_options.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
description: This file stores settings for Dart & Flutter DevTools.
|
||||||
|
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||||
|
extensions:
|
||||||
@@ -80,7 +80,8 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
double get targetCenterY => _targetCenterY;
|
double get targetCenterY => _targetCenterY;
|
||||||
double get targetRadius => _targetRadius;
|
double get targetRadius => _targetRadius;
|
||||||
int get ringCount => _ringCount;
|
int get ringCount => _ringCount;
|
||||||
List<double>? get ringRadii => _ringRadii != null ? List.unmodifiable(_ringRadii!) : null;
|
List<double>? get ringRadii =>
|
||||||
|
_ringRadii != null ? List.unmodifiable(_ringRadii!) : null;
|
||||||
double get imageAspectRatio => _imageAspectRatio;
|
double get imageAspectRatio => _imageAspectRatio;
|
||||||
List<Shot> get shots => List.unmodifiable(_shots);
|
List<Shot> get shots => List.unmodifiable(_shots);
|
||||||
ScoreResult? get scoreResult => _scoreResult;
|
ScoreResult? get scoreResult => _scoreResult;
|
||||||
@@ -97,13 +98,22 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
DistortionParameters? get distortionParams => _distortionParams;
|
DistortionParameters? get distortionParams => _distortionParams;
|
||||||
String? get correctedImagePath => _correctedImagePath;
|
String? get correctedImagePath => _correctedImagePath;
|
||||||
bool get hasDistortion => _distortionParams?.needsCorrection ?? false;
|
bool get hasDistortion => _distortionParams?.needsCorrection ?? false;
|
||||||
|
|
||||||
/// Retourne le chemin de l'image à afficher (corrigée si activée, originale sinon)
|
/// Retourne le chemin de l'image à afficher (corrigée si activée, originale sinon)
|
||||||
String? get displayImagePath => _distortionCorrectionEnabled && _correctedImagePath != null
|
String? get displayImagePath =>
|
||||||
|
_distortionCorrectionEnabled && _correctedImagePath != null
|
||||||
? _correctedImagePath
|
? _correctedImagePath
|
||||||
: _imagePath;
|
: _imagePath;
|
||||||
|
|
||||||
/// Analyze an image
|
/// Analyze an image
|
||||||
Future<void> analyzeImage(String imagePath, TargetType targetType) async {
|
///
|
||||||
|
/// [autoAnalyze] determines if we should run automatic detection immediately.
|
||||||
|
/// If false, only the image is loaded and default target parameters are set.
|
||||||
|
Future<void> analyzeImage(
|
||||||
|
String imagePath,
|
||||||
|
TargetType targetType, {
|
||||||
|
bool autoAnalyze = true,
|
||||||
|
}) async {
|
||||||
_state = AnalysisState.loading;
|
_state = AnalysisState.loading;
|
||||||
_imagePath = imagePath;
|
_imagePath = imagePath;
|
||||||
_targetType = targetType;
|
_targetType = targetType;
|
||||||
@@ -119,6 +129,20 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
_imageAspectRatio = frame.image.width / frame.image.height;
|
_imageAspectRatio = frame.image.width / frame.image.height;
|
||||||
frame.image.dispose();
|
frame.image.dispose();
|
||||||
|
|
||||||
|
if (!autoAnalyze) {
|
||||||
|
// Just setup default values without running detection
|
||||||
|
_targetCenterX = 0.5;
|
||||||
|
_targetCenterY = 0.5;
|
||||||
|
_targetRadius = 0.4;
|
||||||
|
|
||||||
|
// Initialize empty shots list
|
||||||
|
_shots = [];
|
||||||
|
|
||||||
|
_state = AnalysisState.success;
|
||||||
|
notifyListeners();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Detect target and impacts
|
// Detect target and impacts
|
||||||
final result = _detectionService.detectTarget(imagePath, targetType);
|
final result = _detectionService.detectTarget(imagePath, targetType);
|
||||||
|
|
||||||
@@ -162,13 +186,7 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
/// Add a manual shot
|
/// Add a manual shot
|
||||||
void addShot(double x, double y) {
|
void addShot(double x, double y) {
|
||||||
final score = _calculateShotScore(x, y);
|
final score = _calculateShotScore(x, y);
|
||||||
final shot = Shot(
|
final shot = Shot(id: _uuid.v4(), x: x, y: y, score: score, sessionId: '');
|
||||||
id: _uuid.v4(),
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
score: score,
|
|
||||||
sessionId: '',
|
|
||||||
);
|
|
||||||
|
|
||||||
_shots.add(shot);
|
_shots.add(shot);
|
||||||
_recalculateScores();
|
_recalculateScores();
|
||||||
@@ -190,11 +208,7 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
if (index == -1) return;
|
if (index == -1) return;
|
||||||
|
|
||||||
final newScore = _calculateShotScore(newX, newY);
|
final newScore = _calculateShotScore(newX, newY);
|
||||||
_shots[index] = _shots[index].copyWith(
|
_shots[index] = _shots[index].copyWith(x: newX, y: newY, score: newScore);
|
||||||
x: newX,
|
|
||||||
y: newY,
|
|
||||||
score: newScore,
|
|
||||||
);
|
|
||||||
|
|
||||||
_recalculateScores();
|
_recalculateScores();
|
||||||
_recalculateGrouping();
|
_recalculateGrouping();
|
||||||
@@ -334,7 +348,9 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
double tolerance = 2.0,
|
double tolerance = 2.0,
|
||||||
bool clearExisting = false,
|
bool clearExisting = false,
|
||||||
}) async {
|
}) async {
|
||||||
if (_imagePath == null || _targetType == null || _referenceImpacts.length < 2) {
|
if (_imagePath == null ||
|
||||||
|
_targetType == null ||
|
||||||
|
_referenceImpacts.length < 2) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,7 +359,8 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
.map((shot) => ReferenceImpact(x: shot.x, y: shot.y))
|
.map((shot) => ReferenceImpact(x: shot.x, y: shot.y))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
final detectedImpacts = _detectionService.detectImpactsWithOpenCVFromReferences(
|
final detectedImpacts = _detectionService
|
||||||
|
.detectImpactsWithOpenCVFromReferences(
|
||||||
_imagePath!,
|
_imagePath!,
|
||||||
_targetType!,
|
_targetType!,
|
||||||
_targetCenterX,
|
_targetCenterX,
|
||||||
@@ -381,13 +398,7 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
/// Add a reference impact for calibrated detection
|
/// Add a reference impact for calibrated detection
|
||||||
void addReferenceImpact(double x, double y) {
|
void addReferenceImpact(double x, double y) {
|
||||||
final score = _calculateShotScore(x, y);
|
final score = _calculateShotScore(x, y);
|
||||||
final shot = Shot(
|
final shot = Shot(id: _uuid.v4(), x: x, y: y, score: score, sessionId: '');
|
||||||
id: _uuid.v4(),
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
score: score,
|
|
||||||
sessionId: '',
|
|
||||||
);
|
|
||||||
_referenceImpacts.add(shot);
|
_referenceImpacts.add(shot);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@@ -428,7 +439,9 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
double tolerance = 2.0,
|
double tolerance = 2.0,
|
||||||
bool clearExisting = false,
|
bool clearExisting = false,
|
||||||
}) async {
|
}) async {
|
||||||
if (_imagePath == null || _targetType == null || _learnedCharacteristics == null) {
|
if (_imagePath == null ||
|
||||||
|
_targetType == null ||
|
||||||
|
_learnedCharacteristics == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,7 +481,13 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Adjust target position
|
/// Adjust target position
|
||||||
void adjustTargetPosition(double centerX, double centerY, double radius, {int? ringCount, List<double>? ringRadii}) {
|
void adjustTargetPosition(
|
||||||
|
double centerX,
|
||||||
|
double centerY,
|
||||||
|
double radius, {
|
||||||
|
int? ringCount,
|
||||||
|
List<double>? ringRadii,
|
||||||
|
}) {
|
||||||
_targetCenterX = centerX;
|
_targetCenterX = centerX;
|
||||||
_targetCenterY = centerY;
|
_targetCenterY = centerY;
|
||||||
_targetRadius = radius;
|
_targetRadius = radius;
|
||||||
@@ -529,7 +548,6 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* version deux a tester*/
|
/* version deux a tester*/
|
||||||
/// Calcule ET applique la correction pour un feedback immédiat
|
/// Calcule ET applique la correction pour un feedback immédiat
|
||||||
Future<void> calculateAndApplyDistortion() async {
|
Future<void> calculateAndApplyDistortion() async {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class AnalysisScreen extends StatelessWidget {
|
|||||||
scoreCalculatorService: context.read<ScoreCalculatorService>(),
|
scoreCalculatorService: context.read<ScoreCalculatorService>(),
|
||||||
groupingAnalyzerService: context.read<GroupingAnalyzerService>(),
|
groupingAnalyzerService: context.read<GroupingAnalyzerService>(),
|
||||||
sessionRepository: context.read<SessionRepository>(),
|
sessionRepository: context.read<SessionRepository>(),
|
||||||
)..analyzeImage(imagePath, targetType),
|
)..analyzeImage(imagePath, targetType, autoAnalyze: false),
|
||||||
child: const _AnalysisScreenContent(),
|
child: const _AnalysisScreenContent(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,8 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
bool _isFullscreenEditMode = false;
|
bool _isFullscreenEditMode = false;
|
||||||
bool _isAtBottom = false;
|
bool _isAtBottom = false;
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
final TransformationController _transformationController = TransformationController();
|
final TransformationController _transformationController =
|
||||||
|
TransformationController();
|
||||||
final GlobalKey _imageKey = GlobalKey();
|
final GlobalKey _imageKey = GlobalKey();
|
||||||
double _currentZoomScale = 1.0;
|
double _currentZoomScale = 1.0;
|
||||||
|
|
||||||
@@ -72,7 +73,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
void _onScroll() {
|
void _onScroll() {
|
||||||
if (!_scrollController.hasClients) return;
|
if (!_scrollController.hasClients) return;
|
||||||
// Detect if we are near the bottom (within 20 pixels of the specific spacing we added)
|
// Detect if we are near the bottom (within 20 pixels of the specific spacing we added)
|
||||||
final isBottom = _scrollController.position.pixels >= _scrollController.position.maxScrollExtent - 20;
|
final isBottom =
|
||||||
|
_scrollController.position.pixels >=
|
||||||
|
_scrollController.position.maxScrollExtent - 20;
|
||||||
if (isBottom != _isAtBottom) {
|
if (isBottom != _isAtBottom) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_isAtBottom = isBottom;
|
_isAtBottom = isBottom;
|
||||||
@@ -115,13 +118,16 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
actions: [
|
actions: [
|
||||||
Consumer<AnalysisProvider>(
|
Consumer<AnalysisProvider>(
|
||||||
builder: (context, provider, _) {
|
builder: (context, provider, _) {
|
||||||
if (provider.state != AnalysisState.success) return const SizedBox.shrink();
|
if (provider.state != AnalysisState.success)
|
||||||
|
return const SizedBox.shrink();
|
||||||
return IconButton(
|
return IconButton(
|
||||||
icon: Icon(_isCalibrating ? Icons.check : Icons.tune),
|
icon: Icon(_isCalibrating ? Icons.check : Icons.tune),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() => _isCalibrating = !_isCalibrating);
|
setState(() => _isCalibrating = !_isCalibrating);
|
||||||
},
|
},
|
||||||
tooltip: _isCalibrating ? 'Terminer calibration' : 'Calibrer la cible',
|
tooltip: _isCalibrating
|
||||||
|
? 'Terminer calibration'
|
||||||
|
: 'Calibrer la cible',
|
||||||
color: _isCalibrating ? AppTheme.successColor : null,
|
color: _isCalibrating ? AppTheme.successColor : null,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -155,7 +161,11 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.error_outline, size: 64, color: AppTheme.errorColor),
|
Icon(
|
||||||
|
Icons.error_outline,
|
||||||
|
size: 64,
|
||||||
|
color: AppTheme.errorColor,
|
||||||
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
provider.errorMessage ?? 'Une erreur est survenue',
|
provider.errorMessage ?? 'Une erreur est survenue',
|
||||||
@@ -195,7 +205,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
if (_isCalibrating)
|
if (_isCalibrating)
|
||||||
Container(
|
Container(
|
||||||
color: AppTheme.warningColor,
|
color: AppTheme.warningColor,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8,
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
child: const Row(
|
child: const Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.tune, color: Colors.white, size: 20),
|
Icon(Icons.tune, color: Colors.white, size: 20),
|
||||||
@@ -203,7 +216,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Mode Calibration - Ajustez le centre et la taille de la cible',
|
'Mode Calibration - Ajustez le centre et la taille de la cible',
|
||||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -214,21 +230,34 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
if (_isSelectingReferences)
|
if (_isSelectingReferences)
|
||||||
Container(
|
Container(
|
||||||
color: Colors.deepPurple,
|
color: Colors.deepPurple,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8,
|
||||||
|
horizontal: 16,
|
||||||
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.touch_app, color: Colors.white, size: 20),
|
const Icon(
|
||||||
|
Icons.touch_app,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Selectionnez ${provider.referenceImpacts.length}/3-4 impacts de reference',
|
'Selectionnez ${provider.referenceImpacts.length}/3-4 impacts de reference',
|
||||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (provider.referenceImpacts.isNotEmpty)
|
if (provider.referenceImpacts.isNotEmpty)
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => provider.clearReferenceImpacts(),
|
onPressed: () => provider.clearReferenceImpacts(),
|
||||||
child: const Text('Effacer', style: TextStyle(color: Colors.white)),
|
child: const Text(
|
||||||
|
'Effacer',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -238,15 +267,25 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
if (_isCalibrating)
|
if (_isCalibrating)
|
||||||
Container(
|
Container(
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
vertical: 8,
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
// Ring count slider
|
// Ring count slider
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.radio_button_unchecked, color: Colors.white, size: 20),
|
const Icon(
|
||||||
|
Icons.radio_button_unchecked,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
const Text('Anneaux:', style: TextStyle(color: Colors.white)),
|
const Text(
|
||||||
|
'Anneaux:',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Slider(
|
child: Slider(
|
||||||
value: provider.ringCount.toDouble(),
|
value: provider.ringCount.toDouble(),
|
||||||
@@ -266,14 +305,20 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.primaryColor,
|
color: AppTheme.primaryColor,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${provider.ringCount}',
|
'${provider.ringCount}',
|
||||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -281,15 +326,23 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
// Target size slider
|
// Target size slider
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.zoom_out_map, color: Colors.white, size: 20),
|
const Icon(
|
||||||
|
Icons.zoom_out_map,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
const Text('Taille:', style: TextStyle(color: Colors.white)),
|
const Text(
|
||||||
|
'Taille:',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Slider(
|
child: Slider(
|
||||||
value: provider.targetRadius.clamp(0.05, 3.0),
|
value: provider.targetRadius.clamp(0.05, 3.0),
|
||||||
min: 0.05,
|
min: 0.05,
|
||||||
max: 3.0,
|
max: 3.0,
|
||||||
label: '${(provider.targetRadius * 100).toStringAsFixed(0)}%',
|
label:
|
||||||
|
'${(provider.targetRadius * 100).toStringAsFixed(0)}%',
|
||||||
activeColor: AppTheme.warningColor,
|
activeColor: AppTheme.warningColor,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
provider.adjustTargetPosition(
|
provider.adjustTargetPosition(
|
||||||
@@ -302,14 +355,20 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.warningColor,
|
color: AppTheme.warningColor,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'${(provider.targetRadius * 100).toStringAsFixed(0)}%',
|
'${(provider.targetRadius * 100).toStringAsFixed(0)}%',
|
||||||
style: const TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -318,10 +377,17 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
// Distortion correction row
|
// Distortion correction row
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.lens_blur, color: Colors.white, size: 20),
|
const Icon(
|
||||||
|
Icons.lens_blur,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 20,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
const Expanded(
|
const Expanded(
|
||||||
child: Text('Correction distorsion:', style: TextStyle(color: Colors.white)),
|
child: Text(
|
||||||
|
'Correction distorsion:',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (provider.distortionParams == null)
|
if (provider.distortionParams == null)
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
@@ -333,7 +399,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: Colors.blueGrey,
|
backgroundColor: Colors.blueGrey,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else ...[
|
else ...[
|
||||||
@@ -347,21 +416,36 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: AppTheme.primaryColor,
|
backgroundColor: AppTheme.primaryColor,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.check_circle, color: Colors.green, size: 16),
|
const Icon(
|
||||||
|
Icons.check_circle,
|
||||||
|
color: Colors.green,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
const Text('Corrigée', style: TextStyle(color: Colors.green, fontSize: 12)),
|
const Text(
|
||||||
|
'Corrigée',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.green,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Switch(
|
Switch(
|
||||||
value: provider.distortionCorrectionEnabled,
|
value: provider.distortionCorrectionEnabled,
|
||||||
onChanged: (value) => provider.setDistortionCorrectionEnabled(value),
|
onChanged: (value) => provider
|
||||||
activeTrackColor: AppTheme.primaryColor.withValues(alpha: 0.5),
|
.setDistortionCorrectionEnabled(value),
|
||||||
|
activeTrackColor: AppTheme.primaryColor
|
||||||
|
.withValues(alpha: 0.5),
|
||||||
activeThumbColor: AppTheme.primaryColor,
|
activeThumbColor: AppTheme.primaryColor,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -391,8 +475,21 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
initialRingCount: provider.ringCount,
|
initialRingCount: provider.ringCount,
|
||||||
initialRingRadii: provider.ringRadii,
|
initialRingRadii: provider.ringRadii,
|
||||||
targetType: provider.targetType!,
|
targetType: provider.targetType!,
|
||||||
onCalibrationChanged: (centerX, centerY, radius, ringCount, {List<double>? ringRadii}) {
|
onCalibrationChanged:
|
||||||
provider.adjustTargetPosition(centerX, centerY, radius, ringCount: ringCount, ringRadii: ringRadii);
|
(
|
||||||
|
centerX,
|
||||||
|
centerY,
|
||||||
|
radius,
|
||||||
|
ringCount, {
|
||||||
|
List<double>? ringRadii,
|
||||||
|
}) {
|
||||||
|
provider.adjustTargetPosition(
|
||||||
|
centerX,
|
||||||
|
centerY,
|
||||||
|
radius,
|
||||||
|
ringCount: ringCount,
|
||||||
|
ringRadii: ringRadii,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -410,10 +507,18 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
Card(
|
Card(
|
||||||
color: AppTheme.primaryColor.withValues(alpha: 0.1),
|
color: AppTheme.primaryColor.withValues(alpha: 0.1),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(Icons.tune, color: AppTheme.primaryColor),
|
leading: const Icon(
|
||||||
|
Icons.tune,
|
||||||
|
color: AppTheme.primaryColor,
|
||||||
|
),
|
||||||
title: const Text('Calibrer la cible'),
|
title: const Text('Calibrer la cible'),
|
||||||
subtitle: const Text('Ajustez le centre et la taille'),
|
subtitle: const Text(
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
'Ajustez le centre et la taille',
|
||||||
|
),
|
||||||
|
trailing: const Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
size: 16,
|
||||||
|
),
|
||||||
onTap: () => setState(() => _isCalibrating = true),
|
onTap: () => setState(() => _isCalibrating = true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -429,7 +534,8 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
// Grouping stats
|
// Grouping stats
|
||||||
if (provider.groupingResult != null && provider.shotCount > 1)
|
if (provider.groupingResult != null &&
|
||||||
|
provider.shotCount > 1)
|
||||||
GroupingStats(
|
GroupingStats(
|
||||||
groupingResult: provider.groupingResult!,
|
groupingResult: provider.groupingResult!,
|
||||||
targetCenterX: provider.targetCenterX,
|
targetCenterX: provider.targetCenterX,
|
||||||
@@ -446,7 +552,6 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
else
|
else
|
||||||
// Calibration info
|
// Calibration info
|
||||||
Padding(
|
Padding(
|
||||||
@@ -459,7 +564,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
children: [
|
children: [
|
||||||
const Text(
|
const Text(
|
||||||
'Instructions de calibration',
|
'Instructions de calibration',
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
_buildInstructionItem(
|
_buildInstructionItem(
|
||||||
@@ -480,7 +588,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
const Text('Centre: '),
|
const Text('Centre: '),
|
||||||
Text(
|
Text(
|
||||||
'(${(provider.targetCenterX * 100).toStringAsFixed(1)}%, ${(provider.targetCenterY * 100).toStringAsFixed(1)}%)',
|
'(${(provider.targetCenterX * 100).toStringAsFixed(1)}%, ${(provider.targetCenterY * 100).toStringAsFixed(1)}%)',
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -489,7 +599,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
const Text('Rayon: '),
|
const Text('Rayon: '),
|
||||||
Text(
|
Text(
|
||||||
'${(provider.targetRadius * 100).toStringAsFixed(1)}%',
|
'${(provider.targetRadius * 100).toStringAsFixed(1)}%',
|
||||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
style: const TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -506,9 +618,13 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: _isAtBottom ? Alignment.bottomCenter : Alignment.bottomRight,
|
alignment: _isAtBottom
|
||||||
|
? Alignment.bottomCenter
|
||||||
|
: Alignment.bottomRight,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: _isAtBottom ? EdgeInsets.zero : const EdgeInsets.all(16.0),
|
padding: _isAtBottom
|
||||||
|
? EdgeInsets.zero
|
||||||
|
: const EdgeInsets.all(16.0),
|
||||||
child: _isCalibrating
|
child: _isCalibrating
|
||||||
? FloatingActionButton.extended(
|
? FloatingActionButton.extended(
|
||||||
onPressed: () => setState(() => _isCalibrating = false),
|
onPressed: () => setState(() => _isCalibrating = false),
|
||||||
@@ -519,11 +635,15 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
: AnimatedContainer(
|
: AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 260),
|
duration: const Duration(milliseconds: 260),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
width: _isAtBottom ? MediaQuery.of(context).size.width : 180,
|
width: _isAtBottom
|
||||||
|
? MediaQuery.of(context).size.width
|
||||||
|
: 180,
|
||||||
height: 56,
|
height: 56,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: AppTheme.primaryColor,
|
color: AppTheme.primaryColor,
|
||||||
borderRadius: BorderRadius.circular(_isAtBottom ? 0 : 16),
|
borderRadius: BorderRadius.circular(
|
||||||
|
_isAtBottom ? 0 : 16,
|
||||||
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
if (!_isAtBottom)
|
if (!_isAtBottom)
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
@@ -537,9 +657,14 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => _saveSession(context, provider),
|
onTap: () => _saveSession(context, provider),
|
||||||
borderRadius: BorderRadius.circular(_isAtBottom ? 0 : 16),
|
borderRadius: BorderRadius.circular(
|
||||||
|
_isAtBottom ? 0 : 16,
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16),
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 20,
|
||||||
|
vertical: 16,
|
||||||
|
),
|
||||||
child: FittedBox(
|
child: FittedBox(
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -549,11 +674,13 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
const Icon(Icons.save, color: Colors.white),
|
const Icon(Icons.save, color: Colors.white),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
_isAtBottom ? 'SAUVEGARDER LA SESSION' : 'Sauvegarder',
|
_isAtBottom
|
||||||
|
? 'SAUVEGARDER LA SESSION'
|
||||||
|
: 'Sauvegarder',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 16
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -570,7 +697,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildZoomableImageWithOverlay(BuildContext context, AnalysisProvider provider) {
|
Widget _buildZoomableImageWithOverlay(
|
||||||
|
BuildContext context,
|
||||||
|
AnalysisProvider provider,
|
||||||
|
) {
|
||||||
return ClipRect(
|
return ClipRect(
|
||||||
child: Stack(
|
child: Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
@@ -616,11 +746,25 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
groupingCenterX: provider.groupingResult?.centerX,
|
groupingCenterX: provider.groupingResult?.centerX,
|
||||||
groupingCenterY: provider.groupingResult?.centerY,
|
groupingCenterY: provider.groupingResult?.centerY,
|
||||||
groupingDiameter: provider.groupingResult?.diameter,
|
groupingDiameter: provider.groupingResult?.diameter,
|
||||||
referenceImpacts: _isSelectingReferences ? provider.referenceImpacts : null,
|
referenceImpacts: _isSelectingReferences
|
||||||
|
? provider.referenceImpacts
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// Bouton pour effacer les impacts
|
||||||
|
if (provider.shotCount > 0 && !_isSelectingReferences)
|
||||||
|
Positioned(
|
||||||
|
left: 8,
|
||||||
|
bottom: 8,
|
||||||
|
child: FloatingActionButton.small(
|
||||||
|
heroTag: 'clearShots',
|
||||||
|
onPressed: () => _showClearConfirmation(context, provider),
|
||||||
|
backgroundColor: Colors.black54,
|
||||||
|
child: const Icon(Icons.delete, color: Colors.white),
|
||||||
|
),
|
||||||
|
),
|
||||||
// Bouton pour passer en mode plein écran d'édition
|
// Bouton pour passer en mode plein écran d'édition
|
||||||
Positioned(
|
Positioned(
|
||||||
right: 8,
|
right: 8,
|
||||||
@@ -637,7 +781,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFullscreenEditContent(BuildContext context, AnalysisProvider provider) {
|
Widget _buildFullscreenEditContent(
|
||||||
|
BuildContext context,
|
||||||
|
AnalysisProvider provider,
|
||||||
|
) {
|
||||||
return Stack(
|
return Stack(
|
||||||
fit: StackFit.expand,
|
fit: StackFit.expand,
|
||||||
children: [
|
children: [
|
||||||
@@ -672,7 +819,8 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
ringCount: provider.ringCount,
|
ringCount: provider.ringCount,
|
||||||
ringRadii: provider.ringRadii,
|
ringRadii: provider.ringRadii,
|
||||||
zoomScale: _currentZoomScale,
|
zoomScale: _currentZoomScale,
|
||||||
onShotTapped: (shot) => _showShotOptions(context, provider, shot.id),
|
onShotTapped: (shot) =>
|
||||||
|
_showShotOptions(context, provider, shot.id),
|
||||||
onAddShot: (x, y) {
|
onAddShot: (x, y) {
|
||||||
provider.addShot(x, y);
|
provider.addShot(x, y);
|
||||||
},
|
},
|
||||||
@@ -702,12 +850,17 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
const Expanded(
|
const Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Mode édition - Touchez pour ajouter des impacts',
|
'Mode édition - Touchez pour ajouter des impacts',
|
||||||
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${provider.shotCount} impacts',
|
'${provider.shotCount} impacts',
|
||||||
style: TextStyle(color: Colors.white.withValues(alpha: 0.8)),
|
style: TextStyle(
|
||||||
|
color: Colors.white.withValues(alpha: 0.8),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -813,7 +966,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: ElevatedButton.icon(
|
child: ElevatedButton.icon(
|
||||||
onPressed: provider.referenceImpacts.length >= 2
|
onPressed: provider.referenceImpacts.length >= 2
|
||||||
? () => _showCalibratedDetectionDialog(context, provider)
|
? () => _showCalibratedDetectionDialog(
|
||||||
|
context,
|
||||||
|
provider,
|
||||||
|
)
|
||||||
: null,
|
: null,
|
||||||
icon: const Icon(Icons.auto_fix_high),
|
icon: const Icon(Icons.auto_fix_high),
|
||||||
label: const Text('Detecter'),
|
label: const Text('Detecter'),
|
||||||
@@ -864,28 +1020,8 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
// ),
|
// ),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
],
|
],
|
||||||
|
|
||||||
// Manual actions
|
// Manual actions
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: OutlinedButton.icon(
|
|
||||||
onPressed: _isSelectingReferences ? null : () => _showAddShotHint(context),
|
|
||||||
icon: const Icon(Icons.add_circle_outline),
|
|
||||||
label: const Text('Ajouter'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
Expanded(
|
|
||||||
child: OutlinedButton.icon(
|
|
||||||
onPressed: provider.shotCount > 0 && !_isSelectingReferences
|
|
||||||
? () => _showClearConfirmation(context, provider)
|
|
||||||
: null,
|
|
||||||
icon: const Icon(Icons.clear_all),
|
|
||||||
label: const Text('Effacer'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -899,7 +1035,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text('1. Calibrez d\'abord la cible en utilisant le bouton de calibration'),
|
Text(
|
||||||
|
'1. Calibrez d\'abord la cible en utilisant le bouton de calibration',
|
||||||
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
Text('2. Appuyez sur l\'image pour ajouter un impact manuellement'),
|
Text('2. Appuyez sur l\'image pour ajouter un impact manuellement'),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
@@ -918,7 +1056,11 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showShotOptions(BuildContext context, AnalysisProvider provider, String shotId) {
|
void _showShotOptions(
|
||||||
|
BuildContext context,
|
||||||
|
AnalysisProvider provider,
|
||||||
|
String shotId,
|
||||||
|
) {
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => SafeArea(
|
builder: (context) => SafeArea(
|
||||||
@@ -965,7 +1107,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
}
|
}
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: const Text('Effacer', style: TextStyle(color: AppTheme.errorColor)),
|
child: const Text(
|
||||||
|
'Effacer',
|
||||||
|
style: TextStyle(color: AppTheme.errorColor),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -1025,7 +1170,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
// Circularity slider
|
// Circularity slider
|
||||||
Text('Circularite minimum: ${(minCircularity * 100).toStringAsFixed(0)}%'),
|
Text(
|
||||||
|
'Circularite minimum: ${(minCircularity * 100).toStringAsFixed(0)}%',
|
||||||
|
),
|
||||||
Slider(
|
Slider(
|
||||||
value: minCircularity,
|
value: minCircularity,
|
||||||
min: 0.3,
|
min: 0.3,
|
||||||
@@ -1043,7 +1190,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
// Fill ratio slider
|
// Fill ratio slider
|
||||||
Text('Remplissage minimum: ${(minFillRatio * 100).toStringAsFixed(0)}%'),
|
Text(
|
||||||
|
'Remplissage minimum: ${(minFillRatio * 100).toStringAsFixed(0)}%',
|
||||||
|
),
|
||||||
Slider(
|
Slider(
|
||||||
value: minFillRatio,
|
value: minFillRatio,
|
||||||
min: 0.3,
|
min: 0.3,
|
||||||
@@ -1118,7 +1267,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white),
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 12),
|
SizedBox(width: 12),
|
||||||
Text('Detection en cours...'),
|
Text('Detection en cours...'),
|
||||||
@@ -1148,7 +1300,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
? '$count impact(s) detecte(s)'
|
? '$count impact(s) detecte(s)'
|
||||||
: 'Aucun impact detecte. Essayez d\'ajuster les parametres.',
|
: 'Aucun impact detecte. Essayez d\'ajuster les parametres.',
|
||||||
),
|
),
|
||||||
backgroundColor: count > 0 ? AppTheme.successColor : AppTheme.warningColor,
|
backgroundColor: count > 0
|
||||||
|
? AppTheme.successColor
|
||||||
|
: AppTheme.warningColor,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1162,7 +1316,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showCalibratedDetectionDialog(BuildContext context, AnalysisProvider provider) {
|
void _showCalibratedDetectionDialog(
|
||||||
|
BuildContext context,
|
||||||
|
AnalysisProvider provider,
|
||||||
|
) {
|
||||||
double tolerance = 2.0;
|
double tolerance = 2.0;
|
||||||
bool clearExisting = true;
|
bool clearExisting = true;
|
||||||
// NOTE: OpenCV désactivé - problèmes de build Windows
|
// NOTE: OpenCV désactivé - problèmes de build Windows
|
||||||
@@ -1190,7 +1347,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.info_outline, color: Colors.deepPurple),
|
const Icon(
|
||||||
|
Icons.info_outline,
|
||||||
|
color: Colors.deepPurple,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -1262,7 +1422,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white),
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 12),
|
SizedBox(width: 12),
|
||||||
Text('Apprentissage des references...'),
|
Text('Apprentissage des references...'),
|
||||||
@@ -1280,7 +1443,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(
|
const SnackBar(
|
||||||
content: Text('Impossible d\'analyser les references. Essayez de selectionner d\'autres impacts.'),
|
content: Text(
|
||||||
|
'Impossible d\'analyser les references. Essayez de selectionner d\'autres impacts.',
|
||||||
|
),
|
||||||
backgroundColor: AppTheme.errorColor,
|
backgroundColor: AppTheme.errorColor,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -1298,7 +1463,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white),
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 12),
|
SizedBox(width: 12),
|
||||||
Text('Detection en cours...'),
|
Text('Detection en cours...'),
|
||||||
@@ -1331,7 +1499,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
? '$count impact(s) detecte(s) a partir des references'
|
? '$count impact(s) detecte(s) a partir des references'
|
||||||
: 'Aucun impact detecte. Essayez d\'augmenter la tolerance.',
|
: 'Aucun impact detecte. Essayez d\'augmenter la tolerance.',
|
||||||
),
|
),
|
||||||
backgroundColor: count > 0 ? AppTheme.successColor : AppTheme.warningColor,
|
backgroundColor: count > 0
|
||||||
|
? AppTheme.successColor
|
||||||
|
: AppTheme.warningColor,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1354,7 +1524,10 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _saveSession(BuildContext context, AnalysisProvider provider) async {
|
Future<void> _saveSession(
|
||||||
|
BuildContext context,
|
||||||
|
AnalysisProvider provider,
|
||||||
|
) async {
|
||||||
final notesController = TextEditingController();
|
final notesController = TextEditingController();
|
||||||
|
|
||||||
final shouldSave = await showDialog<bool>(
|
final shouldSave = await showDialog<bool>(
|
||||||
@@ -1384,7 +1557,9 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
|||||||
|
|
||||||
if (shouldSave == true) {
|
if (shouldSave == true) {
|
||||||
try {
|
try {
|
||||||
await provider.saveSession(notes: notesController.text.isEmpty ? null : notesController.text);
|
await provider.saveSession(
|
||||||
|
notes: notesController.text.isEmpty ? null : notesController.text,
|
||||||
|
);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
const SnackBar(
|
const SnackBar(
|
||||||
|
|||||||
Reference in New Issue
Block a user