fluttervisionsdkplugin 0.0.3 fluttervisionsdkplugin: ^0.0.3 copied to clipboard
A Flutter plugin package for integrating the Flutter Vision SDK into your Flutter application for scanning Barcodes and QrCodes
A Flutter plugin package for seamless integration of the Flutter Vision SDK into your Flutter applications. This package provides features for scanning barcodes, QR codes, and text, along with OCR (Optical Character Recognition) support. Customize scan and capture modes to meet your specific needs.
Features #
Scan barcodes, QR codes, and text. Optical Character Recognition (OCR) support. Flexible customization of scan and capture modes.
Getting started #
import the package and use it in your app.
import 'package:fluttervisionsdkplugin/fluttervisionsdkplugin.dart';
Usage #
Here's an example of how to use the NativeViewWidget in your Flutter application:
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Stack(
children: [
NativeViewWidget(
onScanError: _onScanError,
onCodesReceived: _onCodesReceived,
onDetectionResult: _onDetectionResult,
onOCRImagesReceived: _onOCRImagesReceived,
shouldDisplayFocusImage: true,
shouldScanInFocusImageRect: true,
onDetected: onDetected,
isTextIndicationOn: true,
isBarCodeOrQRCodeIndicationOn: true,
selectionTintColor: 'white',
imageTintColor: 'white',
codeDetectionConfidence: 0.5,
sessionPreset: 'high',
nthFrameToProcess: 10,
captureMode: 0,
captureType: 0,
scanMode: 0,
focusImage: '',
focusImageRect: const {
'x': 0,
'y': 0,
'height': 0,
'width': 0,
}),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
alignment: Alignment.bottomCenter,
width: double.infinity,
color: Colors.white,
padding: const EdgeInsets.all(16),
child: Column(
children: [
Text(
'Detected Type: $detectedType',
style:
const TextStyle(color: Colors.black, fontSize: 16),
),
Text(
'Scanned Code: $scannedCode',
style:
const TextStyle(color: Colors.black, fontSize: 16),
),
ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeCaptureMode('auto');
},
child: const Text('Change Capture Mode to Auto'),
),
ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeCaptureMode('manual');
updateCaptureMode(true);
},
child: const Text('Change Capture Mode to Manual'),
),
ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('qrcode');
},
child: const Text('Change Scan Mode to QR Code'),
),
ElevatedButton(
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('barcode');
},
child: const Text('Change Scan Mode to Barcode'),
),
ElevatedButton(
onPressed: () {
const NativeViewWidget().onPressChangeScanMode('ocr');
},
child: const Text('Change Scan Mode to OCR'),
),
if (isManualCaptureMode)
ElevatedButton(
onPressed: () {
const NativeViewWidget().onPressCapture();
},
child: const Text('Capture Photo'),
),
],
),
),
),
),
],
),
),
);
}
User can make the Barcode or Qrcode window customizable by giving values here :
focusImageRect: const {
'x': 0,
'y': 0,
'height': 0,
'width': 0,
}
This will show us either the detected type is Text, QrCode or BarCode:
Text(
'Detected Type: $detectedType',
style:
const TextStyle(color: Colors.black, fontSize: 16),
),
This will show us the scanned code from barCode and QrCode:
Text(
'Scanned Code: $scannedCode',
style:
const TextStyle(color: Colors.black, fontSize: 16),
),
This will change the scanning mode to Auto:
onPressed: () {
const NativeViewWidget()
.onPressChangeCaptureMode('auto');
},
This will change the scanning mode to Manual:
onPressed: () {
const NativeViewWidget()
.onPressChangeCaptureMode('manual');
updateCaptureMode(true);
},
This will change the Scan Mode to QR:
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('qrcode');
},
This will change the Scan Mode to BarCode:
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('barcode');
},
This will change the Scan Mode to OCR:
onPressed: () {
const NativeViewWidget()
.onPressChangeScanMode('ocr');
},
Additional information #
Users can import this package and integrate it into their Flutter projects to enable barcode and QR code scanning with customizable modes. This package provides a simple and efficient way to leverage the power of the Flutter Vision SDK in your applications.