Skip to content

flutter-package/flutter_scan

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

a30e119 · Aug 27, 2022

History

31 Commits
Apr 28, 2021
Apr 20, 2021
Aug 27, 2022
Dec 14, 2021
Aug 27, 2022
Aug 27, 2022
Oct 12, 2020
Oct 12, 2020
Oct 12, 2020
Oct 12, 2020
Dec 22, 2021
Oct 12, 2020
Dec 22, 2021
Oct 26, 2021
Dec 22, 2021
Oct 12, 2020

Repository files navigation

scan

scan

scan qrcode & barcode in widget tree.

decode qrcode & barcode image from path.

if you want to generate qrcode image, you should use qr_flutter

Features

  • use ScanView in widget tree to show scan view.
  • custom identifiable area.
  • decode qrcode from image path by Scan.parse.

prepare

ios

info.list

<key>NSCameraUsageDescription</key>
<string>Your Description</string>

<key>io.flutter.embedded_views_preview</key>
<string>YES</string>
android
<uses-permission android:name="android.permission.CAMERA" />

<application>
  <meta-data
    android:name="flutterEmbedding"
    android:value="2" />
</application>
scan: ^newest
import 'package:scan/scan.dart';

Usage

  • show scan view in widget tree
ScanController controller = ScanController();
String qrcode = 'Unknown';

Container(
  width: 250, // custom wrap size
  height: 250,
  child: ScanView(
    controller: controller,
// custom scan area, if set to 1.0, will scan full area
    scanAreaScale: .7,
    scanLineColor: Colors.green.shade400,
    onCapture: (data) {
      // do something
    },
  ),
),
  • you can use controller.resume() and controller.pause() resume/pause camera
controller.resume();
controller.pause();
  • get qrcode string from image path
String result = await Scan.parse(imagePath);
  • toggle flash light
controller.toggleTorchMode();

proguard-rules

-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keepattributes SourceFile,LineNumberTable
-keep class com.huawei.hianalytics.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}

License

MIT License