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-12-08 11:59:07 +0100
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2022-12-08 11:59:07 +0100
Commit
115e1a481801f67fc77a025d884f746410d48999
115e1a48
2 parents
9323fb0a
3c14a1fa
Merge branch 'master' into dependabot/gradle/example/android/kotlin_version-1.7.22
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
8 deletions
CHANGELOG.md
lib/src/mobile_scanner_controller.dart
lib/src/mobile_scanner_exception.dart
macos/Classes/MobileScannerPlugin.swift
CHANGELOG.md
View file @
115e1a4
...
...
@@ -15,16 +15,22 @@ Breaking changes:
Improvements:
*
Toggling the device torch now does nothing if the device has no torch, rather than throwing an error.
*
Removed
`called stop while already stopped`
messages.
Features:
*
Added a new
`placeholderBuilder` function to the `MobileScanner`
widget to customize the preview placeholder.
*
Added
`autoStart`
parameter to MobileScannerController(). If set to false, controller won't start automatically.
Fixed:
*
Fixed a memory leak where the
`MobileScanner`
widget would never close its subscription to the barcode events.
*
Fixed a dependency on all properties of
`MediaQueryData`
to build the preview widget. Now the preview only depends on its layout constraints.
*
Added
`hasTorch`
function on MobileScannerController(). After starting the controller, you can check if the device has a torch.
Fixes:
*
Fixes the missing gradle setup for the Android project, which prevented gradle sync from working.
*
Fixes
`MobileScannerController.stop()`
throwing when already stopped.
*
Fixes
`MobileScannerController.toggleTorch()`
throwing if the device has no torch.
Now it does nothing if the torch is not available.
*
Fixes a memory leak where the
`MobileScanner`
would keep listening to the barcode events.
*
Fixes the
`MobileScanner` preview depending on all attributes of `MediaQueryData`
.
Now it only depends on its layout constraints.
*
Fixed a potential crash when the scanner is restarted due to the app being resumed.
*
Various documentation improvements.
## 3.0.0-beta.2
Breaking changes:
...
...
lib/src/mobile_scanner_controller.dart
View file @
115e1a4
...
...
@@ -101,6 +101,19 @@ class MobileScannerController {
bool
?
_hasTorch
;
/// Returns whether the device has a torch.
///
/// Throws an error if the controller is not initialized.
bool
get
hasTorch
{
if
(
_hasTorch
==
null
)
{
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
controllerUninitialized
,
);
}
return
_hasTorch
!;
}
/// Set the starting arguments for the camera
Map
<
String
,
dynamic
>
_argumentsToMap
({
CameraFacing
?
cameraFacingOverride
})
{
final
Map
<
String
,
dynamic
>
arguments
=
{};
...
...
lib/src/mobile_scanner_exception.dart
View file @
115e1a4
...
...
@@ -12,6 +12,14 @@ class MobileScannerException implements Exception {
/// The additional error details that came with the [errorCode].
final
MobileScannerErrorDetails
?
errorDetails
;
@override
String
toString
()
{
if
(
errorDetails
!=
null
&&
errorDetails
?.
message
!=
null
)
{
return
"MobileScannerException: code
${errorCode.name}
, message:
${errorDetails?.message}
"
;
}
return
"MobileScannerException:
${errorCode.name}
"
;
}
}
/// The raw error details for a [MobileScannerException].
...
...
macos/Classes/MobileScannerPlugin.swift
View file @
115e1a4
...
...
@@ -238,9 +238,7 @@ public class MobileScannerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler,
func
toggleTorch
(
_
call
:
FlutterMethodCall
,
_
result
:
@escaping
FlutterResult
)
{
if
(
device
==
nil
)
{
result
(
FlutterError
(
code
:
"MobileScanner"
,
message
:
"Called toggleTorch() while stopped!"
,
details
:
nil
))
result
(
nil
)
return
}
do
{
...
...
Please
register
or
login
to post a comment