qr_bar_code_scanner_dialog 0.0.5 qr_bar_code_scanner_dialog: ^0.0.5 copied to clipboard
Plugin to show a simple scanner dialog and capture Bar/QR code easily. Works with Android iOS and Web. It uses html5-qrcode scanner for web and qr_code_scanner for Android and iOS
import 'package:flutter/material.dart';
import 'package:qr_bar_code_scanner_dialog/qr_bar_code_scanner_dialog.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _qrBarCodeScannerDialogPlugin = QrBarCodeScannerDialog();
String? code;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Builder(builder: (context) {
return Material(
child: Center(
child: ElevatedButton(
onPressed: () {
_qrBarCodeScannerDialogPlugin.getScannedQrBarCode(
context: context,
onCode: (code) {
setState(() {
this.code = code;
});
});
},
child: Text(code ?? "Click me")),
),
);
}),
),
);
}
}