Simplfy errorBuilder widget with pre-existing localized strings

This commit is contained in:
r4khul 2026-02-10 23:45:06 +05:30
parent 5ebcfac0f0
commit 6d0ed737dd

View file

@ -56,8 +56,8 @@ class _QrCodeScreenState extends State<QrCodeScreen> {
: Icons.flash_off, : Icons.flash_off,
), ),
onPressed: state.torchState == TorchState.unavailable onPressed: state.torchState == TorchState.unavailable
? null ? null
: () => _controller.toggleTorch(), : () => _controller.toggleTorch(),
); );
}, },
), ),
@ -74,23 +74,15 @@ class _QrCodeScreenState extends State<QrCodeScreen> {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
const Icon(Icons.videocam_off_outlined, size: 64), Icon(Icons.videocam_off_outlined, size: 120),
const SizedBox(height: 16), Text(AppLocalizations.of(context)!.disabledValue),
Text( SizedBox(height: 24,),
error.errorCode == MobileScannerErrorCode.permissionDenied FilledButton.tonal(
? "Camera Permission Has Been Denied"
: error.errorDetails?.message ?? "Camera Error",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge,
),
const SizedBox(height: 24),
FilledButton.icon(
onPressed: onPressed:
() => AppSettings.openAppSettings( () => AppSettings.openAppSettings(
type: AppSettingsType.settings, type: AppSettingsType.settings,
), ),
icon: const Icon(Icons.settings), child: Text(AppLocalizations.of(context)!.settingsTitle),
label: Text("Open Settings"),
), ),
], ],
), ),