Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2023-11-08 15:00:15 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1feb506cb30c7c8b5177ace77e3148945c8ca1b4
1feb506c
1 parent
4d4cf733
create a new start options class
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
lib/src/objects/start_options.dart
lib/src/objects/start_options.dart
0 → 100644
View file @
1feb506
import
'dart:ui'
;
import
'package:mobile_scanner/src/enums/barcode_format.dart'
;
import
'package:mobile_scanner/src/enums/camera_facing.dart'
;
import
'package:mobile_scanner/src/enums/detection_speed.dart'
;
/// This class defines the different start options for the mobile scanner.
class
StartOptions
{
const
StartOptions
({
required
this
.
cameraDirection
,
required
this
.
cameraResolution
,
required
this
.
detectionSpeed
,
required
this
.
detectionTimeoutMs
,
required
this
.
formats
,
required
this
.
returnImage
,
required
this
.
torchEnabled
,
});
/// The direction for the camera.
final
CameraFacing
cameraDirection
;
/// The desired camera resolution for the scanner.
final
Size
?
cameraResolution
;
/// The detection speed for the scanner.
final
DetectionSpeed
detectionSpeed
;
/// The detection timeout for the scanner, in milliseconds.
final
int
detectionTimeoutMs
;
/// The barcode formats to detect.
final
List
<
BarcodeFormat
>
formats
;
/// Whether the detected barcodes should provide their image data.
final
bool
returnImage
;
/// Whether the torch should be turned on when the scanner starts.
final
bool
torchEnabled
;
Map
<
String
,
Object
?>
toMap
()
{
return
<
String
,
Object
?>{
if
(
cameraResolution
!=
null
)
'cameraResolution'
:
<
int
>[
cameraResolution
!.
width
.
toInt
(),
cameraResolution
!.
height
.
toInt
(),
],
'facing'
:
cameraDirection
.
rawValue
,
if
(
formats
.
isNotEmpty
)
'formats'
:
formats
.
map
((
f
)
=>
f
.
rawValue
).
toList
(),
'returnImage'
:
returnImage
,
'speed'
:
detectionSpeed
.
rawValue
,
'timeout'
:
detectionTimeoutMs
,
'torch'
:
torchEnabled
,
};
}
}
...
...
Please
register
or
login
to post a comment