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:43:44 +0100
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2022-12-08 11:43:44 +0100
Commit
944a3920ca600c910830338fb8e9d1cebf8f4d19
944a3920
2 parents
208d2486
842fba94
Merge pull request #400 from juliansteenbakker/imp/error-handling
imp: error handling
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
8 deletions
CHANGELOG.md
lib/src/mobile_scanner_controller.dart
macos/Classes/MobileScannerPlugin.swift
CHANGELOG.md
View file @
944a392
...
...
@@ -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 @
944a392
...
...
@@ -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
=
{};
...
...
macos/Classes/MobileScannerPlugin.swift
View file @
944a392
...
...
@@ -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