mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-13 19:52:20 -04:00
scanning
This commit is contained in:
parent
e5f1619c65
commit
752392c02e
39 changed files with 1025 additions and 435 deletions
51
lib/tools/scanner_error_widget.dart
Normal file
51
lib/tools/scanner_error_widget.dart
Normal file
|
@ -0,0 +1,51 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
|
||||
class ScannerErrorWidget extends StatelessWidget {
|
||||
const ScannerErrorWidget({Key? key, required this.error}) : super(key: key);
|
||||
|
||||
final MobileScannerException error;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String errorMessage;
|
||||
|
||||
switch (error.errorCode) {
|
||||
case MobileScannerErrorCode.controllerUninitialized:
|
||||
errorMessage = 'Controller not ready.';
|
||||
break;
|
||||
case MobileScannerErrorCode.permissionDenied:
|
||||
errorMessage = 'Permission denied';
|
||||
break;
|
||||
case MobileScannerErrorCode.unsupported:
|
||||
errorMessage = 'Scanning is unsupported on this device';
|
||||
break;
|
||||
default:
|
||||
errorMessage = 'Generic Error';
|
||||
break;
|
||||
}
|
||||
|
||||
return ColoredBox(
|
||||
color: Colors.black,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 16),
|
||||
child: Icon(Icons.error, color: Colors.white),
|
||||
),
|
||||
Text(
|
||||
errorMessage,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
Text(
|
||||
error.errorDetails?.message ?? '',
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -8,3 +8,4 @@ export 'secret_crypto.dart';
|
|||
export 'state_logger.dart';
|
||||
export 'theme_service.dart';
|
||||
export 'widget_helpers.dart';
|
||||
export 'scanner_error_widget.dart';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue