| @@ -1,3 +1,7 @@ | |||||
| ## 0.0.7 | |||||
| * flash light support added | |||||
| ## 0.0.6 | ## 0.0.6 | ||||
| * camera flip added | * camera flip added | ||||
| @@ -80,6 +80,13 @@ class QRView(context: Context, private val registrar: PluginRegistry.Registrar, | |||||
| barcodeView?.resume() | barcodeView?.resume() | ||||
| } | } | ||||
| fun flipFlash() { | |||||
| barcodeView?.pause() | |||||
| var settings = barcodeView?.cameraSettings | |||||
| settings?.isAutoTorchEnabled = ! (settings?.isAutoTorchEnabled?:false) | |||||
| barcodeView?.resume() | |||||
| } | |||||
| override fun getView(): View { | override fun getView(): View { | ||||
| return initBarCodeView()?.apply { | return initBarCodeView()?.apply { | ||||
| @@ -137,6 +144,9 @@ class QRView(context: Context, private val registrar: PluginRegistry.Registrar, | |||||
| "flipCamera" -> { | "flipCamera" -> { | ||||
| flipCamera() | flipCamera() | ||||
| } | } | ||||
| "flipFlash" -> { | |||||
| flipFlash() | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,9 +1,9 @@ | |||||
| # qr_code_scanner | # qr_code_scanner | ||||
| Demonstrates how to use the qr_code_scanner plugin. | Demonstrates how to use the qr_code_scanner plugin. | ||||
| ##iOS Support: | |||||
| ###info.plist | |||||
| ## iOS Support: | |||||
| ### info.plist | |||||
| ```xml | ```xml | ||||
| <dict> | <dict> | ||||
| <key>io.flutter.embedded_views_preview</key> | <key>io.flutter.embedded_views_preview</key> | ||||
| @@ -19,7 +19,7 @@ Demonstrates how to use the qr_code_scanner plugin. | |||||
| ``` | ``` | ||||
| ##Example: | |||||
| ## Example: | |||||
| ```dart | ```dart | ||||
| import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/services.dart'; | import 'package:flutter/services.dart'; | ||||
| @@ -36,7 +36,7 @@ class _QRViewExampleState extends State<QRViewExample> { | |||||
| RaisedButton( | RaisedButton( | ||||
| onPressed: (){ | onPressed: (){ | ||||
| if(controller != null){ | if(controller != null){ | ||||
| controller.flipCamera(); | |||||
| controller.flipFlash(); | |||||
| } | } | ||||
| }, | }, | ||||
| child: Text( | child: Text( | ||||
| @@ -48,6 +48,8 @@ public class QRView:NSObject,FlutterPlatformView { | |||||
| self?.setDimensions(width: arguments["width"] ?? 0,height: arguments["height"] ?? 0) | self?.setDimensions(width: arguments["width"] ?? 0,height: arguments["height"] ?? 0) | ||||
| case "flipCamera": | case "flipCamera": | ||||
| self?.flipCamera() | self?.flipCamera() | ||||
| case "flipFlash": | |||||
| self?.flipFlash() | |||||
| default: | default: | ||||
| result(FlutterMethodNotImplemented) | result(FlutterMethodNotImplemented) | ||||
| return | return | ||||
| @@ -63,6 +65,18 @@ public class QRView:NSObject,FlutterPlatformView { | |||||
| } | } | ||||
| func flipCamera(){ | 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() | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -86,4 +86,9 @@ class QRViewController { | |||||
| void flipCamera(){ | void flipCamera(){ | ||||
| channel.invokeMethod("flipCamera"); | channel.invokeMethod("flipCamera"); | ||||
| } | } | ||||
| void flipFlash(){ | |||||
| channel.invokeMethod("flipFlash"); | |||||
| } | |||||
| } | } | ||||
| @@ -1,6 +1,6 @@ | |||||
| name: qr_code_scanner | name: qr_code_scanner | ||||
| description: QR code scanner that can be embedded inside flutter. It uses zxing in Android and MTBBarcode scanner in iOS. | 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> | author: Julius Canute<juliuscanute[*]touchcapture.net> | ||||
| homepage: https://github.com/juliuscanute/qr_code_scanner | homepage: https://github.com/juliuscanute/qr_code_scanner | ||||