update permission flow
This commit is contained in:
@ -112,8 +112,9 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
|||||||
|
|
||||||
requestPermission() async {
|
requestPermission() async {
|
||||||
PermissionStatus permission = await Permission.location.status;
|
PermissionStatus permission = await Permission.location.status;
|
||||||
|
if(permission == PermissionStatus.permanentlyDenied){
|
||||||
if (permission != PermissionStatus.granted) {
|
showPermanentAlert(context);
|
||||||
|
}else{
|
||||||
PermissionStatus newPermission = await Permission.location.request();
|
PermissionStatus newPermission = await Permission.location.request();
|
||||||
//showAlert(context);
|
//showAlert(context);
|
||||||
|
|
||||||
@ -125,6 +126,10 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
|||||||
Get.toNamed(AppPages.TRAVEL);
|
Get.toNamed(AppPages.TRAVEL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (permission != PermissionStatus.granted) {
|
||||||
|
|
||||||
|
// }
|
||||||
// If permission is granted or already was granted
|
// If permission is granted or already was granted
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -138,6 +143,9 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
|||||||
showAlert(context);
|
showAlert(context);
|
||||||
//requestPermission() ? Get.toNamed(AppPages.TRAVEL) : exit(0);
|
//requestPermission() ? Get.toNamed(AppPages.TRAVEL) : exit(0);
|
||||||
//Future.delayed(Duration.zero, () => showAlert(context));
|
//Future.delayed(Duration.zero, () => showAlert(context));
|
||||||
|
}
|
||||||
|
else if(value.isPermanentlyDenied){
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Get.toNamed(AppPages.TRAVEL);
|
Get.toNamed(AppPages.TRAVEL);
|
||||||
@ -150,6 +158,33 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showPermanentAlert(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => AlertDialog(
|
||||||
|
title: const Text('無効'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: const <Widget>[
|
||||||
|
Text( '位置情報が無効になっています'),
|
||||||
|
Text('このアプリケーションへの位置情報アクセスが無効になっています。続行するには設定>プライバシーとセキュリティ>位置情報サービス>岐阜ナビ で有効にしてください。'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
ElevatedButton(
|
||||||
|
child: const Text('OK'),
|
||||||
|
onPressed: () {
|
||||||
|
//requestPermission();
|
||||||
|
permissionServiceCall();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void showAlert(BuildContext context) {
|
void showAlert(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.0.15+15
|
version: 1.0.16+16
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.16.0 <3.0.0"
|
sdk: ">=2.16.0 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user