Showing
3 changed files
with
18 additions
and
2 deletions
| @@ -177,8 +177,6 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | @@ -177,8 +177,6 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | ||
| 177 | await methodChannel.invokeMethod<void>('resetScale'); | 177 | await methodChannel.invokeMethod<void>('resetScale'); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | - // TODO: remove the 'torch' function from native | ||
| 181 | - | ||
| 182 | @override | 180 | @override |
| 183 | Future<void> setZoomScale(double zoomScale) async { | 181 | Future<void> setZoomScale(double zoomScale) async { |
| 184 | await methodChannel.invokeMethod<void>('setScale', zoomScale); | 182 | await methodChannel.invokeMethod<void>('setScale', zoomScale); |
| @@ -275,6 +273,11 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | @@ -275,6 +273,11 @@ class MethodChannelMobileScanner extends MobileScannerPlatform { | ||
| 275 | } | 273 | } |
| 276 | 274 | ||
| 277 | @override | 275 | @override |
| 276 | + Future<void> toggleTorch() async { | ||
| 277 | + await methodChannel.invokeMethod<void>('toggleTorch'); | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + @override | ||
| 278 | Future<void> updateScanWindow(Rect? window) async { | 281 | Future<void> updateScanWindow(Rect? window) async { |
| 279 | if (_textureId == null) { | 282 | if (_textureId == null) { |
| 280 | return; | 283 | return; |
| @@ -90,6 +90,11 @@ abstract class MobileScannerPlatform extends PlatformInterface { | @@ -90,6 +90,11 @@ abstract class MobileScannerPlatform extends PlatformInterface { | ||
| 90 | throw UnimplementedError('stop() has not been implemented.'); | 90 | throw UnimplementedError('stop() has not been implemented.'); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | + /// Toggle the torch on the active camera on or off. | ||
| 94 | + Future<void> toggleTorch() { | ||
| 95 | + throw UnimplementedError('toggleTorch() has not been implemented.'); | ||
| 96 | + } | ||
| 97 | + | ||
| 93 | /// Update the scan window to the given [window] rectangle. | 98 | /// Update the scan window to the given [window] rectangle. |
| 94 | /// | 99 | /// |
| 95 | /// Any barcodes that do not intersect with the given [window] will be ignored. | 100 | /// Any barcodes that do not intersect with the given [window] will be ignored. |
| @@ -355,6 +355,14 @@ class MobileScannerWeb extends MobileScannerPlatform { | @@ -355,6 +355,14 @@ class MobileScannerWeb extends MobileScannerPlatform { | ||
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | @override | 357 | @override |
| 358 | + Future<void> toggleTorch() { | ||
| 359 | + throw UnsupportedError( | ||
| 360 | + 'Setting the torch state is not supported for video tracks on the web.\n' | ||
| 361 | + 'See https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#instance_properties_of_video_tracks', | ||
| 362 | + ); | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + @override | ||
| 358 | Future<void> updateScanWindow(Rect? window) { | 366 | Future<void> updateScanWindow(Rect? window) { |
| 359 | // A scan window is not supported on the web, | 367 | // A scan window is not supported on the web, |
| 360 | // because the scanner does not expose size information for the barcodes. | 368 | // because the scanner does not expose size information for the barcodes. |
-
Please register or login to post a comment