Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
FrenkyDema committed Sep 6, 2024
1 parent ac073b7 commit 5c3f2bf
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
env:
JAVA_VERSION: "11.0"
FLUTTER_VERSION: "3.19.3"
FLUTTER_VERSION: "3.22.1"
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
access_token: ${{ github.token }}
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
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
9 changes: 5 additions & 4 deletions .github/workflows/pull_request_automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:

jobs:
merge_dependabot:
permissions: write-all
runs-on: ubuntu-latest
steps:
- id: automerge
Expand All @@ -22,11 +23,11 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "dependencies"
MERGE_FILTER_AUTHOR: "dependabot"
MERGE_FILTER_AUTHOR: "dependabot[bot]"
LOG: "TRACE"
MERGE_METHOD: "squash"

- name: feedback
if: steps.automerge.outputs.mergeResult == "merged"
if: ${{ steps.automerge.outputs.mergeResult == 'merged' }}
run: |
echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} merged!"
echo "Pull request ${{ steps.automerge.outputs.pullRequestNumber }} merged!"
105 changes: 83 additions & 22 deletions README.md
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.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.0.1"
version: "3.0.2"
sky_engine:
dependency: transitive
description: flutter
Expand Down

0 comments on commit 5c3f2bf

Please sign in to comment.