All Projects → arcticfox1919 → flutter-scankit

arcticfox1919 / flutter-scankit

Licence: MIT license
Flutter QR code scanning

Programming Languages

objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language
dart
5743 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to flutter-scankit

flutter scan
scanner qrcode in widget tree & decoder qrcode from image
Stars: ✭ 63 (-41.12%)
Mutual labels:  qrcode, flutter-plugin
r scan
📷🖨Flutter二维码&条形码扫描插件,支持相机、文件、链接、Uint8List类型扫描
Stars: ✭ 108 (+0.93%)
Mutual labels:  qrcode, flutter-plugin
qrcode
A flutter plugin for scanning QR codes. Use AVCaptureSession in iOS and zxing in Android.
Stars: ✭ 69 (-35.51%)
Mutual labels:  qrcode, flutter-plugin
flutter bolg manage
Flutter实战项目,采用Getx框架管理,遵循Material design设计风格,适合您实战参考或练手
Stars: ✭ 373 (+248.6%)
Mutual labels:  flutter-plugin
FlutterToastPlugin
A new Flutter plugin for showing toast in android and ios.
Stars: ✭ 21 (-80.37%)
Mutual labels:  flutter-plugin
flutter opencv
Flutter plug-in providing (a few) basic bindings to OpenCV-4.x. OpenCV methods implemented without the Core packages. WIP.
Stars: ✭ 119 (+11.21%)
Mutual labels:  flutter-plugin
scalable image
A widget that shows an image which can be scaled and dragged using gestures.
Stars: ✭ 15 (-85.98%)
Mutual labels:  flutter-plugin
Qrcodereader
Barcode and QR code reader built in Swift
Stars: ✭ 237 (+121.5%)
Mutual labels:  qrcode
react-native-qrimage-decoder
QR image decoder for React Native
Stars: ✭ 13 (-87.85%)
Mutual labels:  qrcode
qr-pirate
crawl QR-codes from search engines and look for bitcoin private keys
Stars: ✭ 58 (-45.79%)
Mutual labels:  qrcode
flutter shortcuts
Flutter plugin for creating static & dynamic app shortcuts on the home screen.
Stars: ✭ 47 (-56.07%)
Mutual labels:  flutter-plugin
DCC-green-pass-decoder
A simple web app to decode EU Digital Covid Certificate/Green Pass QR codes.
Stars: ✭ 42 (-60.75%)
Mutual labels:  qrcode
kanban-board-app
Kanban style task management board app
Stars: ✭ 118 (+10.28%)
Mutual labels:  qrcode
firebase dart sdk
Unofficial Firebase Flutter SDK. Maintainer: @long1eu
Stars: ✭ 84 (-21.5%)
Mutual labels:  flutter-plugin
qrxfer
Transfer files from Air gapped machines using QR codes
Stars: ✭ 88 (-17.76%)
Mutual labels:  qrcode
taro-code
Taro Barcode & QRCode
Stars: ✭ 88 (-17.76%)
Mutual labels:  qrcode
Secure-QR-Reader
Privacy Focused and Secure QR Reader
Stars: ✭ 32 (-70.09%)
Mutual labels:  qrcode
flutter wechat
flutter wechat
Stars: ✭ 76 (-28.97%)
Mutual labels:  flutter-plugin
ZZYQRCode
a scanner for QRCode barCode 最好用的ios二维码、条形码,扫描、生成框架,支持闪光灯,从相册获取,扫描音效等,高仿微信,微博
Stars: ✭ 124 (+15.89%)
Mutual labels:  qrcode
flutter sliding tutorial
User onboarding library with smooth animation of objects and background colors
Stars: ✭ 127 (+18.69%)
Mutual labels:  flutter-plugin

Update

  • Upgrade v1.2, support custom view

Note

ScanKit iOS SDK does not support armv7, only arm64, so you need to configure it in Xcode, see here.


flutter_scankit

中文文档 | English

A scan code Flutter plugin, which is a Flutter package for HUAWEI ScanKit SDK.The HUAWEI ScanKit is a powerful library that is easy to use and fast to read.

Scan Kit automatically detects, magnifies, and recognizes barcodes from a distance, and is also able to scan a very small barcode in the same way. It works even in suboptimal situations, such as under dim lighting or when the barcode is reflective, dirty, blurry, or printed on a cylindrical surface. This leads to a high scanning success rate, and an improved user experience.

  • Android
  • iOS

Scanning Barcodes

ScanKit supports 13 major barcode formats (listed as follows). If your app requires only some of the 13 formats, specify the desired formats to speed up barcode scanning.

  • 1D barcode formats: EAN-8, EAN-13, UPC-A, UPC-E, Codabar, Code 39, Code 93, Code 128, and ITF-14
  • 2D barcode formats: QR Code, Data Matrix, PDF417, and Aztec

Support camera scan code and local picture recognition.

Usage

  1. Configure Permissions
  2. Handling permission requests
  3. Calling APIs

Configure Permissions

iOS

Add the following to ios/Runner/Info.plist

    <key>NSCameraUsageDescription</key>
    <string>Explain to the user here why you need the permission</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>Explain to the user here why you need the permission</string>

Note that replacing the content of the tag gives the user a reason for needing the permission.

No configuration required for Android platform!

Permission Request

In Flutter, you need a plugin library for permission handling, here I recommend using another plugin library of mine: flutter_easy_permission, go here for detailed configuration.

Open the ios/Podfile file and add the following code:

target 'Runner' do
  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
  # Add the library of permissions you need here
  pod 'EasyPermissionX/Camera'
  pod 'EasyPermissionX/Photo'
end

Then execute the command to install.

Calling APIs

  void initState() {
    super.initState();
    scanKit = FlutterScankit()
	 ..addResultListen((val) {
	  // Back to the results
      debugPrint("scanning result:$val");
    });

    FlutterEasyPermission().addPermissionCallback(
        onGranted: (requestCode, perms,perm) {
          startScan();
        },
        onDenied: (requestCode, perms,perm, isPermanent) {});
  }

Scan the code:

    // Request if no permission
    if (!await FlutterEasyPermission.has(perms: _permissions,permsGroup: _permissionGroup)) {
          FlutterEasyPermission.request(perms: _permissions,permsGroup: _permissionGroup);
    } else {
          // Call if you have permission
          startScan();
    }
    
    
Future<void> startScan() async {
    try {
      await scanKit.startScan(scanTypes: [ScanTypes.ALL]);
    } on PlatformException {}
}

For the usage of FlutterEasyPermission please check here .

Custom view

Use ScanKitWidget as a scan widget, ScanKitController for flash switching, picture code recognition and other functions

class _CustomizedViewState extends State<CustomizedView> {
  late ScanKitController _controller;

  final screenWidth = window.physicalSize.width;
  final screenHeight = window.physicalSize.height;
  
  @override
  void dispose(){
    _controller.dispose();
   super.dispose(); 
  }

  @override
  Widget build(BuildContext context) {
    var pixelSize = boxSize * window.devicePixelRatio;
    var left = screenWidth/2 - pixelSize/2;
    var top = screenHeight/2 - pixelSize/2;
    var right = screenWidth/2 + pixelSize/2;
    var bottom = screenHeight/2 + pixelSize/2;
    var rect = Rect.fromLTRB(left, top, right, bottom);

    return Scaffold(
      body: SafeArea(
        child: Stack(
          children: [
            ScanKitWidget(
                callback: (controller) {
                  _controller = controller;

                  controller.onResult.listen((result) {
                    debugPrint("scanning result:$result");

                    Navigator.of(context).pop(result);
                  });
                },
              continuouslyScan: false,
              boundingBox: rect),
            Align(
              alignment: Alignment.topCenter,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  IconButton(
                      onPressed: () {
                        Navigator.of(context).pop();
                      },
                      icon: Icon(
                        Icons.arrow_back,
                        color: Colors.white,
                        size: 28,
                      )),
                  IconButton(
                      onPressed: () {
                        _controller.switchLight();
                      },
                      icon: Icon(
                        Icons.lightbulb_outline_rounded,
                        color: Colors.white,
                        size: 28,
                      )),
                  IconButton(
                      onPressed: () {
                        _controller.pickPhoto();
                      },
                      icon: Icon(
                        Icons.picture_in_picture_rounded,
                        color: Colors.white,
                        size: 28,
                      ))
                ],
              ),
            ),

            Align(
              alignment: Alignment.center,
              child: Container(
                width: boxSize,
                height: boxSize,
                decoration: BoxDecoration(
                  border: Border(
                      left: BorderSide(color: Colors.orangeAccent, width: 2),
                      right: BorderSide(color: Colors.orangeAccent, width: 2),
                      top: BorderSide(color: Colors.orangeAccent, width: 2),
                      bottom: BorderSide(color: Colors.orangeAccent, width: 2)),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}

Example

For a complete example, please see here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].