Showing
3 changed files
with
9 additions
and
47 deletions
| 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 | -} |
| 1 | import 'dart:ui'; | 1 | import 'dart:ui'; |
| 2 | 2 | ||
| 3 | -/// This interface defines the attributes for the mobile scanner view. | ||
| 4 | -abstract class MobileScannerViewAttributes { | 3 | +/// This class defines the attributes for the mobile scanner view. |
| 4 | +class MobileScannerViewAttributes { | ||
| 5 | + const MobileScannerViewAttributes({ | ||
| 6 | + required this.hasTorch, | ||
| 7 | + required this.size, | ||
| 8 | + }); | ||
| 9 | + | ||
| 5 | /// Whether the current active camera has a torch. | 10 | /// Whether the current active camera has a torch. |
| 6 | - bool get hasTorch; | 11 | + final bool hasTorch; |
| 7 | 12 | ||
| 8 | /// The size of the camera output. | 13 | /// The size of the camera output. |
| 9 | - Size get size; | 14 | + final Size size; |
| 10 | } | 15 | } |
| 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