You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
878 B

// Dart imports:
import 'dart:io';
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:qr_code_scanner/qr_code_scanner.dart';
class ScanPage extends StatefulWidget {
ScanPage({Key key}) : super(key: key);
@override
_ScanPageState createState() => _ScanPageState();
}
class _ScanPageState extends State<ScanPage> {
final GlobalKey _qrKey = GlobalKey(debugLabel: 'QR');
QRViewController _controller;
@override
void reassemble() {
super.reassemble();
if (Platform.isAndroid) {
_controller.pauseCamera();
} else if (Platform.isIOS) {
_controller.resumeCamera();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: QRView(
key: _qrKey,
onQRViewCreated: (controller) {
_controller = controller;
},
),
);
}
}