Compare commits
4 Commits
v0.0.1
...
feature/re
| Author | SHA1 | Date | |
|---|---|---|---|
| 91fcd931e8 | |||
| 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:
|
||||||
@@ -34,11 +34,11 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
required GroupingAnalyzerService groupingAnalyzerService,
|
required GroupingAnalyzerService groupingAnalyzerService,
|
||||||
required SessionRepository sessionRepository,
|
required SessionRepository sessionRepository,
|
||||||
DistortionCorrectionService? distortionService,
|
DistortionCorrectionService? distortionService,
|
||||||
}) : _detectionService = detectionService,
|
}) : _detectionService = detectionService,
|
||||||
_scoreCalculatorService = scoreCalculatorService,
|
_scoreCalculatorService = scoreCalculatorService,
|
||||||
_groupingAnalyzerService = groupingAnalyzerService,
|
_groupingAnalyzerService = groupingAnalyzerService,
|
||||||
_sessionRepository = sessionRepository,
|
_sessionRepository = sessionRepository,
|
||||||
_distortionService = distortionService ?? DistortionCorrectionService();
|
_distortionService = distortionService ?? DistortionCorrectionService();
|
||||||
|
|
||||||
AnalysisState _state = AnalysisState.initial;
|
AnalysisState _state = AnalysisState.initial;
|
||||||
String? _errorMessage;
|
String? _errorMessage;
|
||||||
@@ -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,16 +359,17 @@ 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
|
||||||
_imagePath!,
|
.detectImpactsWithOpenCVFromReferences(
|
||||||
_targetType!,
|
_imagePath!,
|
||||||
_targetCenterX,
|
_targetType!,
|
||||||
_targetCenterY,
|
_targetCenterX,
|
||||||
_targetRadius,
|
_targetCenterY,
|
||||||
_ringCount,
|
_targetRadius,
|
||||||
references,
|
_ringCount,
|
||||||
tolerance: tolerance,
|
references,
|
||||||
);
|
tolerance: tolerance,
|
||||||
|
);
|
||||||
|
|
||||||
if (clearExisting) {
|
if (clearExisting) {
|
||||||
_shots.clear();
|
_shots.clear();
|
||||||
@@ -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,8 +548,7 @@ 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 {
|
||||||
// 1. Calcul des paramètres (votre code actuel)
|
// 1. Calcul des paramètres (votre code actuel)
|
||||||
@@ -540,11 +558,11 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
targetRadius: _targetRadius,
|
targetRadius: _targetRadius,
|
||||||
imageAspectRatio: _imageAspectRatio,
|
imageAspectRatio: _imageAspectRatio,
|
||||||
);
|
);
|
||||||
|
|
||||||
// 2. Vérification si une correction est réellement nécessaire
|
// 2. Vérification si une correction est réellement nécessaire
|
||||||
if (_distortionParams != null && _distortionParams!.needsCorrection) {
|
if (_distortionParams != null && _distortionParams!.needsCorrection) {
|
||||||
// 3. Application immédiate de la transformation (méthode asynchrone)
|
// 3. Application immédiate de la transformation (méthode asynchrone)
|
||||||
await applyDistortionCorrection();
|
await applyDistortionCorrection();
|
||||||
} else {
|
} else {
|
||||||
notifyListeners(); // On prévient quand même si pas de correction
|
notifyListeners(); // On prévient quand même si pas de correction
|
||||||
}
|
}
|
||||||
@@ -566,7 +584,7 @@ class AnalysisProvider extends ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* fin section deux a tester*/
|
/* fin section deux a tester*/
|
||||||
|
|
||||||
int _calculateShotScore(double x, double y) {
|
int _calculateShotScore(double x, double y) {
|
||||||
if (_targetType == TargetType.concentric) {
|
if (_targetType == TargetType.concentric) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -148,21 +148,27 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
Text(
|
Text(
|
||||||
'Statistiques',
|
'Statistiques',
|
||||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
// --- BOUTON SESSIONS (Redirige vers Statistiques) ---
|
||||||
Expanded(
|
Expanded(
|
||||||
child: StatsCard(
|
child: InkWell(
|
||||||
icon: Icons.assessment,
|
onTap: () => _navigateToStatistics(context),
|
||||||
title: 'Sessions',
|
borderRadius: BorderRadius.circular(AppConstants.borderRadius),
|
||||||
value: '${_stats!['totalSessions']}',
|
child: StatsCard(
|
||||||
color: AppTheme.primaryColor,
|
icon: Icons.assessment,
|
||||||
|
title: 'Sessions',
|
||||||
|
value: '${_stats!['totalSessions']}',
|
||||||
|
color: AppTheme.primaryColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
// Ce bouton reste statique (ou tu peux ajouter une action)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: StatsCard(
|
child: StatsCard(
|
||||||
icon: Icons.gps_fixed,
|
icon: Icons.gps_fixed,
|
||||||
@@ -176,15 +182,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
// --- BOUTON SCORE MOYEN (Redirige vers Historique) ---
|
||||||
Expanded(
|
Expanded(
|
||||||
child: StatsCard(
|
child: InkWell(
|
||||||
icon: Icons.trending_up,
|
onTap: () => _navigateToHistory(context),
|
||||||
title: 'Score Moyen',
|
borderRadius: BorderRadius.circular(AppConstants.borderRadius),
|
||||||
value: (_stats!['averageScore'] as double).toStringAsFixed(1),
|
child: StatsCard(
|
||||||
color: AppTheme.warningColor,
|
icon: Icons.trending_up,
|
||||||
|
title: 'Historique',
|
||||||
|
value: (_stats!['averageScore'] as double).toStringAsFixed(1),
|
||||||
|
color: AppTheme.warningColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
|
// Ce bouton reste statique
|
||||||
Expanded(
|
Expanded(
|
||||||
child: StatsCard(
|
child: StatsCard(
|
||||||
icon: Icons.emoji_events,
|
icon: Icons.emoji_events,
|
||||||
|
|||||||
Reference in New Issue
Block a user