Explorar el Código

flash light support added

flutter-beta
TheJuliuscanute hace 7 años
padre
commit
7f431827c6
Se han modificado 7 ficheros con 39 adiciones y 6 borrados
  1. +4
    -0
      CHANGELOG.md
  2. +10
    -0
      android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRView.kt
  3. +3
    -3
      example/README.md
  4. +1
    -1
      example/lib/main.dart
  5. +15
    -1
      ios/Classes/QRView.swift
  6. +5
    -0
      lib/qr_code_scanner.dart
  7. +1
    -1
      pubspec.yaml

+ 4
- 0
CHANGELOG.md Ver fichero

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

* flash light support added

## 0.0.6

* camera flip added


+ 10
- 0
android/src/main/kotlin/net/touchcapture/qr/flutterqr/QRView.kt Ver fichero

@@ -80,6 +80,13 @@ class QRView(context: Context, private val registrar: PluginRegistry.Registrar,
barcodeView?.resume()
}

fun flipFlash() {
barcodeView?.pause()
var settings = barcodeView?.cameraSettings
settings?.isAutoTorchEnabled = ! (settings?.isAutoTorchEnabled?:false)
barcodeView?.resume()
}


override fun getView(): View {
return initBarCodeView()?.apply {
@@ -137,6 +144,9 @@ class QRView(context: Context, private val registrar: PluginRegistry.Registrar,
"flipCamera" -> {
flipCamera()
}
"flipFlash" -> {
flipFlash()
}
}
}



+ 3
- 3
example/README.md Ver fichero

@@ -1,9 +1,9 @@
# qr_code_scanner

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

###info.plist
## iOS Support:
### info.plist
```xml
<dict>
<key>io.flutter.embedded_views_preview</key>
@@ -19,7 +19,7 @@ Demonstrates how to use the qr_code_scanner plugin.

```

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


+ 1
- 1
example/lib/main.dart Ver fichero

@@ -36,7 +36,7 @@ class _QRViewExampleState extends State<QRViewExample> {
RaisedButton(
onPressed: (){
if(controller != null){
controller.flipCamera();
controller.flipFlash();
}
},
child: Text(


+ 15
- 1
ios/Classes/QRView.swift Ver fichero

@@ -48,6 +48,8 @@ public class QRView:NSObject,FlutterPlatformView {
self?.setDimensions(width: arguments["width"] ?? 0,height: arguments["height"] ?? 0)
case "flipCamera":
self?.flipCamera()
case "flipFlash":
self?.flipFlash()
default:
result(FlutterMethodNotImplemented)
return
@@ -63,6 +65,18 @@ public class QRView:NSObject,FlutterPlatformView {
}
func flipCamera(){
scanner?.flipCamera()
if let sc: MTBBarcodeScanner = scanner {
if sc.hasOppositeCamera() {
sc.flipCamera()
}
}
}
func flipFlash(){
if let sc: MTBBarcodeScanner = scanner {
if sc.hasTorch() {
sc.toggleTorch()
}
}
}
}

+ 5
- 0
lib/qr_code_scanner.dart Ver fichero

@@ -86,4 +86,9 @@ class QRViewController {
void flipCamera(){
channel.invokeMethod("flipCamera");
}

void flipFlash(){
channel.invokeMethod("flipFlash");
}

}

+ 1
- 1
pubspec.yaml Ver fichero

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



Cargando…
Cancelar
Guardar