flutter_qrscaner 1.0.0 flutter_qrscaner: ^1.0.0 copied to clipboard
A QR scan plugin based on zxing for android,it is very simple to use,only need one line code.This plugin is not work for ios,because i have no idea on object c or swift.
import 'package:flutter/material.dart';
import 'package:flutter_qrscaner/flutter_qrscaner.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _qrContent = "";
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Spacer(),
RaisedButton(
onPressed: () {
FlutterQrscaner.startScan().then((value) {
setState(() {
_qrContent = value;
});
});
},
child: Text('开始扫码')),
Spacer(),
Text('扫码结果:$_qrContent'),
Spacer()
],
),
),
),
);
}
}