This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class QRScannerOverlay extends StatelessWidget { | |
const QRScannerOverlay({Key? key, required this.overlayColour}) | |
: super(key: key); | |
final Color overlayColour; | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body: Stack( | |
children: [ | |
MobileScanner( | |
allowDuplicates: false, | |
controller: cameraController, | |
onDetect: (barcode, args) { | |
final String? code = barcode.rawValue; | |
debugPrint('Barcode found! $code'); | |
}), | |
QRScannerOverlay(overlayColour: Colors.black.withOpacity(0.5)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class QRScannerOverlay extends StatelessWidget { | |
const QRScannerOverlay({Key? key, required this.overlayColour}) | |
: super(key: key); | |
final Color overlayColour; | |
@override | |
Widget build(BuildContext context) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MobileScannerController cameraController = MobileScannerController(); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Mobile Scanner'), | |
actions: [ | |
IconButton( | |
color: Colors.white, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:mobile_scanner/mobile_scanner.dart'; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: const Text('Mobile Scanner')), | |
body: MobileScanner( | |
allowDuplicates: false, | |
onDetect: (barcode, args) { | |
final String? code = barcode.rawValue; |