masi_qr_code_scanner 0.0.2 masi_qr_code_scanner: ^0.0.2 copied to clipboard
QR Code scanner plugin
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:masi_qr_code_scanner/masi_qr_code_scanner.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String scanData = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Mobile Scanner'),
),
body: SizedBox(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Column(
children: [
const Text('Hellow'),
Flexible(
child: QRCodeScanner(
onScan: (String data) {
HapticFeedback.vibrate();
debugPrint(data);
},
size: 250,
),
),
],
),
),
);
}
void showMessage(String message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
),
);
}
}