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
Julian Steenbakker
2022-07-21 08:51:31 +0200
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2022-07-21 08:51:31 +0200
Commit
600d4ef475e2e63218cb664f23f48d5521e9d3d2
600d4ef4
2 parents
e5b455c0
d94ffe4e
Merge pull request #180 from yuchan2215/feature
add autoResume Option
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
lib/src/mobile_scanner.dart
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner.dart
View file @
600d4ef
...
...
@@ -55,7 +55,7 @@ class _MobileScannerState extends State<MobileScanner>
void
didChangeAppLifecycleState
(
AppLifecycleState
state
)
{
switch
(
state
)
{
case
AppLifecycleState
.
resumed
:
if
(!
controller
.
isStarting
)
controller
.
start
();
if
(!
controller
.
isStarting
&&
controller
.
autoResume
)
controller
.
start
();
break
;
case
AppLifecycleState
.
inactive
:
case
AppLifecycleState
.
paused
:
...
...
lib/src/mobile_scanner_controller.dart
View file @
600d4ef
...
...
@@ -53,6 +53,9 @@ class MobileScannerController {
bool
hasTorch
=
false
;
late
StreamController
<
Barcode
>
barcodesController
;
/// Whether to automatically resume the camera when the application is resumed
bool
autoResume
;
Stream
<
Barcode
>
get
barcodes
=>
barcodesController
.
stream
;
MobileScannerController
({
...
...
@@ -60,6 +63,7 @@ class MobileScannerController {
this
.
ratio
,
this
.
torchEnabled
,
this
.
formats
,
this
.
autoResume
=
true
,
})
{
// In case a new instance is created before calling dispose()
if
(
_controllerHashcode
!=
null
)
{
...
...
Please
register
or
login
to post a comment