Skip to content

Instantly share code, notes, and snippets.

View r-yeates's full-sized avatar
🦜

Rob Yeates r-yeates

🦜
  • United Kingdom
  • 22:27 (UTC)
View GitHub Profile
@r-yeates
r-yeates / qr_overlay.dart
Created March 22, 2022 09:03
Overlay for QR scanner package mobile_scanner
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) {
@r-yeates
r-yeates / main.dart
Last active September 1, 2022 03:44
Junk Free main.dart
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) {
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)),
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) {
MobileScannerController cameraController = MobileScannerController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Mobile Scanner'),
actions: [
IconButton(
color: Colors.white,
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;