BarcodeBillScanner class
Widget used to read and convert a barcode.
It shows a friendly interface guiding the user to scan the barcode using the phone's camera. Este widget serve como tela para exibição da câmera que faz a leitura do código de barras.
Example:
@override
Widget build(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: [
BarcodeBillScanner(
onCancelLabel: "You can set a message to cancel an action",
onSuccess: (String value) async {
setState(() => barcode = value);
},
onCancel: () {
setState(() => barcode = null);
},
),
if (barcode != null)
Text(
barcode!,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 20.0,
color: Colors.amber,
),
),
],
);
}
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BarcodeBillScanner
Constructors
- BarcodeBillScanner({Key? key, String infoText = "Scan the barcode using your camera.", required Future onSuccess(String value), dynamic onAction()?, required dynamic onCancel(), dynamic onError()?, String onActionLabel = "Type barcode", Color color = Colors.cyan, Color textColor = const Color(0xff696876), bool convertToFebraban = true, Color backdropColor = const Color(0x99000000)})
-
const
Properties
- backdropColor → Color
-
Backdrop color used as a frame for reading the barcode.
final
- color → Color
-
Main color.
final
- convertToFebraban → bool
-
If
true
converts the barcode to FEBRABAN format (47/48 characters long).final - hashCode → int
-
The hash code for this object.
no setterinherited
- infoText → String
-
Text shown on top of the screen.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onAction → (dynamic Function()?)
-
Method called by the action button.
final
- onActionLabel → String
-
Label for the action button.
final
- onCancel → dynamic Function()
-
Method called by the cancel button.
final
- onError → (dynamic Function()?)
-
Method called on error while reading the barcode.
final
- onSuccess → Future Function(String value)
-
Method called after the barcode is successfuly read and converted.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textColor → Color
-
Text color. Must have enough contrast with color.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → BarcodeMLKitState -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children.inherited -
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited