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-10-23 12:09:55 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
785dd8f1a0b5833e7671fd3f2c7982bbd5c183ff
785dd8f1
1 parent
40a66bb1
add fromRawValue constructors to camera_facing, detection_speed and torch_state enums
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
0 deletions
lib/src/enums/camera_facing.dart
lib/src/enums/detection_speed.dart
lib/src/enums/torch_state.dart
lib/src/enums/camera_facing.dart
View file @
785dd8f
...
...
@@ -8,6 +8,17 @@ enum CameraFacing {
const
CameraFacing
(
this
.
rawValue
);
factory
CameraFacing
.
fromRawValue
(
int
value
)
{
switch
(
value
)
{
case
0
:
return
CameraFacing
.
front
;
case
1
:
return
CameraFacing
.
back
;
default
:
throw
ArgumentError
.
value
(
value
,
'value'
,
'Invalid raw value.'
);
}
}
/// The raw value for the camera facing direction.
final
int
rawValue
;
}
...
...
lib/src/enums/detection_speed.dart
View file @
785dd8f
...
...
@@ -18,6 +18,19 @@ enum DetectionSpeed {
const
DetectionSpeed
(
this
.
rawValue
);
factory
DetectionSpeed
.
fromRawValue
(
int
value
)
{
switch
(
value
)
{
case
0
:
return
DetectionSpeed
.
noDuplicates
;
case
1
:
return
DetectionSpeed
.
normal
;
case
2
:
return
DetectionSpeed
.
unrestricted
;
default
:
return
DetectionSpeed
.
normal
;
}
}
/// The raw value for the detection speed.
final
int
rawValue
;
}
...
...
lib/src/enums/torch_state.dart
View file @
785dd8f
...
...
@@ -8,6 +8,17 @@ enum TorchState {
const
TorchState
(
this
.
rawValue
);
factory
TorchState
.
fromRawValue
(
int
value
)
{
switch
(
value
)
{
case
0
:
return
TorchState
.
off
;
case
1
:
return
TorchState
.
on
;
default
:
throw
ArgumentError
.
value
(
value
,
'value'
,
'Invalid raw value.'
);
}
}
/// The raw value for the torch state.
final
int
rawValue
;
}
...
...
Please
register
or
login
to post a comment