Update code for ask permission if not set (force ios)
This commit is contained in:
parent
72ce2a47f3
commit
823620c13a
@ -26,22 +26,6 @@ class _ScannerDialogState extends State<ScannerDialog> {
|
||||
QRViewController? controller;
|
||||
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
|
||||
|
||||
@override
|
||||
Future<void> initState() async {
|
||||
super.initState();
|
||||
|
||||
var status = await Permission.camera.status;
|
||||
|
||||
if(!status.isGranted) {
|
||||
// You can request multiple permissions at once.
|
||||
Map<Permission, PermissionStatus> statuses = await [
|
||||
Permission.camera,
|
||||
].request();
|
||||
print(statuses[Permission.camera]);
|
||||
print(status);
|
||||
}
|
||||
}
|
||||
|
||||
// In order to get hot reload to work we need to pause the camera if the platform
|
||||
// is android, or resume the camera if the platform is iOS.
|
||||
@override
|
||||
@ -56,6 +40,7 @@ class _ScannerDialogState extends State<ScannerDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
|
||||
return Container(
|
||||
height: size.height *0.5,
|
||||
width: size.width *0.9,
|
||||
@ -203,9 +188,7 @@ class _ScannerDialogState extends State<ScannerDialog> {
|
||||
Future<void> _onPermissionSet(BuildContext context, QRViewController ctrl, bool p) async {
|
||||
//log('${DateTime.now().toIso8601String()}_onPermissionSet $p');
|
||||
if (!p) {
|
||||
|
||||
var status = await Permission.camera.status;
|
||||
|
||||
if(!status.isGranted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('no Permission')),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user