Parcourir la source

QR Code scanner README Updates.

flutter-beta
TheJuliuscanute il y a 7 ans
Parent
révision
1afdeab3b1
7 fichiers modifiés avec 99 ajouts et 39 suppressions
  1. +4
    -0
      CHANGELOG.md
  2. +8
    -11
      README.md
  3. +70
    -12
      example/README.md
  4. +7
    -7
      example/lib/main.dart
  5. +1
    -1
      ios/Classes/FlutterQrPlugin.m
  6. +6
    -5
      ios/qr_code_scanner.podspec
  7. +3
    -3
      pubspec.yaml

+ 4
- 0
CHANGELOG.md Voir le fichier

@@ -1,3 +1,7 @@
## 0.0.2

* Added documentation to cover how to use the plugin.

## 0.0.1

* QR Code scanner embedded inside flutter.

+ 8
- 11
README.md Voir le fichier

@@ -1,14 +1,11 @@
# flutter_qr
# qr_code_scanner
This package wires the PlatformView corresponding to iOS and Android inside flutter.

#Credits
* Android: https://github.com/zxing/zxing
* iOS: https://github.com/mikebuss/MTBBarcodeScanner

## Getting Started

This project is a starting point for a Flutter
[plug-in package](https://flutter.io/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.

For help getting started with Flutter, view our
[online documentation](https://flutter.io/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
#TODO'S:
* Add support to flip camera view.
* iOS Native embedding is written to match what is supported in the framework as of the date of publication of this package. It needs to be improved as the framework support improves.
* Finally, I welcome PR's to make it better :), thanks

+ 70
- 12
example/README.md Voir le fichier

@@ -1,22 +1,80 @@
# qr_code_scanner

Demonstrates how to use the qr_code_scanner plugin.
##iOS Support:

###info.plist
```xml
<dict>
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>remote-notification</string>
</array>
<key>NSCameraUsageDescription</key>
<string>Can we access your camera in order to scan barcodes?</string>
</dict>

TODO'S:
1) Add support to flip camera view.
2) iOS Native embedding is written to match what is supported in framework as of the date of publication of this package. It needs to be improved as the framework support improves.
3) Finally, I welcome PR's to make it better :), thanks!
```

## Getting Started
##Example:
```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';

This project is a starting point for a Flutter application.
void main() => runApp(MaterialApp(home: QRViewExample()));

class QRViewExample extends StatefulWidget {
const QRViewExample({
Key key,
}) : super(key: key);

@override
State<StatefulWidget> createState() => _QRViewExampleState();
}

class _QRViewExampleState extends State<QRViewExample> {
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
var qrText = "";
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
Expanded(
child: QRView(
key: qrKey,
onQRViewCreated: _onQRViewCreated,
),
flex: 4,
),
Expanded(
child: Text("This is the result of scan: $qrText"),
flex: 1,
)
],
),
);
}

void _onQRViewCreated(QRViewController controller) {
final channel = controller.channel;
controller.init(qrKey);
channel.setMethodCallHandler((MethodCall call) async {
switch (call.method) {
case "onRecognizeQR":
dynamic arguments = call.arguments;
setState(() {
qrText = arguments.toString();
});
}
});
}
}
```

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook)

For help getting started with Flutter, view our
[online documentation](https://flutter.io/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

+ 7
- 7
example/lib/main.dart Voir le fichier

@@ -2,18 +2,18 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';

void main() => runApp(MaterialApp(home: TextViewExample()));
void main() => runApp(MaterialApp(home: QRViewExample()));

class TextViewExample extends StatefulWidget {
const TextViewExample({
class QRViewExample extends StatefulWidget {
const QRViewExample({
Key key,
}) : super(key: key);

@override
State<StatefulWidget> createState() => _TextViewExampleState();
State<StatefulWidget> createState() => _QRViewExampleState();
}

class _TextViewExampleState extends State<TextViewExample> {
class _QRViewExampleState extends State<QRViewExample> {
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
var qrText = "";
@override
@@ -26,11 +26,11 @@ class _TextViewExampleState extends State<TextViewExample> {
key: qrKey,
onQRViewCreated: _onQRViewCreated,
),
flex: 1,
flex: 4,
),
Expanded(
child: Text("This is the result of scan: $qrText"),
flex: 4,
flex: 1,
)
],
),


+ 1
- 1
ios/Classes/FlutterQrPlugin.m Voir le fichier

@@ -1,5 +1,5 @@
#import "FlutterQrPlugin.h"
#import <flutter_qr/flutter_qr-Swift.h>
#import "qr_code_scanner-Swift.h"
@implementation FlutterQrPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
[SwiftFlutterQrPlugin registerWithRegistrar:registrar];


ios/flutter_qr.podspec → ios/qr_code_scanner.podspec Voir le fichier

@@ -1,16 +1,17 @@
#
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'flutter_qr'
s.version = '0.0.1'
s.summary = 'A new Flutter project.'
s.name = 'qr_code_scanner'
s.version = '0.0.2'
s.summary = 'QR Code Scanner for flutter.'
s.description = <<-DESC
A new Flutter project.
DESC
s.homepage = 'http://example.com'
s.homepage = 'https://github.com/juliuscanute/qr_code_scanner'
s.license = { :file => '../LICENSE' }
s.author = { 'Your Company' => 'email@example.com' }
s.author = { 'Your Company' => 'juliuscanute[*]touchcapture.net' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.public_header_files = 'Classes/**/*.h'

+ 3
- 3
pubspec.yaml Voir le fichier

@@ -1,8 +1,8 @@
name: qr_code_scanner
description: QR code scanner natively embedded inside flutter.
version: 0.0.1
description: QR code scanner that can be embedded inside flutter. It uses zxing in Android and MTBBarcode scanner in iOS.
version: 0.0.2
author: Julius Canute<juliuscanute[*]touchcapture.net>
homepage: https://medium.com/@juliuscanute
homepage: https://github.com/juliuscanute/qr_code_scanner

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"


Chargement…
Annuler
Enregistrer