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)
|
||||
- [Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Flutter learning resources](https://docs.flutter.dev/reference/learning-resources)
|
||||
* **Framework** : Flutter (Compatible Android, iOS, Windows, Linux, macOS).
|
||||
* **Base de Données** : SQLite (via `sqflite` et `sqflite_common_ffi` pour le support Desktop).
|
||||
* **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
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
## Installation
|
||||
|
||||
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 SessionRepository sessionRepository,
|
||||
DistortionCorrectionService? distortionService,
|
||||
}) : _detectionService = detectionService,
|
||||
_scoreCalculatorService = scoreCalculatorService,
|
||||
_groupingAnalyzerService = groupingAnalyzerService,
|
||||
_sessionRepository = sessionRepository,
|
||||
_distortionService = distortionService ?? DistortionCorrectionService();
|
||||
}) : _detectionService = detectionService,
|
||||
_scoreCalculatorService = scoreCalculatorService,
|
||||
_groupingAnalyzerService = groupingAnalyzerService,
|
||||
_sessionRepository = sessionRepository,
|
||||
_distortionService = distortionService ?? DistortionCorrectionService();
|
||||
|
||||
AnalysisState _state = AnalysisState.initial;
|
||||
String? _errorMessage;
|
||||
@@ -80,7 +80,8 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
double get targetCenterY => _targetCenterY;
|
||||
double get targetRadius => _targetRadius;
|
||||
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;
|
||||
List<Shot> get shots => List.unmodifiable(_shots);
|
||||
ScoreResult? get scoreResult => _scoreResult;
|
||||
@@ -97,13 +98,22 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
DistortionParameters? get distortionParams => _distortionParams;
|
||||
String? get correctedImagePath => _correctedImagePath;
|
||||
bool get hasDistortion => _distortionParams?.needsCorrection ?? false;
|
||||
|
||||
/// 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
|
||||
: _imagePath;
|
||||
|
||||
/// 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;
|
||||
_imagePath = imagePath;
|
||||
_targetType = targetType;
|
||||
@@ -119,6 +129,20 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
_imageAspectRatio = frame.image.width / frame.image.height;
|
||||
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
|
||||
final result = _detectionService.detectTarget(imagePath, targetType);
|
||||
|
||||
@@ -162,13 +186,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
/// Add a manual shot
|
||||
void addShot(double x, double y) {
|
||||
final score = _calculateShotScore(x, y);
|
||||
final shot = Shot(
|
||||
id: _uuid.v4(),
|
||||
x: x,
|
||||
y: y,
|
||||
score: score,
|
||||
sessionId: '',
|
||||
);
|
||||
final shot = Shot(id: _uuid.v4(), x: x, y: y, score: score, sessionId: '');
|
||||
|
||||
_shots.add(shot);
|
||||
_recalculateScores();
|
||||
@@ -190,11 +208,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
if (index == -1) return;
|
||||
|
||||
final newScore = _calculateShotScore(newX, newY);
|
||||
_shots[index] = _shots[index].copyWith(
|
||||
x: newX,
|
||||
y: newY,
|
||||
score: newScore,
|
||||
);
|
||||
_shots[index] = _shots[index].copyWith(x: newX, y: newY, score: newScore);
|
||||
|
||||
_recalculateScores();
|
||||
_recalculateGrouping();
|
||||
@@ -334,7 +348,9 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
double tolerance = 2.0,
|
||||
bool clearExisting = false,
|
||||
}) async {
|
||||
if (_imagePath == null || _targetType == null || _referenceImpacts.length < 2) {
|
||||
if (_imagePath == null ||
|
||||
_targetType == null ||
|
||||
_referenceImpacts.length < 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -343,16 +359,17 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
.map((shot) => ReferenceImpact(x: shot.x, y: shot.y))
|
||||
.toList();
|
||||
|
||||
final detectedImpacts = _detectionService.detectImpactsWithOpenCVFromReferences(
|
||||
_imagePath!,
|
||||
_targetType!,
|
||||
_targetCenterX,
|
||||
_targetCenterY,
|
||||
_targetRadius,
|
||||
_ringCount,
|
||||
references,
|
||||
tolerance: tolerance,
|
||||
);
|
||||
final detectedImpacts = _detectionService
|
||||
.detectImpactsWithOpenCVFromReferences(
|
||||
_imagePath!,
|
||||
_targetType!,
|
||||
_targetCenterX,
|
||||
_targetCenterY,
|
||||
_targetRadius,
|
||||
_ringCount,
|
||||
references,
|
||||
tolerance: tolerance,
|
||||
);
|
||||
|
||||
if (clearExisting) {
|
||||
_shots.clear();
|
||||
@@ -381,13 +398,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
/// Add a reference impact for calibrated detection
|
||||
void addReferenceImpact(double x, double y) {
|
||||
final score = _calculateShotScore(x, y);
|
||||
final shot = Shot(
|
||||
id: _uuid.v4(),
|
||||
x: x,
|
||||
y: y,
|
||||
score: score,
|
||||
sessionId: '',
|
||||
);
|
||||
final shot = Shot(id: _uuid.v4(), x: x, y: y, score: score, sessionId: '');
|
||||
_referenceImpacts.add(shot);
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -428,7 +439,9 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
double tolerance = 2.0,
|
||||
bool clearExisting = false,
|
||||
}) async {
|
||||
if (_imagePath == null || _targetType == null || _learnedCharacteristics == null) {
|
||||
if (_imagePath == null ||
|
||||
_targetType == null ||
|
||||
_learnedCharacteristics == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -468,7 +481,13 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
/// 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;
|
||||
_targetCenterY = centerY;
|
||||
_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
|
||||
Future<void> calculateAndApplyDistortion() async {
|
||||
// 1. Calcul des paramètres (votre code actuel)
|
||||
@@ -540,11 +558,11 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
targetRadius: _targetRadius,
|
||||
imageAspectRatio: _imageAspectRatio,
|
||||
);
|
||||
|
||||
|
||||
// 2. Vérification si une correction est réellement nécessaire
|
||||
if (_distortionParams != null && _distortionParams!.needsCorrection) {
|
||||
// 3. Application immédiate de la transformation (méthode asynchrone)
|
||||
await applyDistortionCorrection();
|
||||
await applyDistortionCorrection();
|
||||
} else {
|
||||
notifyListeners(); // On prévient quand même si pas de correction
|
||||
}
|
||||
@@ -566,7 +584,7 @@ class AnalysisProvider extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
/* fin section deux a tester*/
|
||||
/* fin section deux a tester*/
|
||||
|
||||
int _calculateShotScore(double x, double y) {
|
||||
if (_targetType == TargetType.concentric) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -148,21 +148,27 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
Text(
|
||||
'Statistiques',
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
// --- BOUTON SESSIONS (Redirige vers Statistiques) ---
|
||||
Expanded(
|
||||
child: StatsCard(
|
||||
icon: Icons.assessment,
|
||||
title: 'Sessions',
|
||||
value: '${_stats!['totalSessions']}',
|
||||
color: AppTheme.primaryColor,
|
||||
child: InkWell(
|
||||
onTap: () => _navigateToStatistics(context),
|
||||
borderRadius: BorderRadius.circular(AppConstants.borderRadius),
|
||||
child: StatsCard(
|
||||
icon: Icons.assessment,
|
||||
title: 'Sessions',
|
||||
value: '${_stats!['totalSessions']}',
|
||||
color: AppTheme.primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// Ce bouton reste statique (ou tu peux ajouter une action)
|
||||
Expanded(
|
||||
child: StatsCard(
|
||||
icon: Icons.gps_fixed,
|
||||
@@ -176,15 +182,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
// --- BOUTON SCORE MOYEN (Redirige vers Historique) ---
|
||||
Expanded(
|
||||
child: StatsCard(
|
||||
icon: Icons.trending_up,
|
||||
title: 'Score Moyen',
|
||||
value: (_stats!['averageScore'] as double).toStringAsFixed(1),
|
||||
color: AppTheme.warningColor,
|
||||
child: InkWell(
|
||||
onTap: () => _navigateToHistory(context),
|
||||
borderRadius: BorderRadius.circular(AppConstants.borderRadius),
|
||||
child: StatsCard(
|
||||
icon: Icons.trending_up,
|
||||
title: 'Historique',
|
||||
value: (_stats!['averageScore'] as double).toStringAsFixed(1),
|
||||
color: AppTheme.warningColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
// Ce bouton reste statique
|
||||
Expanded(
|
||||
child: StatsCard(
|
||||
icon: Icons.emoji_events,
|
||||
|
||||
Reference in New Issue
Block a user