-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac073b7
commit 5c3f2bf
Showing
6 changed files
with
116 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# .github/workflows/publish.yml | ||
name: Publish to pub.dev | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v[0-9]+.[0-9]+.[0-9]+*" # tag pattern on pub.dev: 'v{{version}' | ||
|
||
# Publish using custom workflow | ||
jobs: | ||
publish: | ||
permissions: | ||
id-token: write # Required for authentication using OIDC | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Flutter | ||
uses: subosito/flutter-action@v2 | ||
- uses: dart-lang/setup-dart@v1 | ||
- name: Install dependencies | ||
run: flutter pub get | ||
# Here you can insert custom steps you need | ||
# - run: dart tool/generate-code.dart | ||
- name: Publish | ||
run: flutter pub publish --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,110 @@ | ||
# qrcode_barcode_scanner | ||
# QRCode & Barcode Scanner | ||
|
||
Plugin for managing QR and BAR code reading from an external device. | ||
[![pub package](https://img.shields.io/pub/v/qrcode_barcode_scanner.svg)](https://pub.dev/packages/qrcode_barcode_scanner) | ||
[![Build Status](https://img.shields.io/github/actions/workflow/status/FrenkyDema/qrcode_barcode_scanner/flutter.yml)](https://github.com/FrenkyDema/qrcode_barcode_scanner/actions/workflows/flutter.yml) | ||
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT) | ||
|
||
## Important | ||
### Overview | ||
|
||
**THIS PACKAGE WILL WORK ONLY IN ANDROID!** | ||
The **QRCode & Barcode Scanner** plugin is designed to manage QR and Barcode scanning from external | ||
devices, offering a streamlined API for integration in Android applications. | ||
|
||
--- | ||
> **Important:** This package currently supports **Android** only. | ||
## Class Name | ||
### Features | ||
|
||
```dart | ||
QrcodeBarcodeScanner | ||
``` | ||
- **Simple Integration**: Use the `QrcodeBarcodeScanner` class to easily handle scan events. | ||
- **Customizable Callbacks**: Register custom callback functions to handle scanned data in | ||
real-time. | ||
- **Android Only**: This plugin is developed with Android compatibility in mind. | ||
- **Tested Devices**: Supports external scanning devices such as Sunmi Blink. | ||
|
||
## Variables | ||
### Installation | ||
|
||
```dart | ||
ScannedCallback onScannedCallback; //void Function(String scannedCode); | ||
Add the following dependency in your `pubspec.yaml` file: | ||
|
||
```bash | ||
flutter pub add qrcode_barcode_scanner | ||
``` | ||
|
||
## Example | ||
### Usage Example | ||
|
||
Here is a simple example of how to use the `QrcodeBarcodeScanner`: | ||
|
||
```dart | ||
String? _scanValue; | ||
import 'package:qrcode_barcode_scanner/qrcode_barcode_scanner.dart'; | ||
class MyScannerApp extends StatefulWidget { | ||
@override | ||
_MyScannerAppState createState() => _MyScannerAppState(); | ||
} | ||
@override | ||
class _MyScannerAppState extends State<MyScannerApp> { | ||
String? _scanValue; | ||
@override | ||
void initState() { | ||
super.initState(); | ||
QrcodeBarcodeScanner( | ||
onScannedCallback: (String value) => setState( | ||
() { | ||
onScannedCallback: (String value) { | ||
setState(() { | ||
_scanValue = value; | ||
}, | ||
}); | ||
}, | ||
); | ||
} | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(title: Text("QR & Barcode Scanner")), | ||
body: Center( | ||
child: Text(_scanValue ?? "Waiting for scan..."), | ||
), | ||
); | ||
} | ||
} | ||
``` | ||
|
||
## Installation | ||
### API Documentation | ||
|
||
```bash | ||
flutter pub add qrcode_barcode_scanner | ||
#### Class: `QrcodeBarcodeScanner` | ||
|
||
The `QrcodeBarcodeScanner` class is the core component of this plugin. It allows you to configure | ||
and manage barcode and QR code scanning events. | ||
|
||
**Constructor:** | ||
|
||
```dart | ||
QrcodeBarcodeScanner({ | ||
required ScannedCallback onScannedCallback, | ||
}); | ||
``` | ||
|
||
## Tested Devices | ||
**Properties:** | ||
|
||
- `onScannedCallback`: A callback function that is triggered when a scan is successful. Receives the | ||
scanned value as a string. | ||
|
||
### Tested Devices | ||
|
||
This plugin has been tested with the following devices: | ||
|
||
- Sunmi Blink | ||
|
||
### Additional Resources | ||
|
||
For more detailed documentation and advanced use cases, check out | ||
the [Wiki](https://github.com/FrenkyDema/qrcode_barcode_scanner/wiki). | ||
|
||
### Changelog | ||
|
||
Check out the [Changelog](CHANGELOG.md) for details on recent updates. | ||
|
||
### Contributing | ||
|
||
Want to contribute? Check out the [Contribution Guide](.github/CONTRIBUTING.md) to get started! | ||
|
||
### License | ||
|
||
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters