parent
4e8bde934b
commit
cb62ce67df
@ -1,41 +0,0 @@
|
||||
// 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;
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue