ajout correction de distotion d'image

This commit is contained in:
2026-01-18 21:32:42 +01:00
parent 6b0cb8f837
commit f1a8eefdc3
3 changed files with 543 additions and 3 deletions

View File

@@ -316,6 +316,61 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
),
],
),
const Divider(color: Colors.white24, height: 16),
// Distortion correction row
Row(
children: [
const Icon(Icons.lens_blur, color: Colors.white, size: 20),
const SizedBox(width: 8),
const Expanded(
child: Text('Correction distorsion:', style: TextStyle(color: Colors.white)),
),
if (provider.distortionParams == null)
ElevatedButton.icon(
onPressed: () {
provider.calculateDistortion();
},
icon: const Icon(Icons.calculate, size: 16),
label: const Text('Calculer'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blueGrey,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
),
)
else ...[
if (provider.correctedImagePath == null)
ElevatedButton.icon(
onPressed: () {
provider.applyDistortionCorrection();
},
icon: const Icon(Icons.auto_fix_high, size: 16),
label: const Text('Appliquer'),
style: ElevatedButton.styleFrom(
backgroundColor: AppTheme.primaryColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
),
)
else
Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.check_circle, color: Colors.green, size: 16),
const SizedBox(width: 4),
const Text('Corrigée', style: TextStyle(color: Colors.green, fontSize: 12)),
const SizedBox(width: 8),
Switch(
value: provider.distortionCorrectionEnabled,
onChanged: (value) => provider.setDistortionCorrectionEnabled(value),
activeTrackColor: AppTheme.primaryColor.withValues(alpha: 0.5),
activeThumbColor: AppTheme.primaryColor,
),
],
),
],
],
),
],
),
),
@@ -465,7 +520,7 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
fit: StackFit.expand,
children: [
Image.file(
File(provider.imagePath!),
File(provider.displayImagePath!),
fit: BoxFit.fill,
key: _imageKey,
),
@@ -534,7 +589,7 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
fit: StackFit.expand,
children: [
Image.file(
File(provider.imagePath!),
File(provider.displayImagePath!),
fit: BoxFit.fill,
key: _imageKey,
),