Files
buzz/mobile/lib/features/pairing/pairing_qr_scanner/scanner_camera.dart
klopez4212 bb445d3cf1 Add adaptive community QR scanner (#2739)
## Summary
- Expand the pairing scanner from the Dynamic Island on supported
iPhones
- Reveal the camera behind the pairing UI on Android and standard
iPhones
- Preserve tap-to-dismiss and reduced-motion behavior

## Testing
- `just mobile-check`
- `just mobile-test`
- iOS `RunnerTests`
2026-07-24 16:22:43 -07:00

54 lines
1.7 KiB
Dart

part of '../pairing_qr_scanner.dart';
class _QrScannerCamera extends StatelessWidget {
const _QrScannerCamera({required this.controller, required this.onDetect});
final MobileScannerController controller;
final ValueChanged<BarcodeCapture> onDetect;
@override
Widget build(BuildContext context) {
return MobileScanner(
controller: controller,
fit: BoxFit.cover,
errorBuilder: (context, error) {
final message = switch (error.errorCode) {
MobileScannerErrorCode.permissionDenied =>
'Camera permission is required to scan QR codes.\n\n'
'Please grant camera access in your device settings.',
_ =>
'Could not start camera: '
"${error.errorDetails?.message ?? 'unknown error'}",
};
return ColoredBox(
color: Colors.black,
child: Center(
child: Padding(
padding: const EdgeInsets.all(Grid.sm),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
LucideIcons.cameraOff,
size: 48,
color: Colors.white.withValues(alpha: 0.72),
),
const SizedBox(height: Grid.xs),
Text(
message,
textAlign: TextAlign.center,
style: context.textTheme.bodyMedium?.copyWith(
color: Colors.white.withValues(alpha: 0.72),
),
),
],
),
),
),
);
},
onDetect: onDetect,
);
}
}