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-03-10 16:12:16 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fa4bebf53d49d36e76892c58a5e2fdb587c96dbf
fa4bebf5
1 parent
80364d05
style: format
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
39 deletions
example/lib/barcode_scanner_controller.dart
lib/src/mobile_scanner.dart
lib/src/mobile_scanner_controller.dart
lib/src/web/qr-scanner.dart → lib/src/web/qr_scanner.dart
example/lib/barcode_scanner_controller.dart
View file @
fa4bebf
...
...
@@ -16,10 +16,10 @@ class _BarcodeScannerWithControllerState
String
?
barcode
;
MobileScannerController
controller
=
MobileScannerController
(
torchEnabled:
true
,
// formats: [BarcodeFormat.qrCode]
// facing: CameraFacing.front,
);
torchEnabled:
true
,
// formats: [BarcodeFormat.qrCode]
// facing: CameraFacing.front,
);
bool
isStarted
=
true
;
...
...
lib/src/mobile_scanner.dart
View file @
fa4bebf
...
...
@@ -60,41 +60,36 @@ class _MobileScannerState extends State<MobileScanner>
@override
Widget
build
(
BuildContext
context
)
{
return
LayoutBuilder
(
builder:
(
context
,
BoxConstraints
constraints
)
{
return
ValueListenableBuilder
(
valueListenable:
controller
.
args
,
builder:
(
context
,
value
,
child
)
{
value
=
value
as
MobileScannerArguments
?;
if
(
value
==
null
)
{
return
Container
(
color:
Colors
.
black
);
}
else
{
controller
.
barcodes
.
listen
(
(
a
)
=>
widget
.
onDetect
!(
a
,
value
as
MobileScannerArguments
));
return
ClipRect
(
child:
SizedBox
(
width:
MediaQuery
.
of
(
context
)
.
size
.
width
,
height:
MediaQuery
.
of
(
context
)
.
size
.
height
,
child:
FittedBox
(
fit:
widget
.
fit
,
child:
SizedBox
(
width:
value
.
size
.
width
,
height:
value
.
size
.
height
,
child:
kIsWeb
?
HtmlElementView
(
viewType:
value
.
webId
!)
:
Texture
(
textureId:
value
.
textureId
!),
),
return
LayoutBuilder
(
builder:
(
context
,
BoxConstraints
constraints
)
{
return
ValueListenableBuilder
(
valueListenable:
controller
.
args
,
builder:
(
context
,
value
,
child
)
{
value
=
value
as
MobileScannerArguments
?;
if
(
value
==
null
)
{
return
Container
(
color:
Colors
.
black
);
}
else
{
controller
.
barcodes
.
listen
(
(
a
)
=>
widget
.
onDetect
!(
a
,
value
as
MobileScannerArguments
));
return
ClipRect
(
child:
SizedBox
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
height:
MediaQuery
.
of
(
context
).
size
.
height
,
child:
FittedBox
(
fit:
widget
.
fit
,
child:
SizedBox
(
width:
value
.
size
.
width
,
height:
value
.
size
.
height
,
child:
kIsWeb
?
HtmlElementView
(
viewType:
value
.
webId
!)
:
Texture
(
textureId:
value
.
textureId
!),
),
),
);
}
});
});
}
),
);
}
});
});
}
@override
void
didUpdateWidget
(
covariant
MobileScanner
oldWidget
)
{
...
...
lib/src/mobile_scanner_controller.dart
View file @
fa4bebf
...
...
@@ -6,7 +6,6 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/services.dart'
;
import
'package:mobile_scanner/mobile_scanner.dart'
;
import
'mobile_scanner_arguments.dart'
;
import
'objects/barcode_utility.dart'
;
/// The facing of a camera.
...
...
@@ -188,7 +187,6 @@ class MobileScannerController {
size:
Size
(
startResult
[
'videoWidth'
],
startResult
[
'videoHeight'
]),
hasTorch:
hasTorch
);
}
else
{
args
.
value
=
MobileScannerArguments
(
textureId:
startResult
[
'textureId'
],
size:
toSize
(
startResult
[
'size'
]),
...
...
lib/src/web/qr
-
scanner.dart → lib/src/web/qr
_
scanner.dart
View file @
fa4bebf
Please
register
or
login
to post a comment