scanBarOrQrCode method

  1. @override
void scanBarOrQrCode({
  1. BuildContext? context,
  2. required dynamic onScanSuccess(
    1. 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);
                }
              }),
            ),
          ));
}