Browse Source

新增权限弹窗说明更改(个人资料头像-相机相册,门店,新增收货地址-地址,扫一扫)

wr_2024_invoice
wurong 5 months ago
parent
commit
155b65c2d8
  1. BIN
      assets/image/2x/icon_storage_permission_tips.webp
  2. BIN
      assets/image/3x/icon_storage_permission_tips.webp
  3. BIN
      assets/image/icon_storage_permission_tips.webp
  4. 2
      lib/generated/intl/messages_en.dart
  5. 2
      lib/generated/intl/messages_zh_CN.dart
  6. 2
      lib/generated/intl/messages_zh_Hans_CN.dart
  7. 2
      lib/generated/intl/messages_zh_Hant_CN.dart
  8. 2
      lib/generated/intl/messages_zh_TW.dart
  9. 2
      lib/generated/l10n.dart
  10. 71
      lib/mine/mine_view/mine_view.dart
  11. 241
      lib/mine/user_info_page.dart
  12. 7
      lib/utils/location.dart
  13. 1
      lib/view_widget/request_permission.dart

BIN
assets/image/2x/icon_storage_permission_tips.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
assets/image/3x/icon_storage_permission_tips.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
assets/image/icon_storage_permission_tips.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

2
lib/generated/intl/messages_en.dart

@ -642,7 +642,7 @@ class MessageLookup extends MessageLookupByLibrary {
"weikaiqi" : MessageLookupByLibrary.simpleMessage("未开启"),
"weilegeiningenghaodefuwu" : MessageLookupByLibrary.simpleMessage("为了给您提供更好的服务,以及享受更加精彩的信息内容,请您在使用期间,进行登录"),
"weilejishishoudaohuodongxiaoxi" : MessageLookupByLibrary.simpleMessage("为了您可以及时收到我们的活动信息,请您开启消息通知权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,请您开启相机使用权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,扫码,请您开启相机使用权限"),
"weilexiangnintuijianfujindemendianxinxi" : MessageLookupByLibrary.simpleMessage("为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息"),
"weilexuanzhezhaopianhuancun" : MessageLookupByLibrary.simpleMessage("为了获得照片使用,缓存等功能,推荐您在使用期间打开存储权限"),
"weiwancheng" : MessageLookupByLibrary.simpleMessage(" 未完成 "),

2
lib/generated/intl/messages_zh_CN.dart

@ -642,7 +642,7 @@ class MessageLookup extends MessageLookupByLibrary {
"weikaiqi" : MessageLookupByLibrary.simpleMessage("未开启"),
"weilegeiningenghaodefuwu" : MessageLookupByLibrary.simpleMessage("为了给您提供更好的服务,以及享受更加精彩的信息内容,请您在使用期间,进行登录"),
"weilejishishoudaohuodongxiaoxi" : MessageLookupByLibrary.simpleMessage("为了您可以及时收到我们的活动信息,请您开启消息通知权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,请您开启相机使用权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,扫码,请您开启相机使用权限"),
"weilexiangnintuijianfujindemendianxinxi" : MessageLookupByLibrary.simpleMessage("为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息"),
"weilexuanzhezhaopianhuancun" : MessageLookupByLibrary.simpleMessage("为了获得照片使用,缓存等功能,推荐您在使用期间打开存储权限"),
"weiwancheng" : MessageLookupByLibrary.simpleMessage(" 未完成 "),

2
lib/generated/intl/messages_zh_Hans_CN.dart

@ -642,7 +642,7 @@ class MessageLookup extends MessageLookupByLibrary {
"weikaiqi" : MessageLookupByLibrary.simpleMessage("未开启"),
"weilegeiningenghaodefuwu" : MessageLookupByLibrary.simpleMessage("为了给您提供更好的服务,以及享受更加精彩的信息内容,请您在使用期间,进行登录"),
"weilejishishoudaohuodongxiaoxi" : MessageLookupByLibrary.simpleMessage("为了您可以及时收到我们的活动信息,请您开启消息通知权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,请您开启相机使用权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,扫码,请您开启相机使用权限"),
"weilexiangnintuijianfujindemendianxinxi" : MessageLookupByLibrary.simpleMessage("为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息"),
"weilexuanzhezhaopianhuancun" : MessageLookupByLibrary.simpleMessage("为了获得照片使用,缓存等功能,推荐您在使用期间打开存储权限"),
"weiwancheng" : MessageLookupByLibrary.simpleMessage(" 未完成 "),

2
lib/generated/intl/messages_zh_Hant_CN.dart

@ -636,7 +636,7 @@ class MessageLookup extends MessageLookupByLibrary {
"weikaiqi" : MessageLookupByLibrary.simpleMessage("未開啓"),
"weilegeiningenghaodefuwu" : MessageLookupByLibrary.simpleMessage("為了給您提供更好的服務,以及享受更加精彩的信息內容,請在使用使用期間登錄"),
"weilejishishoudaohuodongxiaoxi" : MessageLookupByLibrary.simpleMessage("为了您可以及时收到我们的活动信息,请您开启消息通知权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,请您开启相机使用权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,扫码,请您开启相机使用权限"),
"weilexiangnintuijianfujindemendianxinxi" : MessageLookupByLibrary.simpleMessage("為了向您推薦附近的門店信息,推薦您在使用期間讓我們使用位置信息"),
"weilexuanzhezhaopianhuancun" : MessageLookupByLibrary.simpleMessage("为了获得照片使用,缓存等功能,推荐您在使用期间打开存储权限"),
"weiwancheng" : MessageLookupByLibrary.simpleMessage(" 未完成 "),

2
lib/generated/intl/messages_zh_TW.dart

@ -639,7 +639,7 @@ class MessageLookup extends MessageLookupByLibrary {
"weikaiqi" : MessageLookupByLibrary.simpleMessage("未開啓"),
"weilegeiningenghaodefuwu" : MessageLookupByLibrary.simpleMessage("為了給您提供更好的服務,以及享受更加精彩的信息內容,請在使用使用期間登錄"),
"weilejishishoudaohuodongxiaoxi" : MessageLookupByLibrary.simpleMessage("为了您可以及时收到我们的活动信息,请您开启消息通知权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,请您开启相机使用权限"),
"weilekaipaizhaoxuanzhetouxiang" : MessageLookupByLibrary.simpleMessage("为了您可以在使用过程中更换头像,扫码,请您开启相机使用权限"),
"weilexiangnintuijianfujindemendianxinxi" : MessageLookupByLibrary.simpleMessage("為了向您推薦附近的門店信息,推薦您在使用期間讓我們使用位置信息"),
"weilexuanzhezhaopianhuancun" : MessageLookupByLibrary.simpleMessage("为了获得照片使用,缓存等功能,推荐您在使用期间打开存储权限"),
"weiwancheng" : MessageLookupByLibrary.simpleMessage(" 未完成 "),

2
lib/generated/l10n.dart

@ -3548,7 +3548,7 @@ class S {
/// `使使`
String get weilekaipaizhaoxuanzhetouxiang {
return Intl.message(
'为了您可以在使用过程中更换头像,请您开启相机使用权限',
'为了您可以在使用过程中更换头像,扫码,请您开启相机使用权限',
name: 'weilekaipaizhaoxuanzhetouxiang',
desc: '',
args: [],

71
lib/mine/mine_view/mine_view.dart

@ -230,10 +230,79 @@ class _MineView extends State<MineView> {
);
}
} else {
await Permission.camera.request();
showScanTipsAlertDialog(context);
}
}
///
showScanTipsAlertDialog(context) async {
//
showDialog(
context: context,
barrierDismissible: false,
barrierColor: null,
builder: (BuildContext context) {
return Column(
children: [
Container(
width: double.infinity,
padding: EdgeInsets.all(15),
margin: EdgeInsets.all(15),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(padding:EdgeInsets.only(right: 10.w,),
child: Icon(
Icons.add_a_photo,
color: Colors.black,
size: 22,
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"相机权限使用说明",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
SizedBox(
height: 3.h,
),
Text(
"实现您扫码、拍摄等功能。",
style: TextStyle(
fontSize: 13.sp,
height: 1.2,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
],
),
),
],
),
)
],
mainAxisSize: MainAxisSize.min,
);
},
);
await Permission.camera.request();
Navigator.of(context).pop();
if(await Permission.camera.isGranted)
toScan();
}
activityShowAlertDialog(String result) {
//
showDialog(

241
lib/mine/user_info_page.dart

@ -20,6 +20,8 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../view_widget/request_permission.dart';
class UserInfoPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
@ -391,22 +393,62 @@ class _UserInfoPage extends State<UserInfoPage> {
///
openCamera() async {
if (await Permission.camera.isGranted) {
Media medias = await ImagePickers.openCamera(
cameraMimeType: CameraMimeType.photo,
cropConfig: CropConfig(
enableCrop: true,
width: 200,
height: 200,
),
compressSize: 500,
);
if (medias == null) return;
filePath = medias.path;
fileUpload();
if (await Permission.camera.isPermanentlyDenied) {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_camera_permission_tips.webp",
S.of(context).ninxiangjiquanxianweikaiqi,
S.of(context).weilekaipaizhaoxuanzhetouxiang,
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await openAppSettings();
}
},
heightRatioWithWidth: 0.82,
);
});
}else if (await Permission.camera.isGranted) {
if (await Permission.storage.isPermanentlyDenied) {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_storage_permission_tips.webp",
"您未开启存储权限,请点击开启",
"为了您可以在使用过程中访问您设备上的照片、媒体内容和文件,请您开启存储使用权限",
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await openAppSettings();
}
},
heightRatioWithWidth: 0.82,
);
});}else if(await Permission.storage.isGranted){
Media medias = await ImagePickers.openCamera(
cameraMimeType: CameraMimeType.photo,
cropConfig: CropConfig(
enableCrop: true,
width: 200,
height: 200,
),
compressSize: 500,
);
if (medias == null) return;
filePath = medias.path;
fileUpload();
}else{
showStorageTipsAlertDialog(context,1);
return false;
}
} else {
await Permission.camera.request();
openCamera();
showCameraTipsAlertDialog(context);
return false;
// await Permission.camera.request();
// openCamera();
}
}
@ -414,7 +456,24 @@ class _UserInfoPage extends State<UserInfoPage> {
///
openStorage() async {
if (await Permission.storage.isGranted) {
if (await Permission.storage.isPermanentlyDenied) {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_storage_permission_tips.webp",
"您未开启存储权限,请点击开启",
"为了您可以在使用过程中访问您设备上的照片、媒体内容和文件,请您开启存储使用权限",
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await openAppSettings();
}
},
heightRatioWithWidth: 0.82,
);
});
}else if (await Permission.storage.isGranted) {
List<Media> medias = await ImagePickers.pickerPaths(
galleryMode: GalleryMode.image,
selectCount: 1,
@ -435,8 +494,154 @@ class _UserInfoPage extends State<UserInfoPage> {
setState(() {});
fileUpload();
} else {
await Permission.storage.request();
openStorage();
showStorageTipsAlertDialog(context,0);
return false;
// await Permission.storage.request();
// openStorage();
}
}
///
showStorageTipsAlertDialog(context,type) async {
//
showDialog(
context: context,
barrierDismissible: false,
barrierColor: null,
builder: (BuildContext context) {
return Column(
children: [
Container(
width: double.infinity,
padding: EdgeInsets.all(15),
margin: EdgeInsets.all(15),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(padding:EdgeInsets.only(right: 10.w,),
child: Icon(
Icons.add_photo_alternate_outlined,
color: Colors.black,
size: 22,
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"存储权限使用说明",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
SizedBox(
height: 3.h,
),
Text(
"为了帮您实现分享照片、保存照片等功能。",
style: TextStyle(
fontSize: 13.sp,
height: 1.2,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
],
),
),
],
),
)
],
mainAxisSize: MainAxisSize.min,
);
},
);
await Permission.storage.request();
Navigator.of(context).pop();
if(await Permission.storage.isGranted){
if(type == 1){
openCamera();
}else{
openStorage();
}
}
}
///
showCameraTipsAlertDialog(context) async {
//
showDialog(
context: context,
barrierDismissible: false,
barrierColor: null,
builder: (BuildContext context) {
return Column(
children: [
Container(
width: double.infinity,
padding: EdgeInsets.all(15),
margin: EdgeInsets.all(15),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(padding:EdgeInsets.only(right: 10.w,),
child: Icon(
Icons.add_photo_alternate_outlined,
color: Colors.black,
size: 22,
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
"相机权限使用说明",
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
SizedBox(
height: 3.h,
),
Text(
"实现您扫码、拍摄等功能。",
style: TextStyle(
fontSize: 13.sp,
height: 1.2,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
],
),
),
],
),
)
],
mainAxisSize: MainAxisSize.min,
);
},
);
await Permission.camera.request();
Navigator.of(context).pop();
if(await Permission.camera.isGranted){
openCamera();
}
}

7
lib/utils/location.dart

@ -31,7 +31,9 @@ class LocationInstance {
context, Function(Position locationData) locationCallback) async {
LocationPermission permissionStatus = await Geolocator.checkPermission();
if (permissionStatus == LocationPermission.denied) {
permissionStatus = await Geolocator.requestPermission();
// permissionStatus = await Geolocator.requestPermission();
showTipsAlertDialog(context);
return false;
}
if (permissionStatus == LocationPermission.denied) {
showTipsAlertDialog(context);
@ -162,6 +164,7 @@ class LocationInstance {
"为了向您推荐附近的门店信息,推荐您在使用期间让我们使用位置信息",
style: TextStyle(
fontSize: 13.sp,
height: 1.2,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
@ -177,7 +180,7 @@ class LocationInstance {
);
},
);
Geolocator.requestPermission();
await Geolocator.requestPermission();
Navigator.of(context).pop();
}

1
lib/view_widget/request_permission.dart

@ -74,6 +74,7 @@ class _RequestPermission extends State<RequestPermission> {
widget.subText,
style: TextStyle(
fontSize: 12.sp,
height: 1.2,
color: Color(0xFF727272),
),
),

Loading…
Cancel
Save