48 lines
1.2 KiB
Dart
48 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class FingerprintGuidePainter extends CustomPainter {
|
|
final bool isGoodQuality;
|
|
|
|
FingerprintGuidePainter({required this.isGoodQuality});
|
|
|
|
@override
|
|
void paint(Canvas canvas, Size size) {
|
|
final paint = Paint()
|
|
..color = isGoodQuality ? Colors.greenAccent : Colors.redAccent
|
|
..style = PaintingStyle.stroke
|
|
..strokeWidth = 4.0;
|
|
|
|
final width = size.width;
|
|
final height = size.height;
|
|
|
|
// Draw a rounded rectangle in the center
|
|
final rectWidth = 200.0;
|
|
final rectHeight = 250.0;
|
|
|
|
final rect = RRect.fromRectAndRadius(
|
|
Rect.fromCenter(
|
|
center: Offset(width / 2, height / 2),
|
|
width: rectWidth,
|
|
height: rectHeight,
|
|
),
|
|
const Radius.circular(20),
|
|
);
|
|
|
|
canvas.drawRRect(rect, paint);
|
|
|
|
// Optional: Draw semi-transparent fill
|
|
final fillPaint = Paint()
|
|
..color = (isGoodQuality ? Colors.green : Colors.red).withValues(
|
|
alpha: 0.1,
|
|
)
|
|
..style = PaintingStyle.fill;
|
|
|
|
canvas.drawRRect(rect, fillPaint);
|
|
}
|
|
|
|
@override
|
|
bool shouldRepaint(covariant FingerprintGuidePainter oldDelegate) {
|
|
return oldDelegate.isGoodQuality != isGoodQuality;
|
|
}
|
|
}
|