Merge branch 'release' of https://gitee.com/starlock-cn/app-starlock into release

This commit is contained in:
魏少阳 2024-06-25 10:02:37 +08:00
commit e18fa5c7e5
38 changed files with 740 additions and 521 deletions

View File

@ -60,7 +60,19 @@
android:name="android.app.Application"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true">
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<meta-data
android:name="flutterEmbedding"
android:value="2" />

View File

@ -9,6 +9,8 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant
import android.bluetooth.BluetoothAdapter;
import androidx.core.content.FileProvider
import java.io.File
class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
@ -16,9 +18,15 @@ class MainActivity : FlutterActivity() {
GeneratedPluginRegistrant.registerWith(flutterEngine!!)
MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
if (call.method == "loadNativeShare") {
var map = call.arguments as Map<String, String>
shareText(map["shareText"] , "分享")
} else if (call.method == "sendGetBlueStatus") {
val map = call.arguments as Map<String, String>
val shareText = map["shareText"]
val urlToShare = map["urlToShare"]
if (urlToShare == "fileShare") {
shareFile(shareText)
} else {
shareText(shareText, "分享")
}
} else if (call.method == "sendGetBlueStatus") {
// 蓝牙是否开启
// println("收到原生的信息了 methodmethodmethod: ${call.method}")
val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter()
@ -56,13 +64,42 @@ class MainActivity : FlutterActivity() {
startActivity(Intent.createChooser(shareIntent, null))
}
fun shareFile(filePath: String?) {
if (filePath == null) {
return
}
val file = File(filePath)
if (!file.exists()) {
Log.e("File Share", "文件不存在: $filePath")
return
}
val uri: Uri = FileProvider.getUriForFile(
this,
"${packageName}.provider",
file
)
val shareIntent = Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_STREAM, uri)
type = "application/octet-stream"
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
startActivity(Intent.createChooser(shareIntent, null))
}
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
GeneratedPluginRegistrant.registerWith(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
println("methodmethodmethod: ${call.method}")
// 在这里处理从 Flutter 发送过来的方法调用
if (call.method == "loadNativeShare") {
println("methodmethodmethod: ${call.method}")
val map = call.arguments as Map<String, String>
val shareText = map["shareText"]
val urlToShare = map["urlToShare"]
if (urlToShare == "fileShare") {
shareFile(shareText)
} else {
shareText(shareText, "分享")
}
} else {
result.notImplemented()
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<root-path name="root-path" path="."/>
<files-path name="files" path="."/>
<cache-path name="cache" path="."/>
<external-files-path name="external_files" path="."/>
</paths>

View File

@ -924,5 +924,6 @@
"导出成功":"Export success",
"发送钥匙": "Send key",
"进度": "Progress",
"失败": "Failure"
"失败": "Failure",
"人脸详情": "Face details"
}

View File

@ -956,5 +956,6 @@
"导出成功":"导出成功",
"发送钥匙": "发送钥匙",
"进度": "进度",
"失败": "失败"
"失败": "失败",
"人脸详情": "人脸详情"
}

View File

@ -921,6 +921,7 @@
"导出成功":"导出成功",
"发送钥匙": "发送钥匙",
"进度": "进度",
"失败": "失败"
"失败": "失败",
"人脸详情": "人脸详情"
}

View File

@ -7,6 +7,7 @@ import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../appRouters.dart';
import '../../app_settings/app_colors.dart';
@ -23,9 +24,12 @@ class StarLockForgetPasswordPage extends StatefulWidget {
_StarLockForgetPasswordPageState();
}
class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage> {
final StarLockForgetPasswordLogic logic = Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state = Get.find<StarLockForgetPasswordLogic>().state;
class _StarLockForgetPasswordPageState
extends State<StarLockForgetPasswordPage> {
final StarLockForgetPasswordLogic logic =
Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state =
Get.find<StarLockForgetPasswordLogic>().state;
@override
Widget build(BuildContext context) {
@ -57,7 +61,8 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
children: <Widget>[
SizedBox(width: 5.w),
Expanded(
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
child: Text(
TranslationLoader.lanKeys!.countryAndRegion!.tr,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor))),
SizedBox(width: 20.w),
@ -65,14 +70,14 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Obx(() => Text(
'${state.countryName} +${state.countryCode}',
// state.isIphoneType.value
// ? '${state.countryName} +${state.countryCode}'
// : "${state.countryName}",
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor),
))
'${state.countryName} +${state.countryCode}',
// state.isIphoneType.value
// ? '${state.countryName} +${state.countryCode}'
// : "${state.countryName}",
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor),
))
],
),
SizedBox(width: 5.w),
@ -95,14 +100,16 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
logic.checkNext(state.phoneController);
},
leftWidget: Padding(
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, right: 5.w, left: 5.w),
padding: EdgeInsets.only(
top: 30.w, bottom: 20.w, right: 5.w, left: 5.w),
child: Image.asset(
'images/icon_login_account.png',
width: 36.w,
height: 36.w,
),
),
hintText:TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
hintText:
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30),
@ -232,6 +239,11 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
isDisabled: state.canSub.value,
onClick: state.canSub.value
? () {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
logic.resetPassword();
}
: null);

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -7,6 +6,7 @@ import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/tools/tf_loginInput.dart';
import 'package:star_lock/tools/titleAppBar.dart';
@ -22,8 +22,10 @@ class StarLockForgetPasswordXHJPage extends StatefulWidget {
class _StarLockForgetPasswordPageState
extends State<StarLockForgetPasswordXHJPage> {
final StarLockForgetPasswordLogic logic = Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state = Get.find<StarLockForgetPasswordLogic>().state;
final StarLockForgetPasswordLogic logic =
Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state =
Get.find<StarLockForgetPasswordLogic>().state;
@override
Widget build(BuildContext context) {
@ -102,7 +104,7 @@ class _StarLockForgetPasswordPageState
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
),
label:
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
@ -122,7 +124,7 @@ class _StarLockForgetPasswordPageState
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
),
label:
'${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}',
'${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
@ -136,7 +138,7 @@ class _StarLockForgetPasswordPageState
},
leftWidget: SizedBox(),
hintText:
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20),
]),
@ -179,14 +181,21 @@ class _StarLockForgetPasswordPageState
Obx(() {
return SubmitBtn(
btnName:
'${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}',
'${TranslationLoader.lanKeys!.reset!.tr}${TranslationLoader.lanKeys!.password!.tr}',
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
fontSize: 30.sp,
borderRadius: 20.w,
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
isDisabled: state.canSub.value,
onClick: state.canSub.value
? logic.resetPassword
? () {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
logic.resetPassword();
}
: null);
}),
],

View File

@ -53,7 +53,8 @@ class StarLockLoginLogic extends BaseGetXController {
Storage.saveLoginData(entity.data);
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
eventBus.fire(MineInfoChangeRefreshUI());
XSJPushProvider().bindDeviceID();
await XSJPushProvider().initJPushService();
await XSJPushProvider().bindDeviceID();
XSJPushProvider().initLocalNotification(isCancelLocalPush: false);
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
BlueManage().scanDevices.clear(); //

View File

@ -33,10 +33,12 @@ FutureOr<void> main() async {
final bool isLogin = await getLoginStatus();
if (isLogin) {
await privacySDKInitialization();
Future<void>.delayed(const Duration(milliseconds: 500), () async{
Future<void>.delayed(const Duration(milliseconds: 500), () async {
final GetAppInfo entity = await ApiRepository.to.getAppInfo();
CustomerTool.init(entity.data?.wechatServiceUrl ?? '');
WxPayTool.setAssociationUrl(entity.data!.appSiteUrl!);
if (entity.data?.appSiteUrl != null) {
WxPayTool.setAssociationUrl(entity.data!.appSiteUrl!);
}
});
}

View File

@ -46,7 +46,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,state.typeName.value, () {
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,state.typeName.value, () {
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
@ -62,6 +62,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})),
Obx(() => Visibility(
visible: state.keyType.value == 4 ||

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/card/cardList/cardList_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -68,6 +69,11 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog(
'重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true;

View File

@ -1,17 +1,13 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:path_provider/path_provider.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/exportSuccess/exportSuccess_logic.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/exportSuccess/exportSuccess_state.dart';
import 'package:star_lock/tools/NativeInteractionTool.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/tools/titleAppBar.dart';
import 'package:url_launcher/url_launcher.dart';
class ExportSuccessPage extends StatefulWidget {
const ExportSuccessPage({Key? key}) : super(key: key);
@ -94,23 +90,4 @@ class _ExportSuccessPageState extends State<ExportSuccessPage> with RouteAware {
],
);
}
Future<void> previewFile() async {
//
final Directory appDocDir = await getApplicationDocumentsDirectory();
final String appDocPath = appDocDir.path;
final String filePath = '$appDocPath/record.xlsx';
//
final File file = File(filePath);
if (await file.exists()) {
// 使url_launcher打开文件
final bool launched = await launchUrl(Uri.parse(filePath));
if (!launched) {
throw 'Could not launch $filePath';
}
} else {
print('File does not exist');
}
}
}

View File

@ -6,6 +6,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_logic.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/storage.dart';
@ -67,6 +68,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog(
'该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest);
} else {

View File

@ -174,6 +174,8 @@ class FaceDetailLogic extends BaseGetXController {
showToast('修改成功', something: () {
Get.back(result: 'addScuess');
});
}else{
Get.back();
}
}

View File

@ -33,7 +33,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '人脸详情',
barTitle: '人脸详情'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
@ -44,7 +44,9 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
rightTitle: state.typeNumber.value,
isHaveDirection: false,
isHaveLine: true)),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr, state.typeName.value, () {
Obx(() => lockDataListItem(
TranslationLoader.lanKeys!.name!.tr, state.typeName.value,
() {
// showCupertinoAlertDialog(context);
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
@ -54,7 +56,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
logic.showToast('请输入姓名'.tr);
return;
}
Get.back();
state.typeName.value = state.changeNameController.text;
logic.updateFaceNameData();
}, inputFormatters: <TextInputFormatter>[
@ -64,8 +65,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
})),
Obx(() => Visibility(
visible: state.keyType.value == 4 ||
state.keyType.value == 2 ||
state.keyType.value == 1,
state.keyType.value == 2 ||
state.keyType.value == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h,
@ -187,11 +188,12 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
rightTitle: '',
isHaveDirection: true,
action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 4,
'id': state.faceItemData.value.faceId.toString(),
'recordName': state.faceItemData.value.faceName
});
Get.toNamed(Routers.lockOperatingRecordPage,
arguments: <String, Object?>{
'type': 4,
'id': state.faceItemData.value.faceId.toString(),
'recordName': state.faceItemData.value.faceName
});
}),
// SizedBox(height: 40.h),
// addControlsBtn(type),
@ -215,12 +217,14 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
);
}
Widget lockDataListItem(String leftTitle, String conentStr, Function()? action){
Widget lockDataListItem(
String leftTitle, String conentStr, Function()? action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
padding:
EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
@ -228,15 +232,17 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
)),
child: Row(
children: <Widget>[
Text(leftTitle, style: TextStyle(fontSize: 22.sp)),
SizedBox(width: 10.w),
Expanded(
child: Text(conentStr, textAlign:TextAlign.end, style: TextStyle(fontSize: 22.sp, ))
),
child: Text(conentStr,
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 22.sp,
))),
SizedBox(width: 10.w),
Image.asset(
'images/icon_right_grey.png',

View File

@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/keySearchWidget.dart';
import 'package:star_lock/tools/left_slide_actions.dart';
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
import 'package:star_lock/tools/showTipView.dart';
import '../../../../appRouters.dart';
@ -26,15 +26,15 @@ class FaceListPage extends StatefulWidget {
State<FaceListPage> createState() => _FaceListPageState();
}
class _FaceListPageState extends State<FaceListPage> with RouteAware {
class _FaceListPageState extends State<FaceListPage> with RouteAware {
final logic = Get.put(FaceListLogic());
final state = Get.find<FaceListLogic>().state;
Future<void> getHttpData() async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic.getFaceListData().then((FingerprintListDataEntity value){
if(mounted) setState(() {});
logic.getFaceListData().then((FingerprintListDataEntity value) {
if (mounted) setState(() {});
});
}
}
@ -46,7 +46,6 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
getHttpData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -65,8 +64,14 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
// showDeletAlertDialog(context);
ShowTipView().showIosTipWithContentDialog("重置后,该锁的人脸都将被删除哦,确认要重置吗?", () async {
ShowTipView().showIosTipWithContentDialog(
"重置后,该锁的人脸都将被删除哦,确认要重置吗?", () async {
state.isDeletAll = true;
state.deletKeyID = "1";
state.deletFaceNo = 0;
@ -82,11 +87,11 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
],
),
body: EasyRefreshTool(
onRefresh: (){
onRefresh: () {
logic.pageNo = 1;
getHttpData();
},
onLoad: (){
onLoad: () {
getHttpData();
},
child: Column(
@ -130,10 +135,12 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
? ListView.separated(
itemCount: state.faceItemListData.value.length,
itemBuilder: (c, index) {
FingerprintItemData getFaceItemData = state.faceItemListData.value[index];
FingerprintItemData getFaceItemData =
state.faceItemListData.value[index];
//
if (index < state.faceItemListData.value.length) {
return LeftSlideActions(
tag: getFaceItemData.faceName!,
key: Key(getFaceItemData.faceName!),
actionsWidth: 60,
actions: [
@ -146,9 +153,9 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
'images/icon_face.png',
getFaceItemData.faceName!,
logic.getKeyType(getFaceItemData),
logic.getKeyDateType(getFaceItemData),
() async {
var data = await Get.toNamed(Routers.faceDetailPage, arguments: {
logic.getKeyDateType(getFaceItemData), () async {
var data =
await Get.toNamed(Routers.faceDetailPage, arguments: {
"faceItemData": getFaceItemData,
});
if (data != null) {
@ -252,14 +259,13 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
child: Row(
children: [
Flexible(
child: Text(
lockTypeTitle,
child: Text(lockTypeTitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
),
style: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor)),
),
],
),
),

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintList_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -69,6 +70,11 @@ class _FingerprintListPageState extends State<FingerprintListPage>
onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog(
'重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true;

View File

@ -4,8 +4,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'package:star_lock/main/lockDetail/iris/irisList/irisList_logic.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/keySearchWidget.dart';
import 'package:star_lock/tools/left_slide_actions.dart';
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -42,8 +43,13 @@ class _IrisListPageState extends State<IrisListPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
final isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context);
} else {
// Get.toNamed(Routers.selectLockTypePage);
@ -73,7 +79,7 @@ class _IrisListPageState extends State<IrisListPage> {
// "lockId": state.lockId.value,
// "fromType": 1 // 1 2
// });
var data =
final data =
await Get.toNamed(Routers.addIrisTypeManagePage, arguments: {
"lockId": state.lockId.value,
"fromType": 1 // 1 2
@ -95,11 +101,12 @@ class _IrisListPageState extends State<IrisListPage> {
? ListView.separated(
itemCount: state.faceItemListData.value.length,
itemBuilder: (c, index) {
FingerprintItemData getFaceItemData =
final FingerprintItemData getFaceItemData =
state.faceItemListData.value[index];
//
if (index < state.faceItemListData.value.length) {
return LeftSlideActions(
tag: getFaceItemData.faceName!,
key: Key(getFaceItemData.faceName!),
actionsWidth: 60,
actions: [
@ -122,7 +129,7 @@ class _IrisListPageState extends State<IrisListPage> {
// ? "永久"
// : "${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())}",
() async {
var data =
final data =
await Get.toNamed(Routers.faceDetailPage, arguments: {
"faceItemData": getFaceItemData,
});

View File

@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -28,9 +29,7 @@ class LockSetPage extends StatefulWidget {
class _LockSetPageState extends State<LockSetPage> with RouteAware {
final LockSetLogic logic = Get.put(LockSetLogic());
final LockSetState state = Get
.find<LockSetLogic>()
.state;
final LockSetState state = Get.find<LockSetLogic>().state;
Future<void> getHttpData() async {
logic.getLockSettingInfoData().then((LockSetInfoEntity value) {
@ -65,8 +64,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
child: Column(
children: <Widget>[
Expanded(
child: Obx(() =>
ListView(
child: Obx(() => ListView(
children: getListWidget(),
)),
),
@ -104,47 +102,43 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}),
SizedBox(height: 10.h),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? '${state.lockSetInfoData.value.lockSettingInfo!
.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value
});
}))),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.passageMode == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value
});
}))),
Visibility(
visible: true,
child: CommonItem(
@ -153,10 +147,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(
Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
Get.toNamed(Routers.lockTimePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
SizedBox(height: 30.h),
Container(
@ -166,10 +160,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isDelete: true,
onClick: () {
// logic.deletUserAction();
// logic.deletLockInfoData();
// showDeletAlertDialog(context);
// showDeletPasswordAlertDialog(context);
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
logic.deleyLockLogicOfRoles();
}),
),
@ -242,27 +240,25 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// })),
// SizedBox(height: 10.h),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0
? '${state.lockSetInfoData.value.lockSettingInfo!
.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0
? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
// isHaveRightWidget: true,
// rightWidget: rightText((state.lockSetInfoData.value.lockSetting!.autoLock ?? 0) > 0
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr),
action: () {
Get.toNamed(Routers.automaticBlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() {
String titleStr = '';
@ -302,80 +298,72 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
}));
}),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ??
0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.burglarAlarmPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.passageMode == 1,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1,
// visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.normallyOpenModePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.remoteUnlockingPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
//
Obx(() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.resetSwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) ==
1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.resetSwitch == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
? TranslationLoader.lanKeys!.opened!.tr
: TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.resetButtonPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
SizedBox(height: 10.h),
//---
// Obx(() =>
@ -409,20 +397,19 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
});
})),
//
Obx(() =>
Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
Obx(() => Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.catEyeSetPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
}))),
// Obx(() =>
//
// Visibility(
@ -477,7 +464,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// 广使
/* 2024-01-12 广 by DaisyWu
Obx(() => Visibility(
visible: true,
visible: true,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.bluetoothBroadcast!.tr,
rightTitle: "",
@ -511,66 +498,62 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// }),
//
Obx(
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.attendance == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())),
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.attendance == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())),
),
//
Obx(
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())),
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.unlockReminder == 1,
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())),
),
// APP开锁时是否需联网
Obx(
() =>
Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.appUnlockOnline == 1,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()),
),
() => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 &&
state.lockFeature.value.appUnlockOnline == 1,
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()),
),
),
SizedBox(height: 10.h),
// wifi配网
Obx(
() =>
Visibility(
visible: state.lockFeature.value.wifi == 1,
child: CommonItem(
leftTitel:
() => Visibility(
visible: state.lockFeature.value.wifi == 1,
child: CommonItem(
leftTitel:
TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wifiListPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
// Get.toNamed(Routers.configuringWifiPage, arguments: {
// 'lockSetInfoData': state.lockSetInfoData.value
// });
})),
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.wifiListPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
// Get.toNamed(Routers.configuringWifiPage, arguments: {
// 'lockSetInfoData': state.lockSetInfoData.value
// });
})),
),
// Obx(() =>
//
@ -582,10 +565,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(
Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
Get.toNamed(Routers.lockTimePage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ),
// Obx(() =>
@ -676,12 +659,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
thumbColor: CupertinoColors.white,
value: state.isAttendance.value == 1,
onChanged: (bool value) {
logic.openCheckingInData((
CheckingInInfoDataEntity checkingInInfoDataEntity) {
logic.openCheckingInData(
(CheckingInInfoDataEntity checkingInInfoDataEntity) {
if (checkingInInfoDataEntity.data!.companyId == 0) {
// logic.showCupertinoAlertDialog(context);
ShowTipView().showIosTipWithContentDialog(
'创建公司后,考勤功能才能使用'.tr, () {
ShowTipView().showIosTipWithContentDialog('创建公司后,考勤功能才能使用'.tr, () {
//
Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: <String, LockSetInfoData>{

View File

@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../../../appRouters.dart';
@ -19,6 +20,7 @@ class WirelessKeyboardPage extends StatefulWidget {
class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
List dataList = [];
@override
Widget build(BuildContext context) {
return Scaffold(
@ -34,6 +36,11 @@ class _WirelessKeyboardPageState extends State<WirelessKeyboardPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
_showDialog(context);
},
),

View File

@ -4,8 +4,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_logic.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/keySearchWidget.dart';
import 'package:star_lock/tools/left_slide_actions.dart';
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -44,6 +45,11 @@ class _PalmListPageState extends State<PalmListPage> {
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context);
} else {
// Get.toNamed(Routers.selectLockTypePage);
@ -100,6 +106,7 @@ class _PalmListPageState extends State<PalmListPage> {
//
if (index < state.faceItemListData.value.length) {
return LeftSlideActions(
tag:getFaceItemData.faceName!,
key: Key(getFaceItemData.faceName!),
actionsWidth: 60,
actions: [

View File

@ -6,6 +6,7 @@ import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKe
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
@ -67,6 +68,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
if (state.itemDataList.isEmpty) {
logic.showToast('暂无密码,无需重置'.tr);
return;
@ -227,7 +233,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
Row(
children: <Widget>[
SizedBox(
width: passwordKeyListItem.keyboardPwdStatus == 2 || passwordKeyListItem.keyboardPwdStatus == 3
width: passwordKeyListItem.keyboardPwdStatus == 2 ||
passwordKeyListItem.keyboardPwdStatus == 3
? 1.sw - 110.w - 100.w
: 1.sw - 110.w - 50.w,
child: Row(children: <Widget>[
@ -247,7 +254,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
'已过期'.tr,
style: TextStyle(color: Colors.red, fontSize: 20.sp),
)
else if (passwordKeyListItem.keyboardPwdStatus == 3)
else if (passwordKeyListItem.keyboardPwdStatus == 3)
Text(
'未生效'.tr,
style: TextStyle(color: Colors.red, fontSize: 20.sp),

View File

@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
@ -44,6 +45,11 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context);
} else {
// Get.toNamed(Routers.selectLockTypePage);

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
import '../../../appRouters.dart';

View File

@ -109,11 +109,20 @@ class LockMainLogic extends BaseGetXController {
result != ConnectivityResult.none) {
//
state.networkConnectionStatus.value = 1;
getStarLockInfo();
getStarLockInfo(isUnShowLoading: true);
}
});
}
///
bool judgeTheNetwork() {
final bool isNetwork = state.networkConnectionStatus.value == 1;
if (!isNetwork) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr);
}
return isNetwork;
}
///
Future<void> checkWhetherPushIsEnabled() async {
bool notificationEnabled = false;
@ -261,6 +270,7 @@ class LockMainLogic extends BaseGetXController {
super.onInit();
checkWhetherPushIsEnabled();
_initSubscription();
connectListener();
}
@override
@ -270,4 +280,11 @@ class LockMainLogic extends BaseGetXController {
});
super.onClose();
}
static LockMainLogic? to() {
if (Get.isRegistered<LockMainLogic>()) {
return Get.find<LockMainLogic>();
}
return null;
}
}

View File

@ -44,13 +44,13 @@ class _StarLockMainPageState extends State<StarLockMainPage>
LockListInfoGroupEntity? lockListInfoGroupEntity =
await Storage.getLockMainListData();
if (lockListInfoGroupEntity != null) {
logic.loadMainDataLogic(lockListInfoGroupEntity);
await logic.loadMainDataLogic(lockListInfoGroupEntity);
setState(() {});
}
lockListInfoGroupEntity =
(await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
if (lockListInfoGroupEntity != null) {
logic.loadMainDataLogic(lockListInfoGroupEntity);
await logic.loadMainDataLogic(lockListInfoGroupEntity);
setState(() {});
}
if (clearScanDevices) {
@ -62,7 +62,7 @@ class _StarLockMainPageState extends State<StarLockMainPage>
void initState() {
super.initState();
logic.pageNo = 1;
getHttpData();
getHttpData(isUnShowLoading:true,);
_initLoadDataAction();
}

View File

@ -1,7 +1,4 @@
import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
@ -9,13 +6,8 @@ import 'package:star_lock/baseWidget.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_page.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
import 'package:star_lock/mine/mall/lockMall_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_xhj_page.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart';
class StarLockMainXHJPage extends StatefulWidget {
const StarLockMainXHJPage({Key? key}) : super(key: key);
@ -26,7 +18,7 @@ class StarLockMainXHJPage extends StatefulWidget {
class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
with BaseWidget {
PageController _pageController = PageController();
final PageController _pageController = PageController();
@override
void initState() {

View File

@ -4,6 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList/lockGroupList_state.dart';
import 'package:star_lock/tools/left_slide/left_slide_logic.dart';
import 'package:star_lock/tools/showTipView.dart';
import '../../../../../../appRouters.dart';
@ -11,7 +12,7 @@ import '../../../../../../app_settings/app_colors.dart';
import '../../../../../../tools/commonItem.dart';
import '../../../../../../tools/titleAppBar.dart';
import '../../../../../../translations/trans_lib.dart';
import '../../../../tools/left_slide_actions.dart';
import '../../../../tools/left_slide/left_slide_actions.dart';
import '../../../../tools/noData.dart';
import 'lockGroupList_logic.dart';
@ -56,9 +57,11 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
logic.showToast(
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
}
}, isShowSuffixIcon:true, inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(50),
]);
},
isShowSuffixIcon: true,
inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(50),
]);
},
),
],
@ -66,23 +69,22 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
body: Column(
children: <Widget>[
Expanded(
child: Obx(() => state.itemDataList.value.isEmpty
? NoData()
: _buildMainUI())),
child: Obx(() =>
state.itemDataList.isEmpty ? NoData() : _buildMainUI())),
],
),
);
}
Widget _buildMainUI() {
for (int i = 0; i < state.itemDataList.value.length; i++) {
final GroupListItem itemData = state.itemDataList.value[i];
for (int i = 0; i < state.itemDataList.length; i++) {
final GroupListItem itemData = state.itemDataList[i];
state.lockNum += itemData.lockList!.length;
}
return ListView.separated(
itemCount: state.itemDataList.value.length + 1,
itemCount: state.itemDataList.length + 1,
itemBuilder: (BuildContext c, int index) {
if (index == state.itemDataList.value.length) {
if (index == state.itemDataList.length) {
return Center(
child: Column(
children: <Widget>[
@ -101,12 +103,13 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
),
);
} else {
final GroupListItem itemData = state.itemDataList.value[index];
final GroupListItem itemData = state.itemDataList[index];
if (itemData.groupType == 0) {
state.ungrouped = itemData;
}
if (index < state.itemDataList.value.length) {
if (index < state.itemDataList.length) {
return LeftSlideActions(
tag: itemData.keyGroupId!.toString(),
key: Key(itemData.keyGroupId!.toString()),
actionsWidth: itemData.groupType != 0 ? 200.w : 0,
actions: itemData.groupType != 0
@ -118,12 +121,15 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(1)),
),
child: lockDataListItem('${itemData.keyGroupName}(${itemData.lockList?.length})', () {
Get.toNamed(Routers.lockItemListPage, arguments: <String, GroupListItem>{
child: lockDataListItem(
'${itemData.keyGroupName}(${itemData.lockList?.length})',
() {
Get.toNamed(Routers.lockItemListPage,
arguments: <String, GroupListItem>{
'groupListItem': itemData,
'ungrouped': state.ungrouped
});
}),
}),
);
}
return const SizedBox.shrink();
@ -170,13 +176,15 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
state.changeNameController.text = groupListItem.keyGroupName!;
// showCupertinoAlertDialog(context, false, groupListItem.keyGroupId!);
ShowTipView().showTFViewAlertDialog(
state.changeNameController,
'修改名称'.tr,
TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
ShowTipView().showTFViewAlertDialog(state.changeNameController,
'修改名称'.tr, TranslationLoader.lanKeys!.pleaseEnter!.tr, () {
if (state.changeNameController.text.isNotEmpty) {
Get.back();
logic.editLockGroupRequest(groupListItem.keyGroupId!);
final String keyGroupId = groupListItem.keyGroupId!.toString();
if (Get.isRegistered<LeftSlideLogic>(tag: keyGroupId)) {
Get.find<LeftSlideLogic>(tag: keyGroupId).hide();
}
} else {
logic.showToast(
TranslationLoader.lanKeys!.pleaseEnterAGroupName!.tr);
@ -200,26 +208,24 @@ class _LockGroupListPageState extends State<LockGroupListPage> {
);
}
Widget lockDataListItem(String title, Function()? action){
Widget lockDataListItem(String title, Function()? action) {
return GestureDetector(
onTap: action,
child: Container(
// height: 70.h,
padding: EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
padding:
EdgeInsets.only(left: 20.w, right: 10.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)
),
color: Colors.white,
border: Border(
bottom: BorderSide(
color: AppColors.greyLineColor, //
width: 2.0.h, //
),
)),
child: Row(
children: <Widget>[
Expanded(child:
Text(title, style: TextStyle(fontSize: 22.sp))
),
Expanded(child: Text(title, style: TextStyle(fontSize: 22.sp))),
// Text(title, style: TextStyle(fontSize: 22.sp)),
],
),

View File

@ -75,7 +75,7 @@ abstract class Api {
final String openCheckingInURL =
'/attendanceCompany/isExistenceCompany'; //
final String setCheckInCreateCompanyURL =
'/attendanceCompany/add'; //
'/v2/attendanceCompany/add'; //
final String deleteCompanyURL = '/attendanceCompany/delete'; //
final String getAttendanceRecordListByDateURL =

View File

@ -446,7 +446,7 @@ class ApiProvider extends BaseProvider {
// Wifi锁服务器
Future<Response> getWifiLockServiceIpAndPort() =>
post(getWifiServiceIpURL.toUrl, jsonEncode({}));
post(getWifiServiceIpURL.toUrl, jsonEncode({}), isUnShowLoading: true);
Future<Response> passwordKeyList(String keyStatus, String lockId,
String pageNo, String pageSize, String searchStr) =>
@ -1605,8 +1605,7 @@ class ApiProvider extends BaseProvider {
int endTime,
int remoteUnlockSwitch,
int keyRight,
bool isShowNetworkErrorMsg
) =>
bool isShowNetworkErrorMsg) =>
post(
batchSendKeyURL.toUrl,
jsonEncode({
@ -1624,8 +1623,7 @@ class ApiProvider extends BaseProvider {
'remoteUnlockSwitch': remoteUnlockSwitch,
'keyRight': keyRight,
}),
isShowNetworkErrorMsg: isShowNetworkErrorMsg
);
isShowNetworkErrorMsg: isShowNetworkErrorMsg);
Future<Response> addAuthorizedAdmin(
String createUser,
@ -1669,7 +1667,8 @@ class ApiProvider extends BaseProvider {
//
Future<Response> getUserInfo(String operatorUid) =>
post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid}));
post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid}),
isUnShowLoading: true);
//
Future<Response> keyboardPwdReset(String lockId, List passwordKey) => post(
@ -2178,7 +2177,7 @@ class ApiProvider extends BaseProvider {
// App基本信息
Future<Response<dynamic>> getAppInfo() =>
post(appGetAppInfoURL.toUrl, jsonEncode(<String, int>{}),
isShowErrMsg: false);
isShowErrMsg: false, isUnShowLoading: true);
// App固件信息
Future<Response<dynamic>> getFwVersion(String model, String currentVersion) =>

View File

@ -0,0 +1,101 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/left_slide/left_slide_logic.dart';
typedef BaseFunction<T> = void Function(T o);
/// : https://blog.csdn.net/zhuowalun8427/article/details/121285947
class LeftSlideActions extends StatefulWidget {
const LeftSlideActions({
required this.tag,
required this.actionsWidth,
required this.actions,
required this.child,
Key? key,
this.decoration,
this.actionsWillShow,
this.exportHideActions,
}) : super(key: key);
final String tag;
final double actionsWidth;
final List<Widget> actions;
final Widget child;
final Decoration? decoration;
final VoidCallback? actionsWillShow;
final BaseFunction<VoidCallback>? exportHideActions;
@override
_LeftSlideActionsState createState() => _LeftSlideActionsState();
}
class _LeftSlideActionsState extends State<LeftSlideActions>
with TickerProviderStateMixin {
late AnimationController _controller;
late LeftSlideLogic logic;
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
void initState() {
super.initState();
_controller = AnimationController(
lowerBound: -widget.actionsWidth,
upperBound: 0,
vsync: this,
duration: const Duration(milliseconds: 300),
)..addListener(() {
logic.translateX = _controller.value;
setState(() {});
});
if (widget.exportHideActions != null) {
widget.exportHideActions!(logic.hide);
}
logic = LeftSlideLogic(
controller: _controller,
actionsWidth: widget.actionsWidth,
actions: widget.actions,
decoration: widget.decoration,
actionsWillShow: widget.actionsWillShow,
exportHideActions: widget.exportHideActions,
);
Get.put(logic, tag: widget.tag);
}
@override
Widget build(BuildContext context) {
return GetBuilder<LeftSlideLogic>(
tag: widget.tag,
builder: (LeftSlideLogic logic) {
return Container(
decoration: widget.decoration,
clipBehavior: Clip.hardEdge,
child: Stack(
children: <Widget>[
Positioned.fill(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: widget.actions,
),
),
GestureDetector(
onHorizontalDragUpdate: logic.onHorizontalDragUpdate,
onHorizontalDragEnd: logic.onHorizontalDragEnd,
child: Transform.translate(
offset: Offset(logic.translateX, 0),
child: Row(
children: <Widget>[
Expanded(flex: 1, child: widget.child),
],
),
),
),
],
),
);
});
}
}

View File

@ -0,0 +1,62 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/left_slide/left_slide_actions.dart';
class LeftSlideLogic extends GetxController {
LeftSlideLogic({
required this.controller,
required this.actionsWidth,
required this.actions,
required this.decoration,
required this.actionsWillShow,
required this.exportHideActions,
});
late AnimationController controller;
final double actionsWidth;
final List<Widget> actions;
final Decoration? decoration;
final VoidCallback? actionsWillShow;
final BaseFunction<VoidCallback>? exportHideActions;
double translateX = 0;
@override
void onInit() {
super.onInit();
}
void onHorizontalDragUpdate(DragUpdateDetails details) {
translateX = (translateX + details.delta.dx).clamp(-actionsWidth, 0.0);
update();
}
void onHorizontalDragEnd(DragEndDetails details) {
controller.value = translateX;
if (details.velocity.pixelsPerSecond.dx > 200) {
hide();
} else if (details.velocity.pixelsPerSecond.dx < -200) {
show();
} else {
if (translateX.abs() > actionsWidth / 2) {
show();
} else {
hide();
}
}
}
void show() {
if (actionsWillShow != null) {
actionsWillShow!();
}
if (translateX != -actionsWidth) {
controller.animateTo(-actionsWidth);
}
}
void hide() {
if (translateX != 0) {
controller.animateTo(0);
}
}
}

View File

@ -1,124 +0,0 @@
import 'package:flutter/material.dart';
typedef _BaseFunction<T> = void Function(T o);
/// : https://blog.csdn.net/zhuowalun8427/article/details/121285947
class LeftSlideActions extends StatefulWidget {
final double actionsWidth;
final List<Widget> actions;
final Widget child;
final Decoration? decoration;
final VoidCallback? actionsWillShow;
final _BaseFunction<VoidCallback>? exportHideActions;
const LeftSlideActions({
Key? key,
required this.actionsWidth,
required this.actions,
required this.child,
this.decoration,
this.actionsWillShow,
this.exportHideActions,
}) : super(key: key);
@override
_LeftSlideActionsState createState() => _LeftSlideActionsState();
}
class _LeftSlideActionsState extends State<LeftSlideActions>
with TickerProviderStateMixin {
double _translateX = 0;
late AnimationController _controller;
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
void initState() {
super.initState();
_controller = AnimationController(
lowerBound: -widget.actionsWidth,
upperBound: 0,
vsync: this,
duration: const Duration(milliseconds: 300),
)..addListener(() {
_translateX = _controller.value;
setState(() {});
});
if (widget.exportHideActions != null) {
widget.exportHideActions!(_hide);
}
}
@override
Widget build(BuildContext context) {
return Container(
decoration: widget.decoration,
clipBehavior: Clip.hardEdge,
child: Stack(
children: [
Positioned.fill(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: widget.actions,
),
),
GestureDetector(
onHorizontalDragUpdate: (v) {
_onHorizontalDragUpdate(v);
},
onHorizontalDragEnd: (v) {
_onHorizontalDragEnd(v);
},
child: Transform.translate(
offset: Offset(_translateX, 0),
child: Row(
children: [
Expanded(flex: 1, child: widget.child),
],
),
),
),
],
),
);
}
void _onHorizontalDragUpdate(DragUpdateDetails details) {
_translateX = (_translateX + details.delta.dx).clamp(-widget.actionsWidth, 0.0);
setState(() {});
}
void _onHorizontalDragEnd(DragEndDetails details) {
_controller.value = _translateX;
if (details.velocity.pixelsPerSecond.dx > 200) {
_hide();
} else if (details.velocity.pixelsPerSecond.dx < -200) {
_show();
} else {
if (_translateX.abs() > widget.actionsWidth / 2) {
_show();
} else {
_hide();
}
}
}
void _show() {
if (widget.actionsWillShow != null) {
widget.actionsWillShow!();
}
if (_translateX != -widget.actionsWidth) {
_controller.animateTo(-widget.actionsWidth);
}
}
void _hide() {
if (_translateX != 0) {
_controller.animateTo(0);
}
}
}

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -8,34 +7,47 @@ class ShowDeleteAdministratorIsHaveAllDataWidget extends StatefulWidget {
BlockIsHaveAllDataCallback? blockIsHaveAllDataCallback;
String? contentStr;
ShowDeleteAdministratorIsHaveAllDataWidget({Key? key, this.contentStr, this.blockIsHaveAllDataCallback}) : super(key: key);
ShowDeleteAdministratorIsHaveAllDataWidget(
{Key? key, this.contentStr, this.blockIsHaveAllDataCallback})
: super(key: key);
@override
State<ShowDeleteAdministratorIsHaveAllDataWidget> createState() => _ShowDeleteAdministratorIsHaveAllDataWidgetState();
State<ShowDeleteAdministratorIsHaveAllDataWidget> createState() =>
_ShowDeleteAdministratorIsHaveAllDataWidgetState();
}
class _ShowDeleteAdministratorIsHaveAllDataWidgetState extends State<ShowDeleteAdministratorIsHaveAllDataWidget> {
class _ShowDeleteAdministratorIsHaveAllDataWidgetState
extends State<ShowDeleteAdministratorIsHaveAllDataWidget> {
bool selet = false;
@override
Widget build(BuildContext context) {
return Row(
children: [
GestureDetector(
onTap: () {
setState(() {
selet = !selet;
widget.blockIsHaveAllDataCallback!(selet);
});
},
child: Image.asset(
selet ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
)),
SizedBox(width: 15.w,),
Expanded(child: Text(widget.contentStr!, maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))),
],
return GestureDetector(
onTap: () {
setState(() {
selet = !selet;
widget.blockIsHaveAllDataCallback!(selet);
});
},
child: Row(
children: <Widget>[
Image.asset(
selet
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
SizedBox(
width: 15.w,
),
Expanded(
child: Text(widget.contentStr!,
maxLines: 2,
textAlign: TextAlign.start,
style: TextStyle(fontSize: 24.sp))),
],
),
);
}
}

View File

@ -4,22 +4,64 @@
# 首次使用记得安装jq brew install jq
#
###############################################################
############## 正常情况下只需要修改配置,不需要修改代码 ###############
###############################################################
# 设置
environment="xhj"
main_file="lib/main_xhj_full.dart"
version_string="1.0.51"
version_string="1.0.66"
file_path="lib/network/api.dart"
urls=$(curl -s -X POST -d "version=$version_string" 'https://lock.xhjcn.ltd/api/app/getDeprecatedApiList' | jq -r '.data[].url')
###############################################################
###############################################################
# 判断执行环境
case $environment in
dev)
api_prefix='https://dev.lock.star-lock.cn'
;;
pre)
api_prefix='https://pre.lock.star-lock.cn'
;;
sky)
api_prefix='https://lock.skychip.top'
;;
xhj)
api_prefix='https://lock.xhjcn.ltd'
;;
*)
echo "错误: flavor[$environment] apiPrefix not found"
exit 1
;;
esac
echo "API 前缀为: $api_prefix"
response=$(curl -s -X POST -d "version=$version_string" "$api_prefix/api/app/checkAppBuildVersion")
error_code=$(echo $response | jq '.errorCode')
# 判断是否成功
if [ "$error_code" != "0" ]; then
error_msg=$(echo $response | jq -r '.errorMsg')
echo "失败:$error_msg"
exit 1
fi
urls=$(curl -s -X POST -d "version=$version_string" "$api_prefix/api/app/getDeprecatedApiList" | jq -r '.data[].url')
echo "* 成功获取废弃 api 数据"
# 解析 api 文件数据
string_array=()
# 使用egrep搜索被单引号包裹的字符串
while IFS= read -r line; do
string_array+=("$line")
done < <(egrep -o "'[^']*'" "$file_path")
echo "* 解析 api 文件数据,开始对比"
# 进度条初始化
total_urls=$(echo "$urls" | wc -l | tr -d ' ')
current_url=0
# 比较urls和string_array中的元素
for url in $urls; do
for string in "${string_array[@]}"; do
@ -30,10 +72,16 @@ for url in $urls; do
exit 1
fi
done
# 更新进度条
let current_url++
let progress=(current_url*100/total_urls)
printf "\r进度: [%-50s] %d%%" $(printf '%*s' $((progress/2)) | tr ' ' '#') $progress
done
echo "* 没有发现 废弃 api开始编译"
# 新的输出从新行开始
echo -e "\n* 没有发现废弃 API开始编译"
# 编译命令
flutter clean && flutter pub get
flutter build apk --flavor $environment -t $main_file
flutter build ios --flavor $environment -t $main_file