replace mobile_scanner_arguments with a platform agnostic equivalent
Showing
5 changed files
with
53 additions
and
31 deletions
| @@ -21,7 +21,6 @@ export 'src/objects/contact_info.dart'; | @@ -21,7 +21,6 @@ export 'src/objects/contact_info.dart'; | ||
| 21 | export 'src/objects/driver_license.dart'; | 21 | export 'src/objects/driver_license.dart'; |
| 22 | export 'src/objects/email.dart'; | 22 | export 'src/objects/email.dart'; |
| 23 | export 'src/objects/geo_point.dart'; | 23 | export 'src/objects/geo_point.dart'; |
| 24 | -export 'src/objects/mobile_scanner_arguments.dart'; | ||
| 25 | export 'src/objects/person_name.dart'; | 24 | export 'src/objects/person_name.dart'; |
| 26 | export 'src/objects/phone.dart'; | 25 | export 'src/objects/phone.dart'; |
| 27 | export 'src/objects/sms.dart'; | 26 | export 'src/objects/sms.dart'; |
| 1 | +import 'package:flutter/widgets.dart'; | ||
| 2 | + | ||
| 3 | +import 'package:mobile_scanner/src/mobile_scanner_view_attributes.dart'; | ||
| 4 | + | ||
| 5 | +/// An implementation for [MobileScannerViewAttributes] for platforms that provide a [Texture]. | ||
| 6 | +class MobileScannerTextureViewAttributes | ||
| 7 | + implements MobileScannerViewAttributes { | ||
| 8 | + const MobileScannerTextureViewAttributes({ | ||
| 9 | + required this.textureId, | ||
| 10 | + required this.hasTorch, | ||
| 11 | + required this.size, | ||
| 12 | + }); | ||
| 13 | + | ||
| 14 | + /// The id of the [Texture]. | ||
| 15 | + final int textureId; | ||
| 16 | + | ||
| 17 | + @override | ||
| 18 | + final bool hasTorch; | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + final Size size; | ||
| 22 | +} |
lib/src/mobile_scanner_view_attributes.dart
0 → 100644
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | - | ||
| 3 | -/// The start arguments of the scanner. | ||
| 4 | -class MobileScannerArguments { | ||
| 5 | - /// The output size of the camera. | ||
| 6 | - /// This value can be used to draw a box in the image. | ||
| 7 | - final Size size; | ||
| 8 | - | ||
| 9 | - /// A bool which is true if the device has a torch. | ||
| 10 | - final bool hasTorch; | ||
| 11 | - | ||
| 12 | - /// The texture id of the capture used internally. | ||
| 13 | - final int? textureId; | ||
| 14 | - | ||
| 15 | - /// The texture id of the capture used internally if device is web. | ||
| 16 | - final String? webId; | ||
| 17 | - | ||
| 18 | - /// Indicates how many cameras are available. | ||
| 19 | - /// | ||
| 20 | - /// Currently only supported on Android. | ||
| 21 | - final int? numberOfCameras; | ||
| 22 | - | ||
| 23 | - MobileScannerArguments({ | ||
| 24 | - required this.size, | ||
| 25 | - required this.hasTorch, | ||
| 26 | - this.textureId, | ||
| 27 | - this.webId, | ||
| 28 | - this.numberOfCameras, | ||
| 29 | - }); | ||
| 30 | -} |
| 1 | +import 'package:flutter/widgets.dart'; | ||
| 2 | + | ||
| 3 | +import 'package:mobile_scanner/src/mobile_scanner_view_attributes.dart'; | ||
| 4 | + | ||
| 5 | +/// An implementation for [MobileScannerViewAttributes] for the web. | ||
| 6 | +class MobileScannerHtmlViewAttributes implements MobileScannerViewAttributes { | ||
| 7 | + const MobileScannerHtmlViewAttributes({ | ||
| 8 | + required this.htmlElementViewType, | ||
| 9 | + required this.hasTorch, | ||
| 10 | + required this.size, | ||
| 11 | + }); | ||
| 12 | + | ||
| 13 | + @override | ||
| 14 | + final bool hasTorch; | ||
| 15 | + | ||
| 16 | + /// The [HtmlElementView.viewType] for the underlying [HtmlElementView]. | ||
| 17 | + final String htmlElementViewType; | ||
| 18 | + | ||
| 19 | + @override | ||
| 20 | + final Size size; | ||
| 21 | +} |
-
Please register or login to post a comment