mohesu / barcode_scanner

A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS.
Apache License 2.0
31 stars 23 forks source link

Scan window does not stay in the middle of the screen. #118

Open StatTark opened 6 days ago

StatTark commented 6 days ago

Scan window does not stay in the middle of the screen.

WhatsApp Image 2024-07-02 at 11 17 58

import 'package:ai_barcode_scanner/ai_barcode_scanner.dart';
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';

@RoutePage()
class BarcodeScanView extends StatefulWidget {

  const BarcodeScanView({Key? key}) : super(key: key);

  @override
  State<BarcodeScanView> createState() => _BarcodeScanViewState();
}

class _BarcodeScanViewState extends State<BarcodeScanView> {

  @override
  Widget build(BuildContext context) {
    return AiBarcodeScanner(
      onDetect: (BarcodeCapture capture) async{
        final String? value = capture.barcodes.first.rawValue;

      },
      onDispose: () {
        debugPrint("Barcode scanner disposed!");
      },
      controller: MobileScannerController(
        detectionSpeed: DetectionSpeed.noDuplicates,
        formats: [BarcodeFormat.all],
      )
    );
  }
}

Phone Iphone SE

rvndsngwn commented 5 days ago

Hi @StatTark

I need to look into what happens here. For now, you can use the cutOutBottomOffset parameter to align that.

StatTark commented 5 days ago

Thank you for the suggestion, @rvndsngwn! I'll try using the cutOutBottomOffset parameter to align it. Much appreciated!