flutter_qr_code_scaner 2.0.0 flutter_qr_code_scaner: ^2.0.0 copied to clipboard
This package allows user to read or get the data by scan or read QRCode from other object(like wall) or the local image file. This package is available thanks to @hetian9288's work.
import 'package:examplex/qr_code.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: HomePage());
}
}
class HomePage extends StatefulWidget {
HomePage({Key? key}) : super(key: key);
@override
_HomePageState createState() => new _HomePageState();
}
class _HomePageState extends State<HomePage> {
String result = '';
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Package example app'),
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
ElevatedButton(
onPressed: () async {
String results = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ScanQrcodePage(),
),
);
setState(() {
result = results;
});
},
child: Text("扫码/tap to scan"),
),
Text(result),
],
),
),
);
}
}