Navaron Bracke

replace mobile_scanner_arguments with a platform agnostic equivalent

... ... @@ -21,7 +21,6 @@ export 'src/objects/contact_info.dart';
export 'src/objects/driver_license.dart';
export 'src/objects/email.dart';
export 'src/objects/geo_point.dart';
export 'src/objects/mobile_scanner_arguments.dart';
export 'src/objects/person_name.dart';
export 'src/objects/phone.dart';
export 'src/objects/sms.dart';
... ...
import 'package:flutter/widgets.dart';
import 'package:mobile_scanner/src/mobile_scanner_view_attributes.dart';
/// An implementation for [MobileScannerViewAttributes] for platforms that provide a [Texture].
class MobileScannerTextureViewAttributes
implements MobileScannerViewAttributes {
const MobileScannerTextureViewAttributes({
required this.textureId,
required this.hasTorch,
required this.size,
});
/// The id of the [Texture].
final int textureId;
@override
final bool hasTorch;
@override
final Size size;
}
... ...
import 'dart:ui';
/// This interface defines the attributes for the mobile scanner view.
abstract class MobileScannerViewAttributes {
/// Whether the current active camera has a torch.
bool get hasTorch;
/// The size of the camera output.
Size get size;
}
... ...
import 'package:flutter/material.dart';
/// The start arguments of the scanner.
class MobileScannerArguments {
/// The output size of the camera.
/// This value can be used to draw a box in the image.
final Size size;
/// A bool which is true if the device has a torch.
final bool hasTorch;
/// The texture id of the capture used internally.
final int? textureId;
/// The texture id of the capture used internally if device is web.
final String? webId;
/// Indicates how many cameras are available.
///
/// Currently only supported on Android.
final int? numberOfCameras;
MobileScannerArguments({
required this.size,
required this.hasTorch,
this.textureId,
this.webId,
this.numberOfCameras,
});
}
import 'package:flutter/widgets.dart';
import 'package:mobile_scanner/src/mobile_scanner_view_attributes.dart';
/// An implementation for [MobileScannerViewAttributes] for the web.
class MobileScannerHtmlViewAttributes implements MobileScannerViewAttributes {
const MobileScannerHtmlViewAttributes({
required this.htmlElementViewType,
required this.hasTorch,
required this.size,
});
@override
final bool hasTorch;
/// The [HtmlElementView.viewType] for the underlying [HtmlElementView].
final String htmlElementViewType;
@override
final Size size;
}
... ...