feat(crop): masque opaque à coins droits pour cacher l'extérieur du cadre de découpe

This commit is contained in:
qguillaume
2026-05-26 23:41:06 +02:00
parent 620e12a1fd
commit eabe7511bd

View File

@@ -249,10 +249,10 @@ class _CropScreenState extends State<CropScreen> {
onScaleUpdate: _onScaleUpdate,
child: Stack(
children: [
// 1. L'image brute avec ses transformations
Positioned.fill(
child: Center(
child: Transform(
// TRANSFORMATION GÉOMÉTRIQUE : Conversion des degrés du Slider en Radians
transform: Matrix4.identity()
..setTranslationRaw(_offset.dx, _offset.dy, 0)
..scale(_scale, _scale)
@@ -268,25 +268,23 @@ class _CropScreenState extends State<CropScreen> {
),
),
// LIGNES VERTES PERPENDICULAIRES PROLONGÉES SUR TOUT L'ÉCRAN
// 2. Les lignes vertes de visée prolongées
Positioned.fill(
child: IgnorePointer(
child: Stack(
children: [
// Ligne Horizontale (Prend toute la largeur)
Center(
child: Container(
width: double.infinity, // S'étend sur toute la zone
height: 1.5, // Ligne ultra fine
color: const Color(0xFF00FF00).withOpacity(0.5), // Vert fluo semi-transparent
width: double.infinity,
height: 1.5,
color: const Color(0xFF00FF00).withOpacity(0.6),
),
),
// Ligne Verticale (Prend toute la hauteur)
Center(
child: Container(
width: 1.5,
height: double.infinity, // S'étend sur toute la zone
color: const Color(0xFF00FF00).withOpacity(0.5),
height: double.infinity,
color: const Color(0xFF00FF00).withOpacity(0.6),
),
),
],
@@ -294,6 +292,31 @@ class _CropScreenState extends State<CropScreen> {
),
),
// 3. MASQUE OPAQUE EXTÉRIEUR - COINS DROITS ET CARRÉS
Positioned.fill(
child: IgnorePointer(
child: ColorFiltered(
colorFilter: ColorFilter.mode(
const Color(0xFF101214), // Même couleur que le fond de ton écran
BlendMode.srcOut,
),
child: Stack(
children: [
// Zone visible : Rectangle parfait sans aucun BorderRadius
Center(
child: Container(
width: _cropSize,
height: _cropSize,
color: Colors.black, // Pas de decoration ni de borderRadius ici !
),
),
],
),
),
),
),
// 4. Ton overlay avec les coins blancs
Positioned.fill(
child: IgnorePointer(
child: CropOverlay(cropSize: _cropSize, showGrid: false),