scanQR method
Implementation
Future<String?> scanQR({
String? title,
String? cancelButtonText,
Color? primaryColor,
String? scanInstructions,
bool showFlashlight = true,
bool vibrate = true,
ScannerTheme? theme,
}) async {
bool hasPermission = await _checkCameraPermission();
if (!hasPermission) return null;
primaryColor ??= AppColors.primary;
final scannerTheme = theme ??
ScannerTheme(
primaryColor: primaryColor,
scanAreaWidth: 260,
scanAreaHeight: 260,
);
final result = await Get.to<String>(
() => QRScannerScreen(
title: title ?? 'Scan QR Code',
cancelButtonText: cancelButtonText ?? 'Cancel',
scanInstructions:
scanInstructions ?? 'Position the QR code within the frame to scan',
theme: scannerTheme,
showFlashlight: showFlashlight,
vibrate: vibrate,
),
transition: Transition.downToUp,
fullscreenDialog: true,
);
return result;
}