scanBarOrQrCode method
void
scanBarOrQrCode({
- BuildContext? context,
- required dynamic onScanSuccess(
- String? code
override
Implementation
@override
void scanBarOrQrCode(
{BuildContext? context, required Function(String? code) onScanSuccess}) {
/// context is required to show alert in non-web platforms
assert(context != null);
showDialog(
context: context!,
builder: (context) => Container(
alignment: Alignment.center,
child: Container(
height: 400,
width: 600,
margin: const EdgeInsets.all(20),
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: ScannerWidget(onScanSuccess: (code) {
if (code != null) {
Navigator.pop(context);
onScanSuccess(code);
}
}),
),
));
}