Merge branch 'master' of https://gitee.com/starlock-cn/app-starlock
This commit is contained in:
commit
79b51b00dc
@ -125,6 +125,8 @@ PODS:
|
|||||||
- Flutter
|
- Flutter
|
||||||
- package_info_plus (0.4.5):
|
- package_info_plus (0.4.5):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- partial_media_permissions (0.0.1):
|
||||||
|
- Flutter
|
||||||
- path_provider_foundation (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
@ -184,6 +186,7 @@ DEPENDENCIES:
|
|||||||
- just_audio (from `.symlinks/plugins/just_audio/ios`)
|
- just_audio (from `.symlinks/plugins/just_audio/ios`)
|
||||||
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
|
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
|
||||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||||
|
- partial_media_permissions (from `.symlinks/plugins/partial_media_permissions/ios`)
|
||||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||||
@ -274,6 +277,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/network_info_plus/ios"
|
:path: ".symlinks/plugins/network_info_plus/ios"
|
||||||
package_info_plus:
|
package_info_plus:
|
||||||
:path: ".symlinks/plugins/package_info_plus/ios"
|
:path: ".symlinks/plugins/package_info_plus/ios"
|
||||||
|
partial_media_permissions:
|
||||||
|
:path: ".symlinks/plugins/partial_media_permissions/ios"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
:path: ".symlinks/plugins/path_provider_foundation/darwin"
|
||||||
permission_handler_apple:
|
permission_handler_apple:
|
||||||
@ -335,6 +340,7 @@ SPEC CHECKSUMS:
|
|||||||
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
|
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
|
||||||
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
|
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
|
||||||
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
|
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
|
||||||
|
partial_media_permissions: 0fd34002b1dbfd5e8b4c60eb0d99e8e755a77f76
|
||||||
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
|
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
|
||||||
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
|
||||||
ReachabilitySwift: 2128f3a8c9107e1ad33574c6e58e8285d460b149
|
ReachabilitySwift: 2128f3a8c9107e1ad33574c6e58e8285d460b149
|
||||||
|
|||||||
@ -233,7 +233,9 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
//打开实名认证,需要弹出输入身份证信息框
|
//打开实名认证,需要弹出输入身份证信息框
|
||||||
state.isRequireAuth.value = true;
|
state.isRequireAuth.value = true;
|
||||||
|
state.isAuthentication.value = true;
|
||||||
} else {
|
} else {
|
||||||
|
//432--余量不足,需购买
|
||||||
ShowTipView().showBuyTipWithContentAlert(
|
ShowTipView().showBuyTipWithContentAlert(
|
||||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
|
|||||||
@ -471,11 +471,11 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
|
|||||||
value: state.isAuthentication.value,
|
value: state.isAuthentication.value,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
state.isAuthentication.value = !state.isAuthentication.value;
|
if (logic.state.isAuthentication.value == false) {
|
||||||
if (state.isAuthentication.value == true) {
|
|
||||||
logic.keyCheckFace();
|
logic.keyCheckFace();
|
||||||
} else {
|
} else {
|
||||||
state.isRequireAuth.value = false;
|
logic.state.isAuthentication.value = false;
|
||||||
|
logic.state.isRequireAuth.value = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -190,7 +190,9 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
//打开实名认证,需要弹出输入身份证信息框
|
//打开实名认证,需要弹出输入身份证信息框
|
||||||
state.isRequireAuth.value = true;
|
state.isRequireAuth.value = true;
|
||||||
|
state.isAuthentication.value = true;
|
||||||
} else {
|
} else {
|
||||||
|
//432--余量不足,需购买
|
||||||
ShowTipView().showBuyTipWithContentAlert(
|
ShowTipView().showBuyTipWithContentAlert(
|
||||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||||
sureClick: () {
|
sureClick: () {
|
||||||
|
|||||||
@ -285,6 +285,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
|||||||
rightTitle:
|
rightTitle:
|
||||||
"${logic.state.effectiveDateTime}-${logic.state.failureDateTime}",
|
"${logic.state.effectiveDateTime}-${logic.state.failureDateTime}",
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
||||||
arguments: {
|
arguments: {
|
||||||
@ -552,11 +553,10 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
|||||||
if (isRemote) {
|
if (isRemote) {
|
||||||
logic.state.isRemoteUnlock.value = !logic.state.isRemoteUnlock.value;
|
logic.state.isRemoteUnlock.value = !logic.state.isRemoteUnlock.value;
|
||||||
} else {
|
} else {
|
||||||
logic.state.isAuthentication.value =
|
if (logic.state.isAuthentication.value == false) {
|
||||||
!logic.state.isAuthentication.value;
|
|
||||||
if (logic.state.isAuthentication.value == true) {
|
|
||||||
logic.keyCheckFace();
|
logic.keyCheckFace();
|
||||||
} else {
|
} else {
|
||||||
|
logic.state.isAuthentication.value = false;
|
||||||
logic.state.isRequireAuth.value = false;
|
logic.state.isRequireAuth.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,11 +121,7 @@ class MinePersonInfoLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//权限判断 访问相册
|
//权限判断 访问相册
|
||||||
Future<void> _checkPhotoPermission() async {
|
Future<void> _checkPhotoPermission() async {
|
||||||
bool isAndroid33 =
|
var status = await PermissionDialog.requestPhotos();
|
||||||
AppPlatform.isAndroid && AppPlatform.getSdkIntValue() >= 33;
|
|
||||||
var status = isAndroid33
|
|
||||||
? await PermissionDialog.request(Permission.photos)
|
|
||||||
: await PermissionDialog.request(Permission.storage);
|
|
||||||
if (status) {
|
if (status) {
|
||||||
selectImage();
|
selectImage();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
@ -23,8 +22,8 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
|||||||
final state = Get.find<ExpireFingerprintLogic>().state;
|
final state = Get.find<ExpireFingerprintLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData() async {
|
||||||
logic.expirFingerprintListRequest().then((ExpireFingerprintEntity value){
|
logic.expirFingerprintListRequest().then((ExpireFingerprintEntity value) {
|
||||||
if(mounted) setState(() {});
|
if (mounted) setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,56 +37,62 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return EasyRefreshTool(
|
return EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
child: Obx(() => _buildMainUI())
|
child: Obx(() => _buildMainUI()));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return state.dataList.isEmpty
|
return state.dataList.isEmpty
|
||||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
? NoData(
|
||||||
|
noDataHeight: 1.sh -
|
||||||
|
ScreenUtil().statusBarHeight -
|
||||||
|
ScreenUtil().bottomBarHeight -
|
||||||
|
190.h -
|
||||||
|
64.h)
|
||||||
: SlidableAutoCloseBehavior(
|
: SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.dataList.length,
|
itemCount: state.dataList.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
ExpireFingerprintItemEntity indexEntity = state.dataList[index];
|
ExpireFingerprintItemEntity indexEntity = state.dataList[index];
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key:ValueKey(indexEntity.uid),
|
key: ValueKey(indexEntity.uid),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
extentRatio: 0.2,
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog("确定删除卡吗?", (){
|
ShowTipView().showIosTipWithContentDialog("确定删除指纹吗?",
|
||||||
state.deletExpireFingerprintItemEntity = indexEntity;
|
() {
|
||||||
logic.senderAddFingerprint();
|
state.deletExpireFingerprintItemEntity =
|
||||||
});
|
indexEntity;
|
||||||
},
|
logic.senderAddFingerprint();
|
||||||
backgroundColor: Colors.red,
|
});
|
||||||
foregroundColor: Colors.white,
|
},
|
||||||
label: '删除',
|
backgroundColor: Colors.red,
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
foregroundColor: Colors.white,
|
||||||
),
|
label: '删除',
|
||||||
],
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _electronicKeyItem(indexEntity),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
child: _electronicKeyItem(indexEntity),
|
|
||||||
);
|
);
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) {
|
Widget _electronicKeyItem(ExpireFingerprintItemEntity itemData) {
|
||||||
@ -156,8 +161,8 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
)),
|
)),
|
||||||
Text(
|
Text(
|
||||||
itemData.lockAlias ?? '',
|
itemData.lockAlias ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -216,8 +221,7 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'余${itemData.expireDate.toString()}天',
|
'余${itemData.expireDate.toString()}天',
|
||||||
style: TextStyle(
|
style: TextStyle(color: Colors.white, fontSize: 13.sp),
|
||||||
color: Colors.white, fontSize: 13.sp),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -229,12 +233,10 @@ class _ExpireFingerprintPageState extends State<ExpireFingerprintPage> {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
'已过期',
|
'已过期',
|
||||||
style: TextStyle(
|
style: TextStyle(color: Colors.white, fontSize: 13.sp),
|
||||||
color: Colors.white, fontSize: 13.sp),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/dateTool.dart';
|
import 'package:star_lock/tools/dateTool.dart';
|
||||||
|
|
||||||
@ -13,8 +12,9 @@ class ExpirePasswordLogic extends BaseGetXController {
|
|||||||
|
|
||||||
//请求即将到期列表
|
//请求即将到期列表
|
||||||
Future<ExpirePasswordEntity> expirePasswordListRequest() async {
|
Future<ExpirePasswordEntity> expirePasswordListRequest() async {
|
||||||
ExpirePasswordEntity entity = await ApiRepository.to.expirePasswordList(pageNo.toString(), pageSize.toString());
|
ExpirePasswordEntity entity = await ApiRepository.to
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
.expirePasswordList(pageNo.toString(), pageSize.toString());
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
if (pageNo == 1) {
|
||||||
state.dataList.value = entity.data!.list!;
|
state.dataList.value = entity.data!.list!;
|
||||||
pageNo++;
|
pageNo++;
|
||||||
@ -29,11 +29,12 @@ class ExpirePasswordLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||||
Future<void> deletePwdRequest(ExpirePasswordItemData expirePasswordItemData) async {
|
Future<void> deletePwdRequest(
|
||||||
|
ExpirePasswordItemData expirePasswordItemData) async {
|
||||||
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||||
lockId:expirePasswordItemData.lockId.toString(),
|
lockId: expirePasswordItemData.lockId.toString(),
|
||||||
keyboardPwdId:expirePasswordItemData.pwdId.toString(),
|
keyboardPwdId: expirePasswordItemData.pwdId.toString(),
|
||||||
deleteType:1);
|
deleteType: 1);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功", something: () {
|
showToast("删除成功", something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
@ -46,12 +47,13 @@ class ExpirePasswordLogic extends BaseGetXController {
|
|||||||
//使用期限
|
//使用期限
|
||||||
String getExpireDateStr(ExpirePasswordItemData itemData) {
|
String getExpireDateStr(ExpirePasswordItemData itemData) {
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
if(itemData.keyboardPwdType == 4){
|
//* getKeyType 单次1 永久2 限期3 删除4 周未循环5 每日循环6 工作日循环7 周一循环8 周二循环9 周三循环10 周四循环11 周五循环12 周六循环13 周天循环14
|
||||||
|
if (itemData.keyboardPwdType! > 4) {
|
||||||
useDateStr = '循环';
|
useDateStr = '循环';
|
||||||
}else{
|
} else {
|
||||||
useDateStr = '${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
useDateStr =
|
||||||
|
'${DateTool().dateToYMDString(itemData.startDate.toString())}-${DateTool().dateToYMDString(itemData.endDate.toString())}';
|
||||||
}
|
}
|
||||||
return useDateStr;
|
return useDateStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/appRouters.dart';
|
import 'package:star_lock/appRouters.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
|
||||||
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
import 'package:star_lock/tools/EasyRefreshTool.dart';
|
||||||
import 'package:star_lock/tools/noData.dart';
|
import 'package:star_lock/tools/noData.dart';
|
||||||
|
|
||||||
@ -24,8 +24,8 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
|||||||
final state = Get.find<ExpirePasswordLogic>().state;
|
final state = Get.find<ExpirePasswordLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData() async {
|
||||||
logic.expirePasswordListRequest().then((ExpirePasswordEntity value){
|
logic.expirePasswordListRequest().then((ExpirePasswordEntity value) {
|
||||||
if(mounted) setState(() {});
|
if (mounted) setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,67 +39,73 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return EasyRefreshTool(
|
return EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData();
|
||||||
},
|
},
|
||||||
child: Obx(() => _buildMainUI())
|
child: Obx(() => _buildMainUI()));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return state.dataList.isEmpty
|
return state.dataList.isEmpty
|
||||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
? NoData(
|
||||||
|
noDataHeight: 1.sh -
|
||||||
|
ScreenUtil().statusBarHeight -
|
||||||
|
ScreenUtil().bottomBarHeight -
|
||||||
|
190.h -
|
||||||
|
64.h)
|
||||||
: SlidableAutoCloseBehavior(
|
: SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.dataList.length,
|
itemCount: state.dataList.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
ExpirePasswordItemData indexEntity = state.dataList[index];
|
ExpirePasswordItemData indexEntity = state.dataList[index];
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key:ValueKey(indexEntity.uid),
|
key: ValueKey(indexEntity.uid),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
extentRatio: 0.2,
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog("确定删除该密码吗?", (){
|
ShowTipView().showIosTipWithContentDialog("确定删除该密码吗?",
|
||||||
logic.deletePwdRequest(indexEntity);
|
() {
|
||||||
});
|
logic.deletePwdRequest(indexEntity);
|
||||||
},
|
});
|
||||||
backgroundColor: Colors.red,
|
},
|
||||||
foregroundColor: Colors.white,
|
backgroundColor: Colors.red,
|
||||||
label: '删除',
|
foregroundColor: Colors.white,
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
label: '删除',
|
||||||
),
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
],
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: _electronicKeyItem(indexEntity),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return const Divider(
|
||||||
|
height: 1,
|
||||||
|
color: AppColors.greyLineColor,
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
child: _electronicKeyItem(indexEntity),
|
|
||||||
);
|
);
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return const Divider(
|
|
||||||
height: 1,
|
|
||||||
color: AppColors.greyLineColor,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(ExpirePasswordItemData itemData) {
|
Widget _electronicKeyItem(ExpirePasswordItemData itemData) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
// if(itemData.keyboardPwdType! == 4){
|
// if (itemData.keyboardPwdType! > 4) {
|
||||||
// // 循环
|
// // 循环
|
||||||
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: {
|
// var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage,
|
||||||
// "pushType": 0,
|
// arguments: {
|
||||||
// "expireLockItem": itemData,
|
// "pushType": 0,
|
||||||
// });
|
// "expirePasswordItem": itemData,
|
||||||
// if(data != null) {
|
// });
|
||||||
|
// if (data != null) {
|
||||||
// // setState(() {
|
// // setState(() {
|
||||||
// // state.starDate.value = data["starDate"];
|
// // state.starDate.value = data["starDate"];
|
||||||
// // state.endDate.value = data["endDate"];
|
// // state.endDate.value = data["endDate"];
|
||||||
@ -110,19 +116,20 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
|||||||
// logic.pageNo = 1;
|
// logic.pageNo = 1;
|
||||||
// getHttpData();
|
// getHttpData();
|
||||||
// }
|
// }
|
||||||
// }else{
|
// } else {
|
||||||
// var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: {
|
// var backData = await Get.toNamed(
|
||||||
// "pushType": 0,
|
// Routers.passwordKeyDetailChangeDatePage,
|
||||||
// "expireLockItem": itemData,
|
// arguments: {
|
||||||
// });
|
// 'itemData': itemData,
|
||||||
// if(data != null) {
|
|
||||||
// setState(() {
|
// });
|
||||||
// // state.starDate.value = data["beginTimeTimestamp"].toString();
|
// if (backData != null) {
|
||||||
// // state.endDate.value = data["endTimeTimestamp"].toString();
|
// itemData.startDate =
|
||||||
// // state.keyType.value = 2;
|
// int.parse(backData["beginTimeTimestamp"]) * 1000;
|
||||||
// logic.pageNo = 1;
|
// itemData.endDate = int.parse(backData["endTimeTimestamp"]) * 1000;
|
||||||
// getHttpData();
|
// // 改了日期之后,永久只能改限时的
|
||||||
// });
|
// itemData.keyboardPwdType = 3;
|
||||||
|
// setState(() {});
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
@ -156,8 +163,8 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
|||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: 10.w,
|
width: 10.w,
|
||||||
)),
|
)),
|
||||||
Text(
|
Text(
|
||||||
itemData.lockAlias ?? '',
|
itemData.lockAlias ?? '',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -193,48 +200,36 @@ class _ExpirePasswordPageState extends State<ExpirePasswordPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget getStatus(ExpirePasswordItemData itemData) {
|
Widget getStatus(ExpirePasswordItemData itemData) {
|
||||||
// if (itemData.keyboardPwdStatus! == 1) {
|
//keyboardPwdStatus 1:正常 2:已过期
|
||||||
// return Container(
|
return Row(
|
||||||
// padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
children: [
|
||||||
// decoration: BoxDecoration(
|
Visibility(
|
||||||
// color: Colors.red,
|
visible: itemData.expireDate! > 0 ? true : false,
|
||||||
// borderRadius: BorderRadius.circular(2.0),
|
child: Container(
|
||||||
// ),
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
// child: Text(
|
decoration: BoxDecoration(
|
||||||
// '未生效',
|
color: AppColors.expireTextBgColor,
|
||||||
// style: TextStyle(
|
borderRadius: BorderRadius.circular(2.0),
|
||||||
// color: Colors.white, fontSize: 13.sp),
|
),
|
||||||
// ),
|
child: Text(
|
||||||
// );
|
'余${itemData.expireDate.toString()}天',
|
||||||
// } else {
|
style: TextStyle(color: Colors.white, fontSize: 13.sp),
|
||||||
if (itemData.expireDate! > 0) {
|
),
|
||||||
return Container(
|
)),
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
Visibility(
|
||||||
decoration: BoxDecoration(
|
visible: itemData.keyboardPwdStatus! == 2 ? true : false,
|
||||||
color: AppColors.expireTextBgColor,
|
child: Container(
|
||||||
borderRadius: BorderRadius.circular(2.0),
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
),
|
decoration: BoxDecoration(
|
||||||
child: Text(
|
color: Colors.red,
|
||||||
'余${itemData.expireDate.toString()}天',
|
borderRadius: BorderRadius.circular(2.0),
|
||||||
style: TextStyle(
|
),
|
||||||
color: Colors.white, fontSize: 13.sp),
|
child: Text(
|
||||||
),
|
'已过期'.tr,
|
||||||
);
|
style: TextStyle(color: Colors.white, fontSize: 13.sp),
|
||||||
} else {
|
),
|
||||||
return Container(
|
))
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
],
|
||||||
decoration: BoxDecoration(
|
);
|
||||||
color: Colors.red,
|
|
||||||
borderRadius: BorderRadius.circular(2.0),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'已过期',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white, fontSize: 13.sp),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,6 +83,94 @@ class PermissionDialog {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//相册
|
||||||
|
static Future<bool> requestPhotos() async {
|
||||||
|
if (Get.context == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool isAndroid33 =
|
||||||
|
AppPlatform.isAndroid && AppPlatform.getSdkIntValue() >= 33;
|
||||||
|
|
||||||
|
//通用的局部函数
|
||||||
|
List<Permission> requestPermission() {
|
||||||
|
List<Permission> permissions;
|
||||||
|
if (isAndroid33) {
|
||||||
|
permissions = [
|
||||||
|
Permission.mediaLibrary,
|
||||||
|
Permission.photos,
|
||||||
|
Permission.videos,
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
permissions = [
|
||||||
|
Permission.storage,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> permissionStatus(List<Permission> permissions) async {
|
||||||
|
bool isGranted = true;
|
||||||
|
for (Permission permission in permissions) {
|
||||||
|
isGranted =
|
||||||
|
isGranted && (await permission.status) == PermissionStatus.granted;
|
||||||
|
}
|
||||||
|
if (isAndroid33) {
|
||||||
|
// android 33以上需要申请媒体库权限
|
||||||
|
isGranted =
|
||||||
|
(await Permission.mediaLibrary.status) == PermissionStatus.granted;
|
||||||
|
}
|
||||||
|
return isGranted;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool application = true;
|
||||||
|
Permission permission = Permission.photos;
|
||||||
|
List<Permission> permissions = requestPermission();
|
||||||
|
dynamic cache = await Storage.getString(titles[permission]);
|
||||||
|
bool isGranted = await permissionStatus(permissions);
|
||||||
|
if (AppPlatform.isAndroid && !isGranted && cache is! String) {
|
||||||
|
application = await showCupertinoDialog(
|
||||||
|
context: Get.context!,
|
||||||
|
builder: (context) {
|
||||||
|
return PopScope(
|
||||||
|
canPop: false,
|
||||||
|
child: CupertinoAlertDialog(
|
||||||
|
title: Text('${'申请'.tr}${titles[permission] ?? ''}${'权限'.tr}'),
|
||||||
|
content: Text(contents[permission] ?? ''),
|
||||||
|
actions: [
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text('不允许'.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back(result: false);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CupertinoDialogAction(
|
||||||
|
child: Text('允许'.tr),
|
||||||
|
onPressed: () {
|
||||||
|
Get.back(result: true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (application) {
|
||||||
|
await Storage.setString(titles[permission], titles[permission]);
|
||||||
|
}
|
||||||
|
} else if (cache is String) {
|
||||||
|
bool isDenied = !(await permissionStatus(permissions));
|
||||||
|
if (isDenied) {
|
||||||
|
showSet(permission);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (application) {
|
||||||
|
Map<Permission, PermissionStatus> statuses = await permissions.request();
|
||||||
|
bool isGranted = await permissionStatus(statuses.keys.toList());
|
||||||
|
return isGranted;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//显示权限判断申请框
|
//显示权限判断申请框
|
||||||
static Future<bool> request(Permission permission, [String? content]) async {
|
static Future<bool> request(Permission permission, [String? content]) async {
|
||||||
if (Get.context == null) {
|
if (Get.context == null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user