afinas-em / qr-bar-code-scanner-dialog

Plugin to scan Bar/QR code easily with Flutter.
Apache License 2.0
9 stars 21 forks source link

Working on Long press on small screen but not ontap. #3

Open hs-dev1 opened 2 years ago

hs-dev1 commented 2 years ago

_qrBarCodeScannerDialogPlugin.getScannedQrBarCode(); it is working fine on large screens, but when I open it on small screens and mobile, it works on long Press to open dialog rather than on tap.

My on Tap function:

onTap: () { _qrBarCodeScannerDialogPlugin.getScannedQrBarCode( context: context, onCode: (code) { setState(() { this.qrCode = code!; }); if (qrCode != '') { showDialog( context: context, builder: (context) { return Container( color: R.colors.white, child: AppLoader(), ); }) .then((value) => context.go('/homeView/menuView')); } }); },

Raviteja11122 commented 1 year ago

same here. @mhussnainshabbir did you solved this issue

UsamaSarwar commented 3 months ago

This worked in my case...

final _qrBarCodeScannerDialogPlugin = QrBarCodeScannerDialog();
String? scanQRCode(context) {
    String? result;
    Future.delayed(const Duration(milliseconds: 1), () async {
      _qrBarCodeScannerDialogPlugin.getScannedQrBarCode(
          context: context,
          onCode: (code) async {
            if (code == null) {
              return null;
            }
            if (kIsWeb) {
              result = code.substring(15);
            } else {
              result = code;
            }
            return result;
          });
    });
    return null;
  }

CC: @hs-dev1 @Raviteja11122