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, onScaleUpdate: _onScaleUpdate,
child: Stack( child: Stack(
children: [ children: [
// 1. L'image brute avec ses transformations
Positioned.fill( Positioned.fill(
child: Center( child: Center(
child: Transform( child: Transform(
// TRANSFORMATION GÉOMÉTRIQUE : Conversion des degrés du Slider en Radians
transform: Matrix4.identity() transform: Matrix4.identity()
..setTranslationRaw(_offset.dx, _offset.dy, 0) ..setTranslationRaw(_offset.dx, _offset.dy, 0)
..scale(_scale, _scale) ..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( Positioned.fill(
child: IgnorePointer( child: IgnorePointer(
child: Stack( child: Stack(
children: [ children: [
// Ligne Horizontale (Prend toute la largeur)
Center( Center(
child: Container( child: Container(
width: double.infinity, // S'étend sur toute la zone width: double.infinity,
height: 1.5, // Ligne ultra fine height: 1.5,
color: const Color(0xFF00FF00).withOpacity(0.5), // Vert fluo semi-transparent color: const Color(0xFF00FF00).withOpacity(0.6),
), ),
), ),
// Ligne Verticale (Prend toute la hauteur)
Center( Center(
child: Container( child: Container(
width: 1.5, width: 1.5,
height: double.infinity, // S'étend sur toute la zone height: double.infinity,
color: const Color(0xFF00FF00).withOpacity(0.5), 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( Positioned.fill(
child: IgnorePointer( child: IgnorePointer(
child: CropOverlay(cropSize: _cropSize, showGrid: false), child: CropOverlay(cropSize: _cropSize, showGrid: false),