scrumlab_flutter_qr_bar_scanner

Creator: coderz1093

Last updated:

0 purchases

scrumlab_flutter_qr_bar_scanner Image
scrumlab_flutter_qr_bar_scanner Images
Add to Cart

Description:

scrumlab flutter qr bar scanner

Flutter QR Bar Scanner #

A Full Screen Scanner for Scanning QR code and Barcode using Google's Mobile Vision API
Usage #
import 'package:flutter/material.dart';
import 'package:scrumlab_flutter_qr_bar_scanner/qr_bar_scanner_camera.dart';

void main() {
runApp(MyApp());
}

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter QR/Bar Code Reader',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter QR/Bar Code Reader'),
);
}
}

class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
String _qrInfo = 'Scan a QR/Bar code';
bool _camState = false;

_qrCallback(String code) {
setState(() {
_camState = false;
_qrInfo = code;
});
}

_scanCode() {
setState(() {
_camState = true;
});
}

@override
void initState() {
_scanCode();
super.initState();
}

@override
void dispose() {
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: _camState
? Center(
child: SizedBox(
height: 1000,
width: 500,
child: QRBarScannerCamera(
onError: (context, error) => Text(
error.toString(),
style: TextStyle(color: Colors.red),
),
qrCodeCallback: (code) {
_qrCallback(code);
},
),
),
)
: Center(
child: Text(_qrInfo),
),
);
}
}


copied to clipboard
The QrCodeCallback can do anything you'd like, and wil keep receiving QR/Bar codes
until the camera is stopped.
There are also optional parameters to QRScannerCamera.
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 QRScannerCamera. 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 QRScannerCameraState 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
copied to clipboard
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 #
Any kind of contribution will be appreciated.
License #
MIT License

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.

Related Products

More From This Creator