feat: refonte des statistiques (00C) et correction ergonomique de la capture (10C)

This commit is contained in:
qguillaume
2026-05-06 22:39:30 +02:00
parent d98f54cf93
commit db6dd0cee5
4 changed files with 264 additions and 690 deletions

View File

@@ -20,11 +20,11 @@ class CaptureScreen extends StatefulWidget {
class _CaptureScreenState extends State<CaptureScreen> {
final ImagePicker _picker = ImagePicker();
TargetType _selectedType = TargetType.concentric;
final TargetType _selectedType = TargetType.concentric;
String? _selectedImagePath;
bool _isLoading = false;
/// Gère la demande de permission et la sélection d'image
/// Gère la demande de permission et la sélection d'image depuis la galerie
Future<void> _handleGallerySelection() async {
PermissionStatus status;
@@ -32,7 +32,6 @@ class _CaptureScreenState extends State<CaptureScreen> {
final deviceInfo = DeviceInfoPlugin();
final androidInfo = await deviceInfo.androidInfo;
// Android 13+ (SDK 33) utilise .photos, les versions précédentes utilisent .storage
if (androidInfo.version.sdkInt >= 33) {
status = await Permission.photos.request();
} else {
@@ -106,9 +105,7 @@ class _CaptureScreenState extends State<CaptureScreen> {
child: ImageSourceButton(
icon: Icons.photo_library,
label: 'Galerie',
onPressed: _isLoading
? null
: _handleGallerySelection, // Appelle la nouvelle fonction
onPressed: _isLoading ? null : _handleGallerySelection,
),
),
],
@@ -126,21 +123,44 @@ class _CaptureScreenState extends State<CaptureScreen> {
_buildImagePreview()
else
_buildGuide(),
// --- NOUVEAU BOUTON VALIDER ---
if (_selectedImagePath != null && !_isLoading) ...[
const SizedBox(height: 24),
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF112233), // Ton bleu foncé
foregroundColor: Colors.white,
minimumSize: const Size(double.infinity, 54),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
elevation: 0,
),
onPressed: _analyzeImage,
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'Valider',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(width: 12),
Icon(Icons.arrow_forward, size: 20),
],
),
),
const SizedBox(height: 32),
],
],
),
),
floatingActionButton: _selectedImagePath != null
? FloatingActionButton.extended(
onPressed: _analyzeImage,
icon: const Icon(Icons.arrow_forward),
label: const Text('Suivant'),
)
: null,
);
}
// Tes widgets _buildSectionTitle, _buildImagePreview, _buildFramingHints restent identiques
Widget _buildSectionTitle(String title) {
return Text(
title,
@@ -230,7 +250,7 @@ class _CaptureScreenState extends State<CaptureScreen> {
_buildGuideItem(Icons.blur_off, 'Évitez les images floues'),
_buildGuideItem(
Icons.cleaning_services,
'Nettoyer votre objectif avec une chiffonnette pour lunette si nécessaire',
'Nettoyer votre objectif avec une chiffonnette',
),
],
),
@@ -251,8 +271,6 @@ class _CaptureScreenState extends State<CaptureScreen> {
);
}
// --- LOGIQUE DE CAPTURE ---
Future<void> _scanDocument() async {
setState(() => _isLoading = true);
try {