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-16 15:47:40 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
14972d97161f1cefdf361577e53bcb05859bcbb2
14972d97
1 parent
68a7a49c
add scanned barcode label widget
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
example/lib/scanned_barcode_label.dart
example/lib/scanned_barcode_label.dart
0 → 100644
View file @
14972d9
import
'package:flutter/material.dart'
;
import
'package:mobile_scanner/mobile_scanner.dart'
;
class
ScannedBarcodeLabel
extends
StatelessWidget
{
const
ScannedBarcodeLabel
({
super
.
key
,
required
this
.
barcodes
,
});
final
Stream
<
BarcodeCapture
>
barcodes
;
@override
Widget
build
(
BuildContext
context
)
{
return
StreamBuilder
(
stream:
barcodes
,
builder:
(
context
,
snaphot
)
{
final
scannedBarcodes
=
snaphot
.
data
?.
barcodes
??
[];
if
(
scannedBarcodes
.
isEmpty
)
{
return
const
Text
(
'Scan something!'
,
overflow:
TextOverflow
.
fade
,
style:
TextStyle
(
color:
Colors
.
white
),
);
}
return
Text
(
scannedBarcodes
.
first
.
displayValue
??
'No display value.'
,
overflow:
TextOverflow
.
fade
,
style:
const
TextStyle
(
color:
Colors
.
white
),
);
},
);
}
}
...
...
Please
register
or
login
to post a comment