rename to zxing
@ -1 +0,0 @@
|
||||
rootProject.name = 'qrscanner_mlkit'
|
@ -1,7 +0,0 @@
|
||||
import 'qrscanner_mlkit_platform_interface.dart';
|
||||
|
||||
class QRScannerMLKit {
|
||||
Future<String?> getPlatformVersion() {
|
||||
return QRScannerMLKitPlatform.instance.getPlatformVersion();
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'qrscanner_mlkit_platform_interface.dart';
|
||||
|
||||
/// An implementation of [QRScannerMLKitPlatform] that uses method channels.
|
||||
class MethodChannelQRScannerMLKit extends QRScannerMLKitPlatform {
|
||||
/// The method channel used to interact with the native platform.
|
||||
@visibleForTesting
|
||||
final methodChannel = const MethodChannel('qrscanner_mlkit');
|
||||
|
||||
@override
|
||||
Future<String?> getPlatformVersion() async {
|
||||
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
|
||||
return version;
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import 'qrscanner_mlkit_method_channel.dart';
|
||||
|
||||
abstract class QRScannerMLKitPlatform extends PlatformInterface {
|
||||
/// Constructs a QRScannerMLKitPlatform.
|
||||
QRScannerMLKitPlatform() : super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
static QRScannerMLKitPlatform _instance = MethodChannelQRScannerMLKit();
|
||||
|
||||
/// The default instance of [QRScannerMLKitPlatform] to use.
|
||||
///
|
||||
/// Defaults to [MethodChannelQRScannerMLKit].
|
||||
static QRScannerMLKitPlatform get instance => _instance;
|
||||
|
||||
/// Platform-specific implementations should set this with their own
|
||||
/// platform-specific class that extends [QRScannerMLKitPlatform] when
|
||||
/// they register themselves.
|
||||
static set instance(QRScannerMLKitPlatform instance) {
|
||||
PlatformInterface.verifyToken(instance, _token);
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
Future<String?> getPlatformVersion() {
|
||||
throw UnimplementedError('platformVersion() has not been implemented.');
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
import 'package:qrscanner_mlkit/qrscanner_mlkit.dart';
|
||||
import 'package:qrscanner_mlkit/qrscanner_mlkit_method_channel.dart';
|
||||
import 'package:qrscanner_mlkit/qrscanner_mlkit_platform_interface.dart';
|
||||
|
||||
class MockQRScannerMLKitPlatform with MockPlatformInterfaceMixin implements QRScannerMLKitPlatform {
|
||||
@override
|
||||
Future<String?> getPlatformVersion() => Future.value('42');
|
||||
}
|
||||
|
||||
void main() {
|
||||
final QRScannerMLKitPlatform initialPlatform = QRScannerMLKitPlatform.instance;
|
||||
|
||||
test('$MethodChannelQRScannerMLKit is the default instance', () {
|
||||
expect(initialPlatform, isInstanceOf<MethodChannelQRScannerMLKit>());
|
||||
});
|
||||
|
||||
test('getPlatformVersion', () async {
|
||||
QRScannerMLKit qrscannerMlkitPlugin = QRScannerMLKit();
|
||||
MockQRScannerMLKitPlatform fakePlatform = MockQRScannerMLKitPlatform();
|
||||
QRScannerMLKitPlatform.instance = fakePlatform;
|
||||
|
||||
expect(await qrscannerMlkitPlugin.getPlatformVersion(), '42');
|
||||
});
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# qscanner_mlkit
|
||||
# qscanner_zxing
|
||||
|
||||
Android-only Flutter plugin for scanning QR Codes. Implemented with ML Kit and CameraX
|
||||
Android-only Flutter plugin for scanning QR Codes. Implemented with zxing and CameraX
|
||||
|
@ -1,4 +1,4 @@
|
||||
group 'com.yubico.authenticator.flutter_plugins.qrscanner_mlkit'
|
||||
group 'com.yubico.authenticator.flutter_plugins.qrscanner_zxing'
|
||||
version '1.0-SNAPSHOT'
|
||||
|
||||
buildscript {
|
@ -0,0 +1 @@
|
||||
rootProject.name = 'qrscanner_zxing'
|
@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_mlkit">
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_zxing">
|
||||
|
||||
<uses-feature android:name="android.hardware.camera.any" />
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.yubico.authenticator.flutter_plugins.qrscanner_mlkit
|
||||
package com.yubico.authenticator.flutter_plugins.qrscanner_zxing
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
@ -35,7 +35,6 @@ import java.util.concurrent.ExecutorService
|
||||
import java.util.concurrent.Executors
|
||||
import kotlin.Result
|
||||
|
||||
|
||||
class QRScannerViewFactory(
|
||||
private val binaryMessenger: BinaryMessenger,
|
||||
private val permissionsResultRegistrar: PermissionsResultRegistrar
|
@ -1,4 +1,4 @@
|
||||
package com.yubico.authenticator.flutter_plugins.qrscanner_mlkit
|
||||
package com.yubico.authenticator.flutter_plugins.qrscanner_zxing
|
||||
|
||||
import androidx.annotation.NonNull
|
||||
import io.flutter.embedding.engine.plugins.FlutterPlugin
|
||||
@ -31,15 +31,15 @@ class PermissionsResultRegistrar {
|
||||
}
|
||||
}
|
||||
|
||||
/** QRScannerMLKitPlugin */
|
||||
class QRScannerMLKitPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
|
||||
/** QRScannerZxingPlugin */
|
||||
class QRScannerZxingPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
|
||||
PluginRegistry.RequestPermissionsResultListener {
|
||||
|
||||
private val registrar = PermissionsResultRegistrar()
|
||||
private lateinit var channel: MethodChannel
|
||||
|
||||
override fun onAttachedToEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
|
||||
channel = MethodChannel(binding.binaryMessenger, "qrscanner_mlkit")
|
||||
channel = MethodChannel(binding.binaryMessenger, "qrscanner_zxing")
|
||||
channel.setMethodCallHandler(this)
|
||||
|
||||
binding.platformViewRegistry
|
@ -1,6 +1,6 @@
|
||||
# qrscanner_mlkit_example
|
||||
# qrscanner_zxing_example
|
||||
|
||||
Demonstrates how to use the qrscanner_mlkit plugin.
|
||||
Demonstrates how to use the qrscanner_zxing plugin.
|
||||
|
||||
## Getting Started
|
||||
|
@ -44,7 +44,7 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.yubico.authenticator.flutter_plugins.qrscanner_mlkit_example"
|
||||
applicationId "com.yubico.authenticator.flutter_plugins.qrscanner_zxing_example"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
|
||||
minSdkVersion 21
|
@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_mlkit_example">
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_zxing_example">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_mlkit_example">
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_zxing_example">
|
||||
<application
|
||||
android:label="qrscanner_mlkit_example"
|
||||
android:label="qrscanner_zxing_example"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
@ -1,4 +1,4 @@
|
||||
package com.yubico.authenticator.flutter_plugins.qrscanner_mlkit_example
|
||||
package com.yubico.authenticator.flutter_plugins.qrscanner_zxing_example
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
|
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 544 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 442 B |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 721 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_mlkit_example">
|
||||
package="com.yubico.authenticator.flutter_plugins.qrscanner_zxing_example">
|
||||
<!-- The INTERNET permission is required for development. Specifically,
|
||||
the Flutter tool needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qrscanner_mlkit/qrscanner_mlkit_view.dart';
|
||||
import 'package:qrscanner_zxing/qrscanner_zxing_view.dart';
|
||||
|
||||
import 'cutout_overlay.dart';
|
||||
|
||||
@ -70,7 +70,7 @@ class QRScannerPageState extends State<QRScannerPage> {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
QrScannerMLKitView(onDetect: (result) {
|
||||
QRScannerZxingView(onDetect: (result) {
|
||||
if (currentCode == null) {
|
||||
setState(() {
|
||||
currentCode = result.data;
|
@ -116,7 +116,7 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
qrscanner_mlkit:
|
||||
qrscanner_zxing:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: ".."
|
@ -1,5 +1,5 @@
|
||||
name: qrscanner_mlkit_example
|
||||
description: Demonstrates how to use the qrscanner_mlkit plugin.
|
||||
name: qrscanner_zxing_example
|
||||
description: Demonstrates how to use the qrscanner_zxing plugin.
|
||||
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
@ -10,7 +10,7 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
qrscanner_mlkit:
|
||||
qrscanner_zxing:
|
||||
path: ../
|
||||
|
||||
cupertino_icons: ^1.0.2
|
@ -0,0 +1,7 @@
|
||||
import 'qrscanner_zxing_platform_interface.dart';
|
||||
|
||||
class QRScannerZxing {
|
||||
Future<String?> getPlatformVersion() {
|
||||
return QRScannerZxingPlatform.instance.getPlatformVersion();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'qrscanner_zxing_platform_interface.dart';
|
||||
|
||||
/// An implementation of [QRScannerZxingPlatform] that uses method channels.
|
||||
class MethodChannelQRScannerZxing extends QRScannerZxingPlatform {
|
||||
/// The method channel used to interact with the native platform.
|
||||
@visibleForTesting
|
||||
final methodChannel = const MethodChannel('qrscanner_zxing');
|
||||
|
||||
@override
|
||||
Future<String?> getPlatformVersion() async {
|
||||
final version =
|
||||
await methodChannel.invokeMethod<String>('getPlatformVersion');
|
||||
return version;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import 'qrscanner_zxing_method_channel.dart';
|
||||
|
||||
abstract class QRScannerZxingPlatform extends PlatformInterface {
|
||||
/// Constructs a QRScannerZxingPlatform.
|
||||
QRScannerZxingPlatform() : super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
static QRScannerZxingPlatform _instance = MethodChannelQRScannerZxing();
|
||||
|
||||
/// The default instance of [QRScannerZxingPlatform] to use.
|
||||
///
|
||||
/// Defaults to [MethodChannelQRScannerZxing].
|
||||
static QRScannerZxingPlatform get instance => _instance;
|
||||
|
||||
/// Platform-specific implementations should set this with their own
|
||||
/// platform-specific class that extends [QRScannerZxingPlatform] when
|
||||
/// they register themselves.
|
||||
static set instance(QRScannerZxingPlatform instance) {
|
||||
PlatformInterface.verifyToken(instance, _token);
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
Future<String?> getPlatformVersion() {
|
||||
throw UnimplementedError('platformVersion() has not been implemented.');
|
||||
}
|
||||
}
|
@ -11,20 +11,20 @@ class ScannedData {
|
||||
ScannedData(this.data, this.location);
|
||||
}
|
||||
|
||||
class QrScannerMLKitView extends StatefulWidget {
|
||||
class QRScannerZxingView extends StatefulWidget {
|
||||
final Function(ScannedData data) onDetect;
|
||||
const QrScannerMLKitView({Key? key, required this.onDetect})
|
||||
const QRScannerZxingView({Key? key, required this.onDetect})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
QrScannerMLKitViewState createState() => QrScannerMLKitViewState();
|
||||
QRScannerZxingViewState createState() => QRScannerZxingViewState();
|
||||
}
|
||||
|
||||
class QrScannerMLKitViewState extends State<QrScannerMLKitView> {
|
||||
class QRScannerZxingViewState extends State<QRScannerZxingView> {
|
||||
final MethodChannel channel = const MethodChannel(
|
||||
"com.yubico.authenticator.flutter_plugins.qr_scanner_channel");
|
||||
|
||||
QrScannerMLKitViewState() : super() {
|
||||
QRScannerZxingViewState() : super() {
|
||||
channel.setMethodCallHandler((call) async {
|
||||
try {
|
||||
var barcodes = jsonDecode(call.arguments);
|
@ -1,5 +1,5 @@
|
||||
name: qrscanner_mlkit
|
||||
description: Android-only QR Scanner plugin based on ML Kit and CameraX API's
|
||||
name: qrscanner_zxing
|
||||
description: Android-only QR Scanner plugin based on zxing and CameraX API's
|
||||
version: 1.0.0
|
||||
homepage:
|
||||
|
||||
@ -21,5 +21,5 @@ flutter:
|
||||
plugin:
|
||||
platforms:
|
||||
android:
|
||||
package: com.yubico.authenticator.flutter_plugins.qrscanner_mlkit
|
||||
pluginClass: QRScannerMLKitPlugin
|
||||
package: com.yubico.authenticator.flutter_plugins.qrscanner_zxing
|
||||
pluginClass: QRScannerZxingPlugin
|
@ -1,10 +1,10 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:qrscanner_mlkit/qrscanner_mlkit_method_channel.dart';
|
||||
import 'package:qrscanner_zxing/qrscanner_zxing_method_channel.dart';
|
||||
|
||||
void main() {
|
||||
MethodChannelQRScannerMLKit platform = MethodChannelQRScannerMLKit();
|
||||
const MethodChannel channel = MethodChannel('qrscanner_mlkit');
|
||||
MethodChannelQRScannerZxing platform = MethodChannelQRScannerZxing();
|
||||
const MethodChannel channel = MethodChannel('qrscanner_zxing');
|
||||
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
@ -0,0 +1,29 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
import 'package:qrscanner_zxing/qrscanner_zxing.dart';
|
||||
import 'package:qrscanner_zxing/qrscanner_zxing_method_channel.dart';
|
||||
import 'package:qrscanner_zxing/qrscanner_zxing_platform_interface.dart';
|
||||
|
||||
class MockQRScannerZxingPlatform
|
||||
with MockPlatformInterfaceMixin
|
||||
implements QRScannerZxingPlatform {
|
||||
@override
|
||||
Future<String?> getPlatformVersion() => Future.value('42');
|
||||
}
|
||||
|
||||
void main() {
|
||||
final QRScannerZxingPlatform initialPlatform =
|
||||
QRScannerZxingPlatform.instance;
|
||||
|
||||
test('$MethodChannelQRScannerZxing is the default instance', () {
|
||||
expect(initialPlatform, isInstanceOf<MethodChannelQRScannerZxing>());
|
||||
});
|
||||
|
||||
test('getPlatformVersion', () async {
|
||||
QRScannerZxing qrscannerZxingPlugin = QRScannerZxing();
|
||||
MockQRScannerZxingPlatform fakePlatform = MockQRScannerZxingPlatform();
|
||||
QRScannerZxingPlatform.instance = fakePlatform;
|
||||
|
||||
expect(await qrscannerZxingPlugin.getPlatformVersion(), '42');
|
||||
});
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:qrscanner_mlkit/qrscanner_mlkit_view.dart';
|
||||
import 'package:qrscanner_zxing/qrscanner_zxing_view.dart';
|
||||
|
||||
import '../../app/navigation_service.dart';
|
||||
import '../../oath/models.dart';
|
||||
@ -53,7 +53,7 @@ class MobileScannerWrapper extends StatelessWidget {
|
||||
height: size.width - 38);
|
||||
|
||||
return Stack(children: [
|
||||
QrScannerMLKitView(onDetect: (scannedData) {
|
||||
QrScannerZxingView(onDetect: (scannedData) {
|
||||
onDetect.call(scannedData);
|
||||
}),
|
||||
ClipPath(
|
||||
|
@ -436,10 +436,10 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
qrscanner_mlkit:
|
||||
qrscanner_zxing:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "android/flutter_plugins/qrscanner_mlkit"
|
||||
path: "android/flutter_plugins/qrscanner_zxing"
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.0.0"
|
||||
|
@ -42,8 +42,8 @@ dependencies:
|
||||
json_annotation: ^4.4.0
|
||||
freezed_annotation: ^1.0.0
|
||||
window_manager: ^0.2.0
|
||||
qrscanner_mlkit:
|
||||
path: ./android/flutter_plugins/qrscanner_mlkit
|
||||
qrscanner_zxing:
|
||||
path: android/flutter_plugins/qrscanner_zxing
|
||||
desktop_drop: ^0.3.3
|
||||
|
||||
dev_dependencies:
|
||||
|