app_qrcode_scanner 0.0.2 copy "app_qrcode_scanner: ^0.0.2" to clipboard
app_qrcode_scanner: ^0.0.2 copied to clipboard

QRCode Scanner with camera scanner and photo scanner function. Available in both Android and iOS Device. Forked from qr_code_scanner

app_qrcode_scanner #

app_qrcode_scanner is a plugin for application to scan QRCode using camera or images from their device photo library.

This plugin is forked from qr_code_scanner

Installation #

iOS #

Camera and Photo library usage description area required. Add the following lines into your Info.plist file to do so.

<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan QR codes</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs photo library access to scan QR codes from image</string>

Android #

For API 29+ Add the following lines into AndroidManifest.xml, which is required in Android Q since this attribute default value is false

android:requestLegacyExternalStorage="true"

Usage #

Call tryOpenScanner with context will prompt a camera modal for QRCode scanning

import 'package:app_qrcode_scanner/app_qrcode_scanner.dart';

Widget build(BuildContext context) {
  return Scaffold(
    body: Column(
      children: [
        onPressed: () async {
          /// await QRCode content as [String]
          String result = await tryOpenScanner(context);
        }
      ]
    )
  );
}

Permission #

You may want to check the camera and photo library usage permission before launching the QRCode scanner You can customize the soft launch permission modal by create custom class extends [CustomModal]

import 'package:app_qrcode_scanner/app_qrcode_scanner.dart';

/// Get permission using another plugin: permission_handler
var camStatus = await Permission.camera.status;
var photoStatus = await Permission.photos.status;

var camPerm = camStatus.isUndetermined ? null : camStatus.isGranted;
var photoPerm = photoStatus.isUndetermined ? null : photoStatus.isGranted;

/// await QRCode content as [String]
String result = await tryOpenScanner(
  context, 
  hvCameraPerm: camPerm, 
  cameraPermModal: CameraPermissionModal(), 
  hvPhotoPerm: photoPerm,
);

class CameraPermissionModal extends CustomModal {
  @override
  Widget buildPage(
    BuildContext context,
    Animation<double> animation,
    Animation<double> secondaryAnimation,
  ) {
    return Material(
      type: MaterialType.transparency,
      child: Container() // Your own design
    )
  }
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

QRCode Scanner with camera scanner and photo scanner function. Available in both Android and iOS Device. Forked from qr_code_scanner

Homepage

License

MIT (LICENSE)

Dependencies

flutter, image_picker, qr_code_tools

More

Packages that depend on app_qrcode_scanner