fix: QR Scanner permission

This commit is contained in:
Christian Pauly 2021-08-23 18:36:13 +02:00
parent 14586297dc
commit d29729c27c

View File

@ -6,6 +6,7 @@ import 'package:future_loading_dialog/future_loading_dialog.dart';
import 'package:fluffychat/widgets/matrix.dart'; import 'package:fluffychat/widgets/matrix.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:vrouter/vrouter.dart'; import 'package:vrouter/vrouter.dart';
class NewPrivateChat extends StatefulWidget { class NewPrivateChat extends StatefulWidget {
@ -75,10 +76,15 @@ class NewPrivateChatController extends State<NewPrivateChat> {
context, context,
); );
void openScannerAction() => showDialog( void openScannerAction() async {
context: context, final status = await Permission.camera.request();
builder: (_) => QrScannerModal(), if (!status.isGranted) return;
); await showDialog(
context: context,
useRootNavigator: false,
builder: (_) => QrScannerModal(),
);
}
@override @override
Widget build(BuildContext context) => NewPrivateChatView(this); Widget build(BuildContext context) => NewPrivateChatView(this);