fix: retour arriere leger zoom du au 85% crop
This commit is contained in:
@@ -28,6 +28,11 @@ import 'widgets/grouping_stats.dart';
|
||||
|
||||
class AnalysisScreen extends StatelessWidget {
|
||||
final String imagePath;
|
||||
|
||||
/// Image originale (jamais recadrée), transmise pour pouvoir revenir au
|
||||
/// centrage sans recadrer un résultat déjà recadré.
|
||||
final String? originalImagePath;
|
||||
|
||||
final TargetType targetType;
|
||||
final double? initialCenterX;
|
||||
final double? initialCenterY;
|
||||
@@ -38,6 +43,7 @@ class AnalysisScreen extends StatelessWidget {
|
||||
const AnalysisScreen({
|
||||
super.key,
|
||||
required this.imagePath,
|
||||
this.originalImagePath,
|
||||
required this.targetType,
|
||||
this.initialCenterX,
|
||||
this.initialCenterY,
|
||||
@@ -75,6 +81,7 @@ class AnalysisScreen extends StatelessWidget {
|
||||
return p;
|
||||
},
|
||||
child: _AnalysisScreenContent(
|
||||
originalImagePath: originalImagePath ?? imagePath,
|
||||
cropScale: cropScale,
|
||||
cropOffset: cropOffset,
|
||||
cropRotation: cropRotation, // Envoyé à la structure d'affichage
|
||||
@@ -84,11 +91,13 @@ class AnalysisScreen extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _AnalysisScreenContent extends StatefulWidget {
|
||||
final String originalImagePath;
|
||||
final double? cropScale;
|
||||
final Offset? cropOffset;
|
||||
final double? cropRotation;
|
||||
|
||||
const _AnalysisScreenContent({
|
||||
required this.originalImagePath,
|
||||
this.cropScale,
|
||||
this.cropOffset,
|
||||
this.cropRotation,
|
||||
@@ -151,6 +160,22 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Revient au Centrage en repartant de l'image ORIGINALE.
|
||||
/// On ne restaure que la rotation (jamais le zoom) → pas de cumul.
|
||||
void _goBackToCrop(AnalysisProvider provider) {
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CropScreen(
|
||||
imagePath: widget.originalImagePath,
|
||||
originalImagePath: widget.originalImagePath,
|
||||
targetType: provider.targetType!,
|
||||
initialRotation: provider.cropRotation,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<AnalysisProvider>();
|
||||
@@ -172,17 +197,7 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
||||
onPressed: () {
|
||||
if (_isCalibrating) {
|
||||
final provider = context.read<AnalysisProvider>();
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CropScreen(
|
||||
imagePath: provider.imagePath!,
|
||||
targetType: provider.targetType!,
|
||||
initialScale: widget.cropScale,
|
||||
initialOffset: widget.cropOffset,
|
||||
),
|
||||
),
|
||||
);
|
||||
_goBackToCrop(provider);
|
||||
} else {
|
||||
setState(() => _isCalibrating = true);
|
||||
}
|
||||
@@ -698,17 +713,18 @@ class _AnalysisScreenContentState extends State<_AnalysisScreenContent> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
final path = provider.imagePath!;
|
||||
final type = provider.targetType!;
|
||||
|
||||
// Retour au centrage : on repart de l'ORIGINAL (pas de re-crop),
|
||||
// en conservant uniquement la rotation.
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CropScreen(
|
||||
imagePath: path,
|
||||
imagePath: widget.originalImagePath,
|
||||
originalImagePath: widget.originalImagePath,
|
||||
targetType: type,
|
||||
initialScale: widget.cropScale,
|
||||
initialOffset: widget.cropOffset,
|
||||
initialRotation: provider.cropRotation,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user