multi_qr_tracker 0.0.1 copy "multi_qr_tracker: ^0.0.1" to clipboard
multi_qr_tracker: ^0.0.1 copied to clipboard

A Flutter package for detecting and tracking multiple QR codes simultaneously on Android with adaptive UI overlays. Native CameraX implementation with ML Kit.

multi_qr_tracker #

pub package License: MIT

A powerful Flutter package for detecting and tracking multiple QR codes simultaneously with adaptive UI overlays.

Platform Support Orientation Support

๐ŸŽฏ Why This Package? #

This package was created to provide reliable multi-QR code detection with a native Android implementation using CameraX and ML Kit Barcode Scanning.

Current Status:

  • โœ… Android platform support
  • โœ… Portrait orientation
  • ๐Ÿšง iOS and landscape orientations coming in future updates

Multi QR Tracker Demo

โœจ Features #

  • ๐Ÿ” Multi-QR Code Detection: Detect and track multiple QR codes simultaneously in real-time
  • ๐Ÿ“ Dynamic Borders: Borders automatically adjust size as you move closer or further from QR codes
  • ๐ŸŽฏ Adaptive Scan Buttons: Full buttons with icon and text for large QR codes, icon-only for small ones
  • ๐ŸŽฏ Optional Scan Frame: Show corner indicators to guide users where to position QR codes
  • ๐ŸŽจ Fully Customizable: Colors, border width, padding, corner radius, scan frame style, and more
  • ๐Ÿš€ High Performance: Smooth real-time tracking with CameraX and ML Kit Barcode Scanning
  • ๐Ÿค– Native Android Implementation: Direct CameraX integration for optimal performance
  • ๐Ÿ“ฑ Current Support: Android (API 21+) in portrait orientation
  • ๐Ÿ”ฎ Coming Soon: iOS support and landscape orientation

๐Ÿ“ฑ Screenshots #

[Camera view with multiple QR codes detected, each with green borders and "SCAN ME" buttons]

๐Ÿš€ Getting Started #

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  multi_qr_tracker: ^0.0.1

Then run:

flutter pub get

Platform Setup #

Android

Add camera permission to your AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />

Set minimum SDK version to 21 in android/app/build.gradle:

minSdkVersion 21

๐Ÿ’ก Usage #

Basic Example #

import 'package:flutter/material.dart';
import 'package:multi_qr_tracker/multi_qr_tracker.dart';

class QRScannerPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('QR Scanner')),
      body: MultiQrTrackerView(
        onQrCodeScanned: (String value) {
          print('Scanned: $value');
          // Handle scanned QR code
        },
      ),
    );
  }
}

Advanced Example #

MultiQrTrackerView(
  onQrCodeScanned: (String value) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(content: Text('Scanned: $value')),
    );
  },
  
  // Customize QR code borders
  borderColor: Colors.blue,
  borderWidth: 4.0,
  borderPadding: 12.0,
  cornerRadius: 20.0,
  
  // Customize scan buttons
  scanButtonColor: Colors.green,
  iconColor: Colors.white,
  
  // Optional scan frame with corner indicators
  showScanFrame: true,
  scanFrameColor: Colors.white,
  scanFrameSize: 250.0,
  scanFrameCornerLength: 40.0,
  scanFrameCornerWidth: 4.0,
  
  // Error handling
  onCameraError: (String error) {
    print('Camera error: $error');
  },
  onPermissionDenied: () {
    print('Camera permission denied');
  },
)

๐ŸŽจ Customization #

Parameter Type Default Description
onQrCodeScanned Function(String) required Callback when QR code is scanned
borderColor Color Colors.green Color of detection borders
borderWidth double 3.0 Width of border lines
borderPadding double 8.0 Extra padding around QR codes
cornerRadius double 12.0 Border corner radius
scanButtonColor Color Colors.blue Scan button background color
iconColor Color Colors.white Scan button icon color
showScanFrame bool false Show scan frame with corner indicators
scanFrameColor Color Colors.white Color of scan frame corners
scanFrameSize double 250.0 Size of scan frame (width and height)
scanFrameCornerLength double 40.0 Length of corner lines
scanFrameCornerWidth double 4.0 Thickness of corner lines
onCameraError Function(String)? null Camera error callback
onPermissionDenied VoidCallback? null Permission denied callback

๐Ÿ“Š How It Works #

  1. Native Camera: Uses CameraX for camera preview and image capture
  2. Detection: ML Kit Barcode Scanning detects QR codes in real-time
  3. Coordinate Mapping: Transforms camera coordinates to screen coordinates with BoxFit.cover
  4. Border Rendering: Draws dynamic borders using CustomPainter
  5. Adaptive UI: Automatically switches between full button and icon-only based on QR code size
  6. Scan Frame: Optional corner indicators to guide user positioning

๐Ÿ”ง API Reference #

MultiQrTrackerView #

The main widget for QR code detection.

MultiQrTrackerView({
  Key? key,
  required Function(String value) onQrCodeScanned,
  Color borderColor = Colors.green,
  double borderWidth = 3.0,
  double borderPadding = 8.0,
  double cornerRadius = 12.0,
  Color scanButtonColor = Colors.blue,
  Color iconColor = Colors.white,
  bool showScanFrame = false,
  Color scanFrameColor = Colors.white,
  double scanFrameSize = 250.0,
  double scanFrameCornerLength = 40.0,
  double scanFrameCornerWidth = 4.0,
  Function(String error)? onCameraError,
  VoidCallback? onPermissionDenied,
})

QrCodeInfo #

Model class containing QR code information:

class QrCodeInfo {
  final String value;
  final Rect boundingBox;
  final List<Offset> corners;
  
  Offset get center;
  double get width;
  double get height;
  bool get isLargeEnoughForFullButton;
}

๐Ÿ“– Example App #

Check out the example directory for a complete demo app showing:

  • Multiple QR code detection
  • Real-time orientation switching
  • Dynamic color customization
  • Scan history tracking
  • Error handling

Run the example:

cd example
flutter run

๐Ÿงช Testing #

The package includes comprehensive tests with >90% coverage:

flutter test --coverage

๐Ÿค Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License #

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ’– Support #

If you find this package helpful, please:

๐Ÿ‘จโ€๐Ÿ’ป Author #

Dhia Bechattaoui

๐Ÿ™ Acknowledgments #

  • Built with CameraX for native Android camera integration
  • Uses ML Kit Barcode Scanning for QR code detection
  • Inspired by the need for reliable multi-QR code scanning in Flutter apps

๐Ÿ“ˆ Changelog #

See CHANGELOG.md for a list of changes.

๐Ÿ”ฎ Roadmap #

  • โŒ iOS platform support
  • โŒ Landscape orientation support
  • โŒ Auto-rotate support
  • โŒ Barcode format detection (EAN, Code128, etc.)
  • โŒ Flashlight control
  • โŒ Zoom controls
  • โŒ Image picker scanning
  • โŒ Custom overlay widgets

Made with โค๏ธ by Dhia Bechattaoui

4
likes
0
points
307
downloads

Publisher

verified publisherbechattaoui.dev

Weekly Downloads

A Flutter package for detecting and tracking multiple QR codes simultaneously on Android with adaptive UI overlays. Native CameraX implementation with ML Kit.

Repository (GitHub)
View/report issues

Topics

#qr-code #qr-scanner #multi-detection #camera #barcode

Documentation

Documentation

Funding

Consider supporting this project:

github.com

License

unknown (license)

Dependencies

flutter

More

Packages that depend on multi_qr_tracker

Packages that implement multi_qr_tracker