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
Miyayu
2022-06-08 14:07:21 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d94ffe4e196122cc942a743f60dd705d344a142a
d94ffe4e
1 parent
e5b455c0
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 @
d94ffe4
...
...
@@ -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 @
d94ffe4
...
...
@@ -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