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:name="android.app.Application"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="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 <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />

View File

@ -9,6 +9,8 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant import io.flutter.plugins.GeneratedPluginRegistrant
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import androidx.core.content.FileProvider
import java.io.File
class MainActivity : FlutterActivity() { class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -16,9 +18,15 @@ class MainActivity : FlutterActivity() {
GeneratedPluginRegistrant.registerWith(flutterEngine!!) GeneratedPluginRegistrant.registerWith(flutterEngine!!)
MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result -> MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
if (call.method == "loadNativeShare") { if (call.method == "loadNativeShare") {
var map = call.arguments as Map<String, String> val map = call.arguments as Map<String, String>
shareText(map["shareText"] , "分享") val shareText = map["shareText"]
} else if (call.method == "sendGetBlueStatus") { val urlToShare = map["urlToShare"]
if (urlToShare == "fileShare") {
shareFile(shareText)
} else {
shareText(shareText, "分享")
}
} else if (call.method == "sendGetBlueStatus") {
// 蓝牙是否开启 // 蓝牙是否开启
// println("收到原生的信息了 methodmethodmethod: ${call.method}") // println("收到原生的信息了 methodmethodmethod: ${call.method}")
val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter() val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter()
@ -56,13 +64,42 @@ class MainActivity : FlutterActivity() {
startActivity(Intent.createChooser(shareIntent, null)) 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) { override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine); GeneratedPluginRegistrant.registerWith(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result -> MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
println("methodmethodmethod: ${call.method}")
// 在这里处理从 Flutter 发送过来的方法调用
if (call.method == "loadNativeShare") { 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 { } else {
result.notImplemented() 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", "导出成功":"Export success",
"发送钥匙": "Send key", "发送钥匙": "Send key",
"进度": "Progress", "进度": "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/app_settings/app_settings.dart';
import 'package:star_lock/login/forgetPassword/starLock_forgetPassword_logic.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/login/forgetPassword/starLock_forgetPassword_state.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
@ -23,9 +24,12 @@ class StarLockForgetPasswordPage extends StatefulWidget {
_StarLockForgetPasswordPageState(); _StarLockForgetPasswordPageState();
} }
class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage> { class _StarLockForgetPasswordPageState
final StarLockForgetPasswordLogic logic = Get.put(StarLockForgetPasswordLogic()); extends State<StarLockForgetPasswordPage> {
final StarLockForgetPasswordState state = Get.find<StarLockForgetPasswordLogic>().state; final StarLockForgetPasswordLogic logic =
Get.put(StarLockForgetPasswordLogic());
final StarLockForgetPasswordState state =
Get.find<StarLockForgetPasswordLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -57,7 +61,8 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
children: <Widget>[ children: <Widget>[
SizedBox(width: 5.w), SizedBox(width: 5.w),
Expanded( Expanded(
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr, child: Text(
TranslationLoader.lanKeys!.countryAndRegion!.tr,
style: TextStyle( style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor))), fontSize: 26.sp, color: AppColors.blackColor))),
SizedBox(width: 20.w), SizedBox(width: 20.w),
@ -65,14 +70,14 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Obx(() => Text( Obx(() => Text(
'${state.countryName} +${state.countryCode}', '${state.countryName} +${state.countryCode}',
// state.isIphoneType.value // state.isIphoneType.value
// ? '${state.countryName} +${state.countryCode}' // ? '${state.countryName} +${state.countryCode}'
// : "${state.countryName}", // : "${state.countryName}",
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor), fontSize: 26.sp, color: AppColors.blackColor),
)) ))
], ],
), ),
SizedBox(width: 5.w), SizedBox(width: 5.w),
@ -95,14 +100,16 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
logic.checkNext(state.phoneController); logic.checkNext(state.phoneController);
}, },
leftWidget: Padding( 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( child: Image.asset(
'images/icon_login_account.png', 'images/icon_login_account.png',
width: 36.w, width: 36.w,
height: 36.w, height: 36.w,
), ),
), ),
hintText:TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, hintText:
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30), LengthLimitingTextInputFormatter(30),
@ -232,6 +239,11 @@ class _StarLockForgetPasswordPageState extends State<StarLockForgetPasswordPage>
isDisabled: state.canSub.value, isDisabled: state.canSub.value,
onClick: state.canSub.value onClick: state.canSub.value
? () { ? () {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
logic.resetPassword(); logic.resetPassword();
} }
: null); : null);

View File

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

View File

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

View File

@ -33,10 +33,12 @@ FutureOr<void> main() async {
final bool isLogin = await getLoginStatus(); final bool isLogin = await getLoginStatus();
if (isLogin) { if (isLogin) {
await privacySDKInitialization(); 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(); final GetAppInfo entity = await ApiRepository.to.getAppInfo();
CustomerTool.init(entity.data?.wechatServiceUrl ?? ''); 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, rightTitle: state.typeNumber.value,
isHaveDirection: false, isHaveDirection: false,
isHaveLine: true)), isHaveLine: true)),
Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,state.typeName.value, () { Obx(() => lockDataListItem(TranslationLoader.lanKeys!.name!.tr,state.typeName.value, () {
ShowTipView().showTFViewAlertDialog( ShowTipView().showTFViewAlertDialog(
state.changeNameController, state.changeNameController,
'${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}', '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
@ -62,6 +62,7 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50), LengthLimitingTextInputFormatter(50),
]); ]);
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 || 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:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/card/cardList/cardList_state.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 '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -68,6 +69,11 @@ class _CardListPageState extends State<CardListPage> with RouteAware {
onPressed: () async { onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog( ShowTipView().showIosTipWithContentDialog(
'重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async { '重置后,该锁的卡都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true; state.isDeletAll = true;

View File

@ -1,17 +1,13 @@
import 'dart:io';
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:get/get.dart'; import 'package:get/get.dart';
import 'package:open_file/open_file.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/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_logic.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/exportSuccess/exportSuccess_state.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/exportSuccess/exportSuccess_state.dart';
import 'package:star_lock/tools/NativeInteractionTool.dart'; import 'package:star_lock/tools/NativeInteractionTool.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/tools/titleAppBar.dart'; import 'package:star_lock/tools/titleAppBar.dart';
import 'package:url_launcher/url_launcher.dart';
class ExportSuccessPage extends StatefulWidget { class ExportSuccessPage extends StatefulWidget {
const ExportSuccessPage({Key? key}) : super(key: key); 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_logic.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.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/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/noData.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
@ -67,6 +68,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
final bool? isDemoMode = final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot); await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
ShowTipView().showIosTipWithContentDialog( ShowTipView().showIosTipWithContentDialog(
'该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest); '该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest);
} else { } else {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,8 +4,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.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/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/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 '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -44,6 +45,11 @@ class _PalmListPageState extends State<PalmListPage> {
onPressed: () async { onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context); showDeletAlertDialog(context);
} else { } else {
// Get.toNamed(Routers.selectLockTypePage); // Get.toNamed(Routers.selectLockTypePage);
@ -100,6 +106,7 @@ class _PalmListPageState extends State<PalmListPage> {
// //
if (index < state.faceItemListData.value.length) { if (index < state.faceItemListData.value.length) {
return LeftSlideActions( return LeftSlideActions(
tag:getFaceItemData.faceName!,
key: Key(getFaceItemData.faceName!), key: Key(getFaceItemData.faceName!),
actionsWidth: 60, actionsWidth: 60,
actions: [ 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_logic.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.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/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/noData.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
@ -67,6 +68,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
final bool? isDemoMode = final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot); await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
if (state.itemDataList.isEmpty) { if (state.itemDataList.isEmpty) {
logic.showToast('暂无密码,无需重置'.tr); logic.showToast('暂无密码,无需重置'.tr);
return; return;
@ -227,7 +233,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
Row( Row(
children: <Widget>[ children: <Widget>[
SizedBox( 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 - 100.w
: 1.sw - 110.w - 50.w, : 1.sw - 110.w - 50.w,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
@ -247,7 +254,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
'已过期'.tr, '已过期'.tr,
style: TextStyle(color: Colors.red, fontSize: 20.sp), style: TextStyle(color: Colors.red, fontSize: 20.sp),
) )
else if (passwordKeyListItem.keyboardPwdStatus == 3) else if (passwordKeyListItem.keyboardPwdStatus == 3)
Text( Text(
'未生效'.tr, '未生效'.tr,
style: TextStyle(color: Colors.red, fontSize: 20.sp), 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/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_logic.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -44,6 +45,11 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
onPressed: () async { onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
final bool isNetWork =
LockMainLogic.to()?.judgeTheNetwork() ?? false;
if (!isNetWork) {
return;
}
showDeletAlertDialog(context); showDeletAlertDialog(context);
} else { } else {
// Get.toNamed(Routers.selectLockTypePage); // 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_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/flavors.dart';
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart'; import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';

View File

@ -109,11 +109,20 @@ class LockMainLogic extends BaseGetXController {
result != ConnectivityResult.none) { result != ConnectivityResult.none) {
// //
state.networkConnectionStatus.value = 1; 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 { Future<void> checkWhetherPushIsEnabled() async {
bool notificationEnabled = false; bool notificationEnabled = false;
@ -261,6 +270,7 @@ class LockMainLogic extends BaseGetXController {
super.onInit(); super.onInit();
checkWhetherPushIsEnabled(); checkWhetherPushIsEnabled();
_initSubscription(); _initSubscription();
connectListener();
} }
@override @override
@ -270,4 +280,11 @@ class LockMainLogic extends BaseGetXController {
}); });
super.onClose(); 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 = LockListInfoGroupEntity? lockListInfoGroupEntity =
await Storage.getLockMainListData(); await Storage.getLockMainListData();
if (lockListInfoGroupEntity != null) { if (lockListInfoGroupEntity != null) {
logic.loadMainDataLogic(lockListInfoGroupEntity); await logic.loadMainDataLogic(lockListInfoGroupEntity);
setState(() {}); setState(() {});
} }
lockListInfoGroupEntity = lockListInfoGroupEntity =
(await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data; (await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
if (lockListInfoGroupEntity != null) { if (lockListInfoGroupEntity != null) {
logic.loadMainDataLogic(lockListInfoGroupEntity); await logic.loadMainDataLogic(lockListInfoGroupEntity);
setState(() {}); setState(() {});
} }
if (clearScanDevices) { if (clearScanDevices) {
@ -62,7 +62,7 @@ class _StarLockMainPageState extends State<StarLockMainPage>
void initState() { void initState() {
super.initState(); super.initState();
logic.pageNo = 1; logic.pageNo = 1;
getHttpData(); getHttpData(isUnShowLoading:true,);
_initLoadDataAction(); _initLoadDataAction();
} }

View File

@ -1,7 +1,4 @@
import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.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/lockMain_page.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.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/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/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/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 { class StarLockMainXHJPage extends StatefulWidget {
const StarLockMainXHJPage({Key? key}) : super(key: key); const StarLockMainXHJPage({Key? key}) : super(key: key);
@ -26,7 +18,7 @@ class StarLockMainXHJPage extends StatefulWidget {
class _StarLockMainXHJPageState extends State<StarLockMainXHJPage> class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
with BaseWidget { with BaseWidget {
PageController _pageController = PageController(); final PageController _pageController = PageController();
@override @override
void initState() { void initState() {

View File

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

View File

@ -446,7 +446,7 @@ class ApiProvider extends BaseProvider {
// Wifi锁服务器 // Wifi锁服务器
Future<Response> getWifiLockServiceIpAndPort() => Future<Response> getWifiLockServiceIpAndPort() =>
post(getWifiServiceIpURL.toUrl, jsonEncode({})); post(getWifiServiceIpURL.toUrl, jsonEncode({}), isUnShowLoading: true);
Future<Response> passwordKeyList(String keyStatus, String lockId, Future<Response> passwordKeyList(String keyStatus, String lockId,
String pageNo, String pageSize, String searchStr) => String pageNo, String pageSize, String searchStr) =>
@ -1605,8 +1605,7 @@ class ApiProvider extends BaseProvider {
int endTime, int endTime,
int remoteUnlockSwitch, int remoteUnlockSwitch,
int keyRight, int keyRight,
bool isShowNetworkErrorMsg bool isShowNetworkErrorMsg) =>
) =>
post( post(
batchSendKeyURL.toUrl, batchSendKeyURL.toUrl,
jsonEncode({ jsonEncode({
@ -1624,8 +1623,7 @@ class ApiProvider extends BaseProvider {
'remoteUnlockSwitch': remoteUnlockSwitch, 'remoteUnlockSwitch': remoteUnlockSwitch,
'keyRight': keyRight, 'keyRight': keyRight,
}), }),
isShowNetworkErrorMsg: isShowNetworkErrorMsg isShowNetworkErrorMsg: isShowNetworkErrorMsg);
);
Future<Response> addAuthorizedAdmin( Future<Response> addAuthorizedAdmin(
String createUser, String createUser,
@ -1669,7 +1667,8 @@ class ApiProvider extends BaseProvider {
// //
Future<Response> getUserInfo(String operatorUid) => 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( Future<Response> keyboardPwdReset(String lockId, List passwordKey) => post(
@ -2178,7 +2177,7 @@ class ApiProvider extends BaseProvider {
// App基本信息 // App基本信息
Future<Response<dynamic>> getAppInfo() => Future<Response<dynamic>> getAppInfo() =>
post(appGetAppInfoURL.toUrl, jsonEncode(<String, int>{}), post(appGetAppInfoURL.toUrl, jsonEncode(<String, int>{}),
isShowErrMsg: false); isShowErrMsg: false, isUnShowLoading: true);
// App固件信息 // App固件信息
Future<Response<dynamic>> getFwVersion(String model, String currentVersion) => 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/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -8,34 +7,47 @@ class ShowDeleteAdministratorIsHaveAllDataWidget extends StatefulWidget {
BlockIsHaveAllDataCallback? blockIsHaveAllDataCallback; BlockIsHaveAllDataCallback? blockIsHaveAllDataCallback;
String? contentStr; String? contentStr;
ShowDeleteAdministratorIsHaveAllDataWidget({Key? key, this.contentStr, this.blockIsHaveAllDataCallback}) : super(key: key); ShowDeleteAdministratorIsHaveAllDataWidget(
{Key? key, this.contentStr, this.blockIsHaveAllDataCallback})
: super(key: key);
@override @override
State<ShowDeleteAdministratorIsHaveAllDataWidget> createState() => _ShowDeleteAdministratorIsHaveAllDataWidgetState(); State<ShowDeleteAdministratorIsHaveAllDataWidget> createState() =>
_ShowDeleteAdministratorIsHaveAllDataWidgetState();
} }
class _ShowDeleteAdministratorIsHaveAllDataWidgetState extends State<ShowDeleteAdministratorIsHaveAllDataWidget> { class _ShowDeleteAdministratorIsHaveAllDataWidgetState
extends State<ShowDeleteAdministratorIsHaveAllDataWidget> {
bool selet = false; bool selet = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return GestureDetector(
children: [ onTap: () {
GestureDetector( setState(() {
onTap: () { selet = !selet;
setState(() { widget.blockIsHaveAllDataCallback!(selet);
selet = !selet; });
widget.blockIsHaveAllDataCallback!(selet); },
}); child: Row(
}, children: <Widget>[
child: Image.asset( Image.asset(
selet ? 'images/icon_round_select.png' : 'images/icon_round_unSelect.png', selet
width: 30.w, ? 'images/icon_round_select.png'
height: 30.w, : 'images/icon_round_unSelect.png',
)), width: 30.w,
SizedBox(width: 15.w,), height: 30.w,
Expanded(child: Text(widget.contentStr!, maxLines: 2, textAlign: TextAlign.start, style: TextStyle(fontSize: 24.sp))), ),
], 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 # 首次使用记得安装jq brew install jq
# #
###############################################################
############## 正常情况下只需要修改配置,不需要修改代码 ###############
###############################################################
# 设置 # 设置
environment="xhj" environment="xhj"
main_file="lib/main_xhj_full.dart" main_file="lib/main_xhj_full.dart"
version_string="1.0.51" version_string="1.0.66"
file_path="lib/network/api.dart" 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 数据" echo "* 成功获取废弃 api 数据"
# 解析 api 文件数据
string_array=() string_array=()
# 使用egrep搜索被单引号包裹的字符串
while IFS= read -r line; do while IFS= read -r line; do
string_array+=("$line") string_array+=("$line")
done < <(egrep -o "'[^']*'" "$file_path") done < <(egrep -o "'[^']*'" "$file_path")
echo "* 解析 api 文件数据,开始对比" echo "* 解析 api 文件数据,开始对比"
# 进度条初始化
total_urls=$(echo "$urls" | wc -l | tr -d ' ')
current_url=0
# 比较urls和string_array中的元素 # 比较urls和string_array中的元素
for url in $urls; do for url in $urls; do
for string in "${string_array[@]}"; do for string in "${string_array[@]}"; do
@ -30,10 +72,16 @@ for url in $urls; do
exit 1 exit 1
fi fi
done done
# 更新进度条
let current_url++
let progress=(current_url*100/total_urls)
printf "\r进度: [%-50s] %d%%" $(printf '%*s' $((progress/2)) | tr ' ' '#') $progress
done done
echo "* 没有发现 废弃 api开始编译"
# 新的输出从新行开始
echo -e "\n* 没有发现废弃 API开始编译"
# 编译命令
flutter clean && flutter pub get flutter clean && flutter pub get
flutter build apk --flavor $environment -t $main_file flutter build apk --flavor $environment -t $main_file
flutter build ios --flavor $environment -t $main_file flutter build ios --flavor $environment -t $main_file