Merge pull request #144 from r4khul/feat/permission
Improve permission denied error handling by providing direct access to app settings
This commit is contained in:
commit
5577b8a02b
3 changed files with 34 additions and 2 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:app_settings/app_settings.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
|
||||
|
|
@ -55,8 +56,8 @@ class _QrCodeScreenState extends State<QrCodeScreen> {
|
|||
: Icons.flash_off,
|
||||
),
|
||||
onPressed: state.torchState == TorchState.unavailable
|
||||
? null
|
||||
: () => _controller.toggleTorch(),
|
||||
? null
|
||||
: () => _controller.toggleTorch(),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
|
@ -66,6 +67,28 @@ class _QrCodeScreenState extends State<QrCodeScreen> {
|
|||
controller: _controller,
|
||||
fit: BoxFit.cover,
|
||||
onDetect: _onDetect,
|
||||
errorBuilder: (context, error) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.videocam_off_outlined, size: 120),
|
||||
Text(AppLocalizations.of(context)!.disabledValue),
|
||||
SizedBox(height: 24,),
|
||||
FilledButton.tonal(
|
||||
onPressed:
|
||||
() => AppSettings.openAppSettings(
|
||||
type: AppSettingsType.settings,
|
||||
),
|
||||
child: Text(AppLocalizations.of(context)!.settingsTitle),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
app_settings:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: app_settings
|
||||
sha256: "64d50e666fd96ae90301bf71205f05019286f940ad6f5fed3d1be19c6af7546a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ dependencies:
|
|||
mobile_scanner: ^7.1.4
|
||||
flutter_secure_storage: ^10.0.0
|
||||
app_links: ^7.0.0
|
||||
app_settings: ^7.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue