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
Navaron Bracke
2023-11-09 14:58:24 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d19e94ab1911c68b3a7415e2c9bb1c3e32a6e0a9
d19e94ab
1 parent
cb3364b6
add sample for scan window in documentation
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
lib/src/mobile_scanner.dart
lib/src/mobile_scanner.dart
View file @
d19e94a
...
...
@@ -64,12 +64,34 @@ class MobileScanner extends StatefulWidget {
/// If this is not null, the barcode scanner will only scan barcodes
/// which intersect this rectangle.
///
/// The rectangle is relative to the layout size of the *camera preview widget*,
/// rather than the actual camera preview size,
/// since the actual widget size might not be the same as the camera preview size.
/// This rectangle is relative to the layout size
/// of the *camera preview widget* in the widget tree,
/// rather than the actual size of the camera preview output.
/// This is because the size of the camera preview widget
/// might not be the same as the size of the camera output.
///
/// For example, the applied [fit] has an effect on the size of the camera preview widget,
/// while the camera preview size remains the same.
///
/// The following example shows a scan window that is centered,
/// fills half the height and one third of the width of the layout:
///
/// ```dart
/// LayoutBuider(
/// builder: (BuildContext context, BoxConstraints constraints) {
/// final Size layoutSize = constraints.biggest;
///
/// final double scanWindowWidth = layoutSize.width / 3;
/// final double scanWindowHeight = layoutSize.height / 2;
///
/// final Rect scanWindow = Rect.fromCenter(
/// center: layoutSize.center(Offset.zero),
/// width: scanWindowWidth,
/// height: scanWindowHeight,
/// );
/// }
/// );
/// ```
final
Rect
?
scanWindow
;
@override
...
...
@@ -80,7 +102,9 @@ class _MobileScannerState extends State<MobileScanner> {
/// The current scan window.
Rect
?
scanWindow
;
/// Recalculate the scan window based on the updated [constraints].
/// Calculate the scan window based on the given [constraints].
///
/// If the [scanWindow] is already set, this method does nothing.
void
_maybeUpdateScanWindow
(
MobileScannerState
scannerState
,
BoxConstraints
constraints
,
...
...
Please
register
or
login
to post a comment