GithubHelp home page GithubHelp logo

hhy5277 / flutter_qr_mobile_vision Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rmtmckenzie/flutter_qr_mobile_vision

0.0 1.0 0.0 3.42 MB

QR reader plugin using mobile vision API for Flutter.

License: MIT License

Java 61.00% Ruby 3.95% Objective-C 15.98% Dart 19.06%

flutter_qr_mobile_vision's Introduction

QR Mobile Vision

pub package

Reading QR codes and other barcodes using Google's Mobile Vision API.

This plugin uses Android & iOS native APIs for reading images from the device's camera. It then pipes these images both to the Mobile Vision API which detects barcodes/qrcodes etc, outputs a preview image to be shown on a flutter texture.

The plugin includes a widget which performs all needed transformations on the camera output to show within the defined area.

Usage

See the example for how to use this plugin; it is the best resource available as it shows the plugin in use. However, these are the steps you need to take to use this plugin.

First, figure out the area that you want the camera preview to be shown in. This is important as the preview needs to have a constrained size or it won't be able to build. This is required due to the complex nature of the transforms needed to get the camera preview to show correctly on both iOS and Android, while still working with the screen rotated etc.

It may be possible to get the camera preview to work without putting it in a SizedBox or Container, but the recommended way is to put it in a SizedBox or Container.

You then need to include the package and instantiate the camera.

import 'package:qr_mobile_vision/qr_camera.dart';

...

new SizedBox(
  width: 300.0,
  height: 600.0,
  child: new QrCamera(
    qrCodeCallback: (code) {
      ...
    },
  ),
)

The QrCodeCallback can do anything you'd like, and wil keep receiving QR codes until the camera is stopped.

There are also optional parameters to QrCamera.

fit

Takes as parameter the flutter BoxFit. Setting this to different values should get the preview image to fit in different ways, but only BoxFit = cover has been tested extensively.

notStartedBuilder

A callback that must return a widget if defined. This should build whatever you want to show up while the camera is loading (which can take from milliseconds to seconds depending on the device).

child

Widget that is shown on top of the QrCamera. If you give it a specific size it may cause weird issues so try not to.

key

Standard flutter key argument. Can be used to get QrCameraState with a GlobalKey.

offscreenBuilder

A callback that must return a widget if defined. This should build whatever you want to show up when the camera view is 'offscreen'. i.e. when the app is paused. May or may not show up in preview of app.

onError

Callback for if there's an error.

'formats'

A list of supported formats, all by default. If you use all, you shouldn't define any others.

These are the supported types:

  ALL_FORMATS,
  AZTEC,
  CODE_128,
  CODE_39,
  CODE_93,
  CODABAR,
  DATA_MATRIX,
  EAN_13,
  EAN_8,
  ITF,
  PDF417,
  QR_CODE,
  UPC_A,
  UPC_E

Push and Pop

If you push a new widget on top of a the current page using the navigator, the camera doesn't necessarily know about it.

Contributions

Anyone wanting to contribute to this project is very welcome to! I'll take a look at PR's as soon as I can, and any bug reports are appreciated. I've only a few devices on which to test this so feedback about other devices is appreciated as well.

This has been tested on:

  • Nexus 5x
  • Nexus 4
  • Alcatel Idol X Plus
  • Essential Phone
  • iPhone 6

flutter_qr_mobile_vision's People

Contributors

baaraakaa avatar jaumard avatar morgan-pipa avatar pjkroll avatar rmtmckenzie avatar sameerdonga avatar yarrumretep avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.