Giter Club home page Giter Club logo

barcode_scanner's People

Contributors

ce-akhil avatar dependabot[bot] avatar heman4t avatar mahmoudkea avatar rvndsngwn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

barcode_scanner's Issues

Scanner Crash while Opening

Screenshot_20240112_120649

Sometimes, the app scanner crashes. Can you guide me if anything I'm doing wrong?

This is my code:
`import 'package:ai_barcode_scanner/ai_barcode_scanner.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class ScanBarcodePage extends GetView {
const ScanBarcodePage({super.key});

@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
body: _buildBody(context),
);
}

Widget _buildBody(BuildContext context) {
return Stack(
children: [
_scanView(context),
SizedBox(
width: MediaQuery.of(context).size.width,
child: SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.45,
),
const Text(
"Align barcode in frame to scan",
style: CTAppTextStyles.pageSmallTextStyle,
),
],
),
),
),
SafeArea(
child: Align(
alignment: Alignment.topCenter,
child: SizedBox(
height: 50,
child: Stack(
children: [
const Center(
child: Text(
"Scan Barcode",
style: TextStyle(color: CTColor.white),
),
),
IconButton(
onPressed: () {
Get.back();
},
icon: const Icon(
Icons.arrow_back_ios_new,
),
iconSize: 15,
),
],
),
),
),
)
],
);
}

Widget _scanView(BuildContext context) {
return AiBarcodeScanner(
onScan: (value) {
debugPrint("value: $value");
},
onDetect: (capture) {
final List barcodes = capture.barcodes;
for (final barcode in barcodes) {
debugPrint('Barcode found! ${barcode.rawValue}');
}
},
controller: MobileScannerController(
detectionSpeed: DetectionSpeed.noDuplicates,
),
bottomBar: Container(
height: 0,
width: Size.infinite.width,
color: Colors.transparent,
),
);
}
}
`

Cut Out Size should be nullable or the condition for this should accepted 0 AND Need provision to hide camera switch button

original code assert(
(cutOutWidth == null && cutOutHeight == null) ||
(cutOutSize == null && cutOutWidth != null && cutOutHeight != null),
'Use only cutOutWidth and cutOutHeight or only cutOutSize');
}

working one assert(
(cutOutWidth == null && cutOutHeight == null) ||
(cutOutSize == 0.0 && cutOutWidth != null && cutOutHeight != null),
'Use only cutOutWidth and cutOutHeight or only cutOutSize');
}

can you update this release to another version?

This depends on mobile_scanner 3.5.6 which is conflicting with other libraries

Steps to reproduce

Running "pod install" command to install pod in my flutter project.

Expected results

It should install all of pods for iOS build but its giving me library conflict.

Actual results

Analyzing dependencies
cloud_firestore: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_auth: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_core: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_messaging: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
firebase_storage: Using Firebase SDK version '10.25.0' defined in 'firebase_core'
[!] CocoaPods could not find compatible versions for pod "GTMSessionFetcher/Core":
In Podfile:
firebase_storage (from .symlinks/plugins/firebase_storage/ios) was resolved to 11.7.5, which depends on
Firebase/Storage (= 10.25.0) was resolved to 10.25.0, which depends on
FirebaseStorage (~> 10.25.0) was resolved to 10.25.0, which depends on
GTMSessionFetcher/Core (< 4.0, >= 2.1)

google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) was resolved to 0.0.1, which depends on
  GTMSessionFetcher (>= 3.4.0) was resolved to 3.4.1, which depends on
    GTMSessionFetcher/Full (= 3.4.1) was resolved to 3.4.1, which depends on
      GTMSessionFetcher/Core (= 3.4.1)

google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) was resolved to 0.0.1, which depends on
  GoogleSignIn (~> 7.1) was resolved to 7.1.0, which depends on
    GTMAppAuth (< 5.0, >= 4.1.1) was resolved to 4.1.1, which depends on
      GTMSessionFetcher/Core (< 4.0, >= 3.3)

google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) was resolved to 0.0.1, which depends on
  GoogleSignIn (~> 7.1) was resolved to 7.1.0, which depends on
    GTMSessionFetcher/Core (~> 3.3)

mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) was resolved to 3.5.6, which depends on
  GoogleMLKit/BarcodeScanning (~> 4.0.0) was resolved to 4.0.0, which depends on
    MLKitBarcodeScanning (~> 3.0.0) was resolved to 3.0.0, which depends on
      MLKitCommon (~> 9.0) was resolved to 9.0.0, which depends on
        GTMSessionFetcher/Core (< 3.0, >= 1.1)

ai_barcode_scanner: ^3.4.1

flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2023.3)
[✓] Connected device (2 available)
[✓] Network resources

! Doctor found issues in 1 category.

Failed to codesign on iOS

When I add this dependency iOS build fails with this exception:

Error (Xcode): Target release_unpack_ios failed: Exception: Failed to codesign
path_to_project/build/ios/Release-iphoneos/Flutter.framework/Flutter with identity C05FA058034F7D0A4C805541BF182-

When I remove "ai_barcode_scanner" from pubspec.yaml the project returns to work.
PS: On Android everything is fine.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.11, on macOS 13.3.1 22E772610a darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.78.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Application goes to black screen state.....

@rvndsngwn Below is the file which has the log's of the following which may help you.
Logs.txt

Current code:-

onPressed: () async {
try {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AiBarcodeScanner(
canPop: false,
controller: MobileScannerController(
detectionSpeed: DetectionSpeed.noDuplicates),
onScan: (String value) {
print(value);
barcode = value;
barcodeValue.text = barcode;
if (context.mounted) {
Navigator.of(context).pop();
setState(() {});
}
},
),
),
);
} catch (e) {
print(e);
}

Camera Pops so many screen!!

I have used scanner but it pop's the screen after scanning.
My code for the following is ...
try {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AiBarcodeScanner(
canPop: false,
allowDuplicates: false,
onScan: (String value) {
print(value);
barcode = value;
barcodeValue.text = barcode;
Navigator.of(context).pop();
// setState(() {
//
// });
},
),
),
);
} catch (e) {
print(e);
}
},

Pls help

Problem in webapp

Using into webapp, on pc works fine, but using webapp from smartphone it looks bad and doesn't work.
IMG_DC450D63C36C-1

scanWindow not applied correctly

I'm trying to restrict the scan window to the size of the camera preview which is constrained by a SizedBox but out of screen barcodes (above and below my SizedBox) are still scanned.

Maybe I misuse scanWindow parameter ? Or is there an issue with the cover BoxFit ?

SizedBox(
	height: 250,
	width: double.infinity,
	child: AiBarcodeScanner(
		fit: BoxFit.cover,
		scanWindow: const Rect.fromLTWH(0, 0, double.infinity, 250),
		showOverlay: false,
		onScan: (String value) {
			debugPrint(value);
		},
	),
)

Incorrectly classifying EAN128 as CODE128

Hi,

thank you for an awesome library. I'm not sure if this is a problem with this library or MLKIT under it, but I'm getting same BarcodeFormat for both EAN128 and CODE128 as CODE128. They are indeed similar and EAN128 is based on CODE128 but there are functional differences, especially when EAN128 is used as GS1. Thank you in advance,

br

example error

[!] CocoaPods could not find compatible versions for pod "Firebase/Auth":
In snapshot (Podfile.lock):
Firebase/Auth (= 10.3.0)

  In Podfile:
    firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) was resolved to 4.17.9, which depends on
      Firebase/Auth (= 10.22.0)

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
pod repo update

Error: Error running pod install

CocoaPods could not find compatible versions for pod "GTMSessionFetcher/Core"

[!] CocoaPods could not find compatible versions for pod "GTMSessionFetcher/Core":
  In Podfile:
    firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) was resolved to 4.2.6, which depends on
      Firebase/Auth (= 10.3.0) was resolved to 10.3.0, which depends on
        FirebaseAuth (~> 10.3.0) was resolved to 10.3.0, which depends on
          GTMSessionFetcher/Core (< 4.0, >= 2.1)

    mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) was resolved to 3.0.0, which depends on
      GoogleMLKit/BarcodeScanning (~> 3.2.0) was resolved to 3.2.0, which depends on
        MLKitBarcodeScanning (~> 2.2.0) was resolved to 2.2.0, which depends on
          MLKitCommon (~> 8.0) was resolved to 8.0.0, which depends on
            GTMSessionFetcher/Core (~> 1.1)

GTMSessionFetcher/Core is not compatible with firebase_auth.

Preventing back button click

When the back button is clicked, the scan/detect stops working and nothing happens, just stuck on câmera, tried with WillPopScope and doesn't work either, even if change "canPop" to true.

Invalid source release: 17 - Unable to build for android

After last flutter upgrade, I've got the following error:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':mobile_scanner:compileDebugJavaWithJavac'.

error: invalid source release: 17

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 3s
Error: Gradle task assembleDebug failed with exit code 1

------ ENVIRONMENT ------

....
ai_barcode_scanner: ^3.4.3
....

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.5, on macOS 14.1.2 23B92 darwin-arm64, locale it-IT)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc3)
[!] Xcode - develop for iOS and macOS (Xcode 15.3)
! CocoaPods 1.11.2 out of date (1.13.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.87.2)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.


java --version
java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)


Landscape mode

In the code I see that we set

/// keeps the app in portrait mode
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);

Is it possible to make it optional and injected as a parameter in AiBarcodeScanner? We have an app that is always landscape

app crash on multiple barcode

App crashes on multiple barcode .Whenever there is a more than one barcode in front of camera the app gets crashed.

Wont detect Barcode

Hey!

I am using flutterflow and have managed to get the button to activate and connect the camera along with an overlay however, It wont focus and detect a barcode. I would like to use this as a barcode & qr code scanner, would you mind looking at the code below and seeing what I might have done wrong. I am fairly new to coding and this is my first project with this language so and simple guidance would be really appreciated.

class CustomButton extends StatefulWidget {
const CustomButton({
Key? key,
this.width,
this.height,
}) : super(key: key);

final double? width;
final double? height;

@OverRide
_CustomButtonState createState() => _CustomButtonState();
}

class _CustomButtonState extends State {
String barcode = 'Tap to scan';

@OverRide
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ElevatedButton(
child: const Text('Scan Barcode'),
onPressed: () async {
await Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AiBarcodeScanner(
validator: (value) {
return value.startsWith('https://');
},
canPop: false,
onScan: (String value) {
debugPrint(value);
setState(() {
barcode = value;
});
},
onDetect: (p0) {},
onDispose: () {
debugPrint("Barcode scanner disposed!");
},
controller: MobileScannerController(
detectionSpeed: DetectionSpeed.noDuplicates,
),
),
),
);
},
),
Text(barcode),
],
);
}
}

Only scan barcode in overlay focus.

I tried your example and noticed that the barcode is scanned as long as it is visible on the screen. How can I modify it to only scan the barcode at the focused position of the overlay?

onDetect: (BarcodeCapture barcode) async {
        widget.onDetect?.call(barcode);

        if (barcode.barcodes.isEmpty) {
          log('Scanned Code is Empty');
          return;
        }

        final String code = barcode.barcodes.first.rawValue ?? "";

        if ((widget.validator != null && !widget.validator!(code))) {
          setState(() {
            HapticFeedback.heavyImpact();
            log('Invalid Barcode => $code');
            _isSuccess = false;
          });
          return;
        }
        setState(() {
          _isSuccess = true;
          HapticFeedback.lightImpact();
          log('Barcode rawValue => $code');
          widget.onScan(code);
        });
        if (widget.canPop && mounted && Navigator.canPop(context)) {
          Navigator.pop(context);
          return;
        }
      }

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.