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 17:05:12 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3c5a6091564f192f64f401ea8b29cd543078aac9
3c5a6091
1 parent
8be5281e
implement mobile scanner state as a model class
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
lib/mobile_scanner.dart
lib/src/objects/mobile_scanner_state.dart
lib/mobile_scanner.dart
View file @
3c5a609
...
...
@@ -21,6 +21,7 @@ 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_state.dart'
;
export
'src/objects/person_name.dart'
;
export
'src/objects/phone.dart'
;
export
'src/objects/sms.dart'
;
...
...
lib/src/objects/mobile_scanner_state.dart
0 → 100644
View file @
3c5a609
import
'dart:ui'
;
import
'package:mobile_scanner/src/enums/camera_facing.dart'
;
import
'package:mobile_scanner/src/enums/torch_state.dart'
;
import
'package:mobile_scanner/src/mobile_scanner_exception.dart'
;
/// This class represents the current state of a [MobileScannerController].
class
MobileScannerState
{
/// Create a new [MobileScannerState] instance.
const
MobileScannerState
({
required
this
.
cameraDirection
,
required
this
.
isInitialized
,
required
this
.
size
,
required
this
.
torchState
,
required
this
.
zoomScale
,
this
.
error
,
});
/// Create a new [MobileScannerState] instance that is uninitialized.
const
MobileScannerState
.
uninitialized
(
CameraFacing
facing
)
:
this
(
cameraDirection:
facing
,
isInitialized:
false
,
size:
Size
.
zero
,
torchState:
TorchState
.
unavailable
,
zoomScale:
1.0
,
);
/// The facing direction of the camera.
final
CameraFacing
cameraDirection
;
/// The error that occurred while setting up or using the canera.
final
MobileScannerException
?
error
;
/// Whether the mobile scanner has initialized successfully.
final
bool
isInitialized
;
/// The size of the camera output.
final
Size
size
;
/// The current state of the flashlight of the camera.
final
TorchState
torchState
;
/// The current zoom scale of the camera.
final
double
zoomScale
;
/// Create a copy of this state with the given parameters.
MobileScannerState
copyWith
({
CameraFacing
?
cameraDirection
,
MobileScannerException
?
error
,
bool
?
isInitialized
,
Size
?
size
,
TorchState
?
torchState
,
double
?
zoomScale
,
})
{
return
MobileScannerState
(
cameraDirection:
cameraDirection
??
this
.
cameraDirection
,
error:
error
,
isInitialized:
isInitialized
??
this
.
isInitialized
,
size:
size
??
this
.
size
,
torchState:
torchState
??
this
.
torchState
,
zoomScale:
zoomScale
??
this
.
zoomScale
,
);
}
}
...
...
Please
register
or
login
to post a comment