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

This commit is contained in:
Daisy 2024-06-04 18:09:49 +08:00
commit efd475394d
16 changed files with 298 additions and 185 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -10,14 +10,14 @@ import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant import io.flutter.plugins.GeneratedPluginRegistrant
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
class MainActivity: FlutterActivity() { class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
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> var map = call.arguments as Map<String, String>
shareText(map["shareText"], "分享") shareText(map["shareText"] , "分享")
} else if (call.method == "sendGetBlueStatus") { } else if (call.method == "sendGetBlueStatus") {
// 蓝牙是否开启 // 蓝牙是否开启
// println("收到原生的信息了 methodmethodmethod: ${call.method}") // println("收到原生的信息了 methodmethodmethod: ${call.method}")
@ -58,8 +58,7 @@ class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine); GeneratedPluginRegistrant.registerWith(flutterEngine);
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
call, result ->
println("methodmethodmethod: ${call.method}") println("methodmethodmethod: ${call.method}")
// 在这里处理从 Flutter 发送过来的方法调用 // 在这里处理从 Flutter 发送过来的方法调用
if (call.method == "loadNativeShare") { if (call.method == "loadNativeShare") {

View File

@ -14,6 +14,7 @@
@property(nonatomic,strong) FlutterMethodChannel* methodChannel; @property(nonatomic,strong) FlutterMethodChannel* methodChannel;
@property (nonatomic, copy) NSString *textToShare; @property (nonatomic, copy) NSString *textToShare;
@property (nonatomic, copy) NSString *urlToShare;
@end @end
@ -24,7 +25,8 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.textToShare = [[NSString alloc] init]; self.textToShare = [[NSString alloc] init];
self.textToShare = [[NSString alloc] init];
[self methodChannelFunction]; [self methodChannelFunction];
} }
- (void)methodChannelFunction { - (void)methodChannelFunction {
@ -44,10 +46,12 @@
NSDictionary *paramDic = (NSDictionary *)params; NSDictionary *paramDic = (NSDictionary *)params;
// //
self.textToShare = paramDic[@"shareText"]; self.textToShare = paramDic[@"shareText"];
self.urlToShare = paramDic[@"urlToShare"];
} }
//url //url
NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"]; NSURL *urlToShare = [NSURL URLWithString:self.urlToShare];
// NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"];
// //
NSArray *activityItems = @[self.textToShare,urlToShare]; NSArray *activityItems = @[self.textToShare,urlToShare];

View File

@ -151,7 +151,13 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
arguments: <String, ElectronicKeyListItem>{ arguments: <String, ElectronicKeyListItem>{
'itemData': indexEntity, 'itemData': indexEntity,
}).then((Object? val) { }).then((Object? val) {
if (val != null) { if (val == 'deletScuess') {
state.itemDataList.removeWhere(
( ElectronicKeyListItem item) =>
item.keyId ==
indexEntity.keyId!);
setState(() {});
} else if (val != null) {
logic logic
.refreshIndividualKeys( .refreshIndividualKeys(
lockId: indexEntity.lockId!, lockId: indexEntity.lockId!,

View File

@ -182,7 +182,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
arguments: <String, ElectronicKeyListItem>{ arguments: <String, ElectronicKeyListItem>{
'itemData': indexEntity, 'itemData': indexEntity,
}).then((Object? val) { }).then((Object? val) {
if (val != null) { if (val == 'deletScuess') {
state.itemDataList.removeWhere(
( ElectronicKeyListItem item) =>
item.keyId ==
indexEntity.keyId!);
setState(() {});
} else if (val != null) {
logic logic
.refreshIndividualKeys( .refreshIndividualKeys(
lockId: indexEntity.lockId!, lockId: indexEntity.lockId!,

View File

@ -20,13 +20,16 @@ import 'package:star_lock/tools/storage.dart';
class SendElectronicKeyViewLogic extends BaseGetXController { class SendElectronicKeyViewLogic extends BaseGetXController {
SendElectronicKeyViewLogic(this.type); SendElectronicKeyViewLogic(this.type);
String type; String type;
final SendElectronicKeyViewState state = SendElectronicKeyViewState(); final SendElectronicKeyViewState state = SendElectronicKeyViewState();
int? keyId; int? keyId;
String? emailOrPhone;
List<dynamic> get weekDayStr { List<dynamic> get weekDayStr {
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList(); return state.weekdaysList
.map((e) => TimeUtils.translateWeekday(e))
.toList();
} }
@override @override
@ -178,6 +181,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
? state.idCardController.text ? state.idCardController.text
: ''); : '');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
emailOrPhone = state.emailOrPhoneController.text;
state.createUser.value = 0; state.createUser.value = 0;
state.isSendSuccess = true; state.isSendSuccess = true;
keyId = entity.data!.keyId; keyId = entity.data!.keyId;
@ -185,6 +189,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
update(); update();
eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(ElectronicKeyListRefreshUI());
} else { } else {
emailOrPhone = null;
if (entity.errorCode == 425) { if (entity.errorCode == 425) {
// //
update(); update();
@ -249,12 +254,12 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
} }
final NoticeTemplateEntity entity = await ApiRepository.to final NoticeTemplateEntity entity = await ApiRepository.to
.getNoticeTemplate( .getNoticeTemplate(
lockId: CommonDataManage().currentKeyInfo.lockId!, lockId: CommonDataManage().currentKeyInfo.lockId!,
keyId: keyId!, keyId: keyId!,
channelType: isPhone ? 1 : 2); channelType: isPhone ? 1 : 2);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
final List<Item?> list = final List<Item?> list =
entity.data!.list!.where((Item item) => item.isUse == 0).toList(); entity.data!.list!.where((Item item) => item.isUse == 0).toList();
if (list.isNotEmpty) { if (list.isNotEmpty) {
final Item item = list.first!; final Item item = list.first!;
final String template = item.template ?? ''; final String template = item.template ?? '';

View File

@ -422,27 +422,27 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
// _openModalBottomSheet(); // _openModalBottomSheet();
// }, // },
// ), // ),
OutLineBtn( if (logic.emailOrPhone != null)
btnName: OutLineBtn(
logic.state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知', btnName: logic.emailOrPhone!.contains('@') ? '邮件通知' : '短信通知',
onClick: () { onClick: () {
if (logic.state.emailOrPhoneController.text.contains('@')) { if (logic.emailOrPhone!.contains('@')) {
Get.toNamed(Routers.sendEmailNotificationPage); Get.toNamed(Routers.sendEmailNotificationPage);
} else { } else {
logic.sendMsg(isPhone: true); logic.sendMsg(isPhone: true);
} }
}, },
), ),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
), ),
OutLineBtn( if (logic.emailOrPhone != null)
btnName: '微信通知', OutLineBtn(
onClick: () { btnName: '微信通知',
logic.sendMsg( onClick: () {
isPhone: logic.state.emailOrPhoneController.text.contains('@')); logic.sendMsg(isPhone: logic.emailOrPhone!.contains('@'));
}, },
), ),
], ],
); );
} }

View File

@ -154,7 +154,7 @@ class FingerprintDetailLogic extends BaseGetXController{
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
showToast('删除成功'.tr, something: (){ showToast('删除成功'.tr, something: (){
Get.back(result: 'addScuess'); Get.back(result: 'deletScuess');
}); });
} }
} }

View File

@ -1,4 +1,3 @@
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';
@ -69,7 +68,8 @@ 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) {
ShowTipView().showIosTipWithContentDialog('重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async { ShowTipView().showIosTipWithContentDialog(
'重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
state.isDeletAll = true; state.isDeletAll = true;
state.deletKeyID = '1'; state.deletKeyID = '1';
state.deletFingerNo = 0; state.deletFingerNo = 0;
@ -161,11 +161,18 @@ class _FingerprintListPageState extends State<FingerprintListPage>
fingerprintItemData.fingerprintName!, fingerprintItemData.fingerprintName!,
logic.getKeyType(fingerprintItemData), logic.getKeyType(fingerprintItemData),
logic.getKeyDateType(fingerprintItemData), () async { logic.getKeyDateType(fingerprintItemData), () async {
final data = await Get.toNamed(Routers.fingerprintDetailPage, final data = await Get.toNamed(
Routers.fingerprintDetailPage,
arguments: <String, FingerprintItemData>{ arguments: <String, FingerprintItemData>{
'fingerprintItemData': fingerprintItemData, 'fingerprintItemData': fingerprintItemData,
}); });
if (data != null) { if (data == 'deletScuess') {
state.fingerprintItemListData.removeWhere(
(FingerprintItemData item) =>
item.fingerprintId ==
fingerprintItemData.fingerprintId!);
setState(() {});
} else if (data != null) {
logic logic
.refreshIndividualKeys( .refreshIndividualKeys(
fingerprintId: fingerprintItemData.fingerprintId!) fingerprintId: fingerprintItemData.fingerprintId!)

View File

@ -509,6 +509,7 @@ class LockSetLogic extends BaseGetXController {
// //
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
_passCurrentLockInformationEvent = eventBus _passCurrentLockInformationEvent = eventBus
@ -567,18 +568,19 @@ class LockSetLogic extends BaseGetXController {
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = ''; BlueManage().connectDeviceMacAddress = '';
final bool isXHJ = F.isXHJ;
final bool isOnlyOneData = state.isOnlyOneData.value == true;
await Future<dynamic>.delayed(const Duration(milliseconds: 200))
.then((e) {
if (isXHJ) {
Get.close(3);
} else {
Get.close(isOnlyOneData ? 1 : 2);
}
});
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
if (state.isOnlyOneData.value == true) {
Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
Get.close(1);
});
} else {
Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
Get.close(2);
});
}
} }
} }
@ -591,12 +593,10 @@ class LockSetLogic extends BaseGetXController {
state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0); state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = ''; BlueManage().connectDeviceMacAddress = '';
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent());
});
final bool isXHJ = F.isXHJ; final bool isXHJ = F.isXHJ;
final bool isOnlyOneData = state.isOnlyOneData.value == true; final bool isOnlyOneData = state.isOnlyOneData.value == true;
Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) { await Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
if (isXHJ) { if (isXHJ) {
Get.close(3); Get.close(3);
} else { } else {
@ -604,6 +604,9 @@ class LockSetLogic extends BaseGetXController {
Get.close(onlyOneDataInt); Get.close(onlyOneDataInt);
} }
}); });
SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent());
});
} }
} }

View File

@ -25,6 +25,7 @@ class PasswordKeyListLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
@ -70,7 +71,8 @@ class PasswordKeyListLogic extends BaseGetXController {
keyID: '0', keyID: '0',
userID: (await Storage.getUid())!, userID: (await Storage.getUid())!,
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0, pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
pwd: state.pwd, //state.deletPWD, pwd: state.pwd,
//state.deletPWD,
operate: state.itemData.isCustom == 1 ? 2 : 3, operate: state.itemData.isCustom == 1 ? 2 : 3,
isAdmin: 0, isAdmin: 0,
useCountLimit: 0xffff, useCountLimit: 0xffff,
@ -157,7 +159,8 @@ class PasswordKeyListLogic extends BaseGetXController {
keyID: '0', keyID: '0',
userID: (await Storage.getUid())!, userID: (await Storage.getUid())!,
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0, pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
pwd: state.pwd, //state.deletPWD, pwd: state.pwd,
//state.deletPWD,
operate: state.itemData.isCustom == 1 ? 2 : 3, operate: state.itemData.isCustom == 1 ? 2 : 3,
isAdmin: 0, isAdmin: 0,
useCountLimit: 0xffff, useCountLimit: 0xffff,
@ -228,28 +231,28 @@ class PasswordKeyListLogic extends BaseGetXController {
} }
/** /**
* // * //
void mockNetworkDataRequest({required bool isRefresh}) async { void mockNetworkDataRequest({required bool isRefresh}) async {
// //
if (isRefresh) { if (isRefresh) {
state.lockLogItemList.clear(); state.lockLogItemList.clear();
pageNo = 1; pageNo = 1;
} }
DoorLockLogEntity entity = await ApiRepository.to.lockEventList( DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
lockId: state.keyInfos.value.lockId!, lockId: state.keyInfos.value.lockId!,
lockEventType: state.dropdownValue.value, lockEventType: state.dropdownValue.value,
pageNo: pageNo, pageNo: pageNo,
pageSize: int.parse(pageSize), pageSize: int.parse(pageSize),
startDate: state.startDate.value, startDate: state.startDate.value,
endDate: state.endDate.value); endDate: state.endDate.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
// //
state.lockLogItemList.addAll(entity.data!.itemList!); state.lockLogItemList.addAll(entity.data!.itemList!);
// //
pageNo++; pageNo++;
} }
} }
*/ */
// //
Future<PasswordKeyListEntity> mockNetworkDataRequest( Future<PasswordKeyListEntity> mockNetworkDataRequest(
@ -396,10 +399,10 @@ class PasswordKeyListLogic extends BaseGetXController {
Future<void> refreshIndividualKeys( Future<void> refreshIndividualKeys(
{required int lockId, required int keyboardPwdId}) async { {required int lockId, required int keyboardPwdId}) async {
final PasswordKeyEntity entity = final PasswordKeyEntity entity =
await ApiRepository.to.passwordKey(lockId, keyboardPwdId); await ApiRepository.to.passwordKey(lockId, keyboardPwdId);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
final int index = state.itemDataList final int index = state.itemDataList.indexWhere(
.indexWhere((PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId); (PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId);
state.itemDataList.removeAt(index); state.itemDataList.removeAt(index);
state.itemDataList.insert(index, entity.data!); state.itemDataList.insert(index, entity.data!);
} }
@ -407,6 +410,7 @@ class PasswordKeyListLogic extends BaseGetXController {
/// ///
StreamSubscription? _getPasswordListRefreshUIEvent; StreamSubscription? _getPasswordListRefreshUIEvent;
void _getPasswordListRefreshUIAction() { void _getPasswordListRefreshUIAction() {
// eventBus // eventBus
_getPasswordListRefreshUIEvent = eventBus _getPasswordListRefreshUIEvent = eventBus

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';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
@ -64,13 +63,15 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () async { onPressed: () async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
if (state.itemDataList.isEmpty) { if (state.itemDataList.isEmpty) {
logic.showToast('暂无密码,无需重置'.tr); logic.showToast('暂无密码,无需重置'.tr);
return; return;
} }
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, logic.getUserInfoRequest); ShowTipView().showIosTipWithContentDialog(
'该锁的密码都将被删除'.tr, logic.getUserInfoRequest);
} else { } else {
logic.showToast('演示模式'.tr); logic.showToast('演示模式'.tr);
} }
@ -105,9 +106,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
btnName: TranslationLoader.lanKeys!.getPassword!.tr, btnName: TranslationLoader.lanKeys!.getPassword!.tr,
onClick: () { onClick: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.passwordKeyPerpetualPage, context, Routers.passwordKeyPerpetualPage,
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfo.value}) arguments: <String, LockListInfoItemEntity>{
.then((Object? val) { 'keyInfo': state.keyInfo.value
}).then((Object? val) {
if (val != null) { if (val != null) {
getHttpData(isRefresh: true); getHttpData(isRefresh: true);
} }
@ -146,7 +148,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
children: <Widget>[ children: <Widget>[
SlidableAction( SlidableAction(
onPressed: (BuildContext context) { onPressed: (BuildContext context) {
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async { ShowTipView().showIosTipWithContentDialog(
'确定要删除吗?'.tr, () async {
state.itemData = passwordKeyListItem; state.itemData = passwordKeyListItem;
state.pwdNo = passwordKeyListItem.pwdUserNo!; state.pwdNo = passwordKeyListItem.pwdUserNo!;
state.pwd = passwordKeyListItem.keyboardPwd!; state.pwd = passwordKeyListItem.keyboardPwd!;
@ -162,10 +165,23 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
), ),
child: _electronicKeyItem(index, 'images/icon_password.png', child: _electronicKeyItem(index, 'images/icon_password.png',
passwordKeyListItem.keyboardPwdName!, useDateStr, () { passwordKeyListItem.keyboardPwdName!, useDateStr, () {
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem}) Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
.then((Object? val) { arguments: <String, PasswordKeyListItem>{
if (val != null) { 'itemData': passwordKeyListItem
// getHttpData(isRefresh: true); }).then((Object? val) {
if (val == 'deletScuess') {
state.itemDataList.removeWhere(
(PasswordKeyListItem item) =>
item.keyboardPwdId ==
passwordKeyListItem.keyboardPwdId!);
setState(() {});
} else if (val != null) {
logic
.refreshIndividualKeys(
lockId: passwordKeyListItem.lockId!,
keyboardPwdId:
passwordKeyListItem.keyboardPwdId!)
.then((dynamic value) => setState(() {}));
} }
}); });
}), }),
@ -181,8 +197,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
)); ));
} }
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) { Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
final PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex]; String lockTypeTitle, String useDateStr, Function()? action) {
final PasswordKeyListItem passwordKeyListItem =
state.itemDataList[itemIndex];
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
@ -223,11 +241,13 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
]), ]),
), ),
SizedBox(width: 10.w), SizedBox(width: 10.w),
if (passwordKeyListItem.keyboardPwdStatus == 2) Text( if (passwordKeyListItem.keyboardPwdStatus == 2)
'已过期'.tr, Text(
style: '已过期'.tr,
TextStyle(color: Colors.red, fontSize: 20.sp), style: TextStyle(color: Colors.red, fontSize: 20.sp),
) else Container(), )
else
Container(),
// SizedBox(width: 15.w) // SizedBox(width: 15.w)
], ],
), ),

View File

@ -230,25 +230,20 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
Widget _xhjLockInfoListItem( Widget _xhjLockInfoListItem(
LockListInfoItemEntity keyInfo, bool isLast, Function() action) { LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
String lockAlias = keyInfo.lockAlias!; final String lockAlias = keyInfo.lockAlias!;
final TextStyle lockAliasTextStyle = TextStyle( final TextStyle lockAliasTextStyle = TextStyle(
fontSize: 24.sp, fontSize: 25.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: keyInfo.passageMode == 1 color: keyInfo.passageMode == 1
? AppColors.openPassageModeColor ? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor, : AppColors.darkGrayTextColor,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
); );
final TextPainter textPainter = TextPainter( final List<String> useKeyTypeListStr = logic.getUseKeyTypeListStr(
text: TextSpan(text: lockAlias, style: lockAliasTextStyle), keyInfo.startDate, keyInfo.endDate, keyInfo.keyType);
maxLines: 1, final bool isThree = useKeyTypeListStr.length == 3;
textDirection: TextDirection.ltr) final bool isOne = useKeyTypeListStr.length == 1;
..layout(minWidth: 0, maxWidth: double.infinity);
final double textSizeWidth = textPainter.size.width; //
if (textSizeWidth > Get.width * .6) {
lockAlias = '${lockAlias.substring(0, 14)}...';
}
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
@ -270,6 +265,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'images/icon_lock_circle.png', 'images/icon_lock_circle.png',
@ -277,50 +273,86 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
height: 48.r, height: 48.r,
color: AppColors.mainColor, color: AppColors.mainColor,
), ),
const Spacer(),
Column(
children: <Widget>[
Row(
children: <Widget>[
Image.asset(
logic.showElectricIcon(keyInfo.electricQuantity!),
width: 30.w,
height: 24.w,
),
SizedBox(width: 2.w),
Text(
'${keyInfo.electricQuantity!}%',
style: TextStyle(
fontSize: 16.sp,
color: AppColors.darkGrayTextColor),
),
],
),
Text(
keyInfo.isLockOwner == 1
? '超级管理员'.tr
: (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr),
style: TextStyle(
fontSize: 16.sp,
color: AppColors.darkGrayTextColor),
)
],
),
], ],
), ),
SizedBox( SizedBox(
height: 10.h, height: 8.h,
), ),
FittedBox( Text(
fit: BoxFit.scaleDown, lockAlias,
child: Text(lockAlias, style: lockAliasTextStyle, maxLines: 1), style: lockAliasTextStyle,
maxLines: 2,
), ),
Visibility( Row(
visible: keyInfo.passageMode == 1, children: <Widget>[
child: Padding( Visibility(
padding: EdgeInsets.only(top: 5.h), visible: keyInfo.passageMode == 1,
child: Row( child: Container(
children: <Widget>[ padding:
Container( EdgeInsets.only(top: 2.h, right: 3.w, left: 3.w,bottom: 1.h),
padding: EdgeInsets.only(right: 5.w, left: 5.w), decoration: BoxDecoration(
decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.w),
borderRadius: BorderRadius.circular(5.w), color: AppColors.openPassageModeColor,
color: AppColors.openPassageModeColor, ),
), child: Text('常开模式开启'.tr,
child: Text('常开模式开启'.tr, style: TextStyle(
fontSize: 18.sp,
color: AppColors.appBarIconColor)),
)),
if (keyInfo.passageMode == 1)
SizedBox(
width: 5.w,
),
Visibility(
visible: keyInfo.lockSetting!.remoteUnlock == 1,
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 2.h, right: 3.w, left: 3.w,bottom: 1.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5.w),
color: AppColors.mainColor,
),
child: Text(
'远程开锁'.tr,
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp, color: Colors.white),
color: AppColors.appBarIconColor)), ),
), ),
], ],
), )),
)), ],
Visibility( ),
visible: keyInfo.lockSetting!.remoteUnlock == 1,
child: Padding(
padding: EdgeInsets.only(top: 5.h),
child: Row(
children: <Widget>[
Text(
'远程开锁'.tr,
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor),
),
],
),
)),
Visibility( Visibility(
visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime || visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
@ -331,7 +363,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
keyInfo.keyStatus == keyInfo.keyStatus ==
XSConstantMacro.keyStatusExpired), XSConstantMacro.keyStatusExpired),
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 20.h), padding: EdgeInsets.only(top: 5.h),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Container( Container(
@ -353,37 +385,40 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
)), )),
SizedBox(height: 5.h), SizedBox(height: 5.h),
Row( if (isThree)
children: <Widget>[ Column(
Expanded( crossAxisAlignment: CrossAxisAlignment.start,
child: Text( children: <Widget>[
keyInfo.isLockOwner == 1 Text(
? '超级管理员'.tr Characters(useKeyTypeListStr[0]).join('\u{200B}'),
: (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr),
style: TextStyle( style: TextStyle(
fontSize: 16.sp, color: AppColors.darkGrayTextColor), fontSize: 16.sp, color: AppColors.darkGrayTextColor),
), ),
), Row(
Image.asset( children: <Widget>[
logic.showElectricIcon(keyInfo.electricQuantity!), Text(
width: 30.w, Characters(useKeyTypeListStr[1]).join('\u{200B}'),
height: 24.w, style: TextStyle(
), fontSize: 16.sp,
SizedBox(width: 2.w), color: AppColors.darkGrayTextColor),
Text( ),
'${keyInfo.electricQuantity!}%', SizedBox(width: 5.w),
style: TextStyle( Text(
fontSize: 16.sp, color: AppColors.darkGrayTextColor), useKeyTypeListStr[2],
), style: TextStyle(
], fontSize: 16.sp,
), color: AppColors.darkGrayTextColor),
Text( ),
Characters(logic.getUseKeyTypeStr( ],
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)) ),
.join('\u{200B}'), ],
style: TextStyle( )
fontSize: 16.sp, color: AppColors.darkGrayTextColor), else if (isOne)
) Text(
useKeyTypeListStr[0],
style: TextStyle(
fontSize: 16.sp, color: AppColors.darkGrayTextColor),
),
], ],
), ),
), ),

View File

@ -1,4 +1,5 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:star_lock/flavors.dart';
import '../app_settings/app_settings.dart'; import '../app_settings/app_settings.dart';
@ -19,8 +20,9 @@ class NativeInteractionTool {
/// ///
void loadNativeShare({required String shareText}) { void loadNativeShare({required String shareText}) {
final String urlToShare = '${F.apiPrefix}/apps';
sendChannel.invokeMethod( sendChannel.invokeMethod(
'loadNativeShare', <String, String>{'shareText': shareText}); 'loadNativeShare', <String, String>{'shareText': shareText,'urlToShare':urlToShare});
} }
/// ///

View File

@ -21,7 +21,7 @@ class BaseGetXController extends GetxController {
bool currentPage = true; bool currentPage = true;
var pageNo = 1; var pageNo = 1;
var pageSize = "20"; var pageSize = '20';
@override @override
void onReady() { void onReady() {
@ -93,7 +93,7 @@ class BaseGetXController extends GetxController {
} }
void showBlueConnetctToast() { void showBlueConnetctToast() {
bool isContains = BlueManage().connectDeviceName.contains("T9A"); bool isContains = BlueManage().connectDeviceName.contains('T9A');
showToast( showToast(
"${'操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。'.tr}${isContains == true ? "如果是全自动锁,请使屏幕变亮" : ""}"); "${'操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。'.tr}${isContains == true ? "如果是全自动锁,请使屏幕变亮" : ""}");
} }
@ -123,10 +123,10 @@ class BaseGetXController extends GetxController {
} }
void showOperationSuccessful({String? status, Function? something}) => void showOperationSuccessful({String? status, Function? something}) =>
showSuccess(status ?? "成功", something: something); showSuccess(status ?? '成功', something: something);
void showOperationFailed({String? status, Function? something}) => void showOperationFailed({String? status, Function? something}) =>
showError(status ?? "失败", something: something); showError(status ?? '失败', something: something);
void logOff() async { void logOff() async {
await ClientManager().logOff(); await ClientManager().logOff();
@ -136,11 +136,11 @@ class BaseGetXController extends GetxController {
void checkBlueIsOpen(void Function() action) { void checkBlueIsOpen(void Function() action) {
NativeInteractionTool().sendGetBlueStatus(); NativeInteractionTool().sendGetBlueStatus();
NativeInteractionTool().receiveChannelBlueIsOnEvent((String status) { NativeInteractionTool().receiveChannelBlueIsOnEvent((String status) {
if (status == "1") { if (status == '1') {
// //
AppLog.log('蓝牙已打开'); AppLog.log('蓝牙已打开');
action(); action();
} else if (status == "0") { } else if (status == '0') {
// //
AppLog.log('蓝牙未打开'); AppLog.log('蓝牙未打开');
showIosTipViewDialog(); showIosTipViewDialog();
@ -148,7 +148,7 @@ class BaseGetXController extends GetxController {
} else { } else {
// //
AppLog.log('设备不支持蓝牙'); AppLog.log('设备不支持蓝牙');
showToast("设备不支持蓝牙"); showToast('设备不支持蓝牙');
return; return;
} }
}); });
@ -159,8 +159,8 @@ class BaseGetXController extends GetxController {
context: Get.context!, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowIosTipView( return ShowIosTipView(
title: "提示", title: '提示',
tipTitle: "蓝牙未打开,请到设置里面打开蓝牙", tipTitle: '蓝牙未打开,请到设置里面打开蓝牙',
sureClick: () { sureClick: () {
Get.back(); Get.back();
if (Platform.isIOS) { if (Platform.isIOS) {
@ -184,23 +184,45 @@ class BaseGetXController extends GetxController {
"${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} ${"限时".tr}"; "${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} ${"限时".tr}";
} else if (keyType == XSConstantMacro.keyTypeLong) { } else if (keyType == XSConstantMacro.keyTypeLong) {
// //
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
useDateStr = '永久'.tr; useDateStr = '永久'.tr;
} else if (keyType == XSConstantMacro.keyTypeOnce) { } else if (keyType == XSConstantMacro.keyTypeOnce) {
// //
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
useDateStr = '单次'.tr; useDateStr = '单次'.tr;
} else if (keyType == XSConstantMacro.keyTypeLoop) { } else if (keyType == XSConstantMacro.keyTypeLoop) {
// //
useDateStr = useDateStr =
"${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} ${"循环".tr}"; "${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} ${"循环".tr}";
} }
return useDateStr; return useDateStr;
} }
List<String> getUseKeyTypeListStr(
int? startDate, int? endDate, int? keyType) {
final List<String> useDateListStr = <String>[];
if (keyType == XSConstantMacro.keyTypeTime) {
//
useDateListStr.addAll(<String>[
DateTool().dateToYMDHNString(startDate.toString()),
DateTool().dateToYMDHNString(endDate.toString()),
'限时'.tr,
]);
} else if (keyType == XSConstantMacro.keyTypeLong) {
//
useDateListStr.add('永久'.tr);
} else if (keyType == XSConstantMacro.keyTypeOnce) {
//
useDateListStr.add('单次'.tr);
} else if (keyType == XSConstantMacro.keyTypeLoop) {
//
useDateListStr.addAll(<String>[
DateTool().dateToYMDString(startDate.toString()),
DateTool().dateToYMDString(endDate.toString()),
'循环'.tr,
]);
}
return useDateListStr;
}
static List splitList(List list, int len) { static List splitList(List list, int len) {
if (len <= 1) { if (len <= 1) {
return [list]; return [list];

View File

@ -62,9 +62,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.53+2024052803xhj 线上环境,提审 sky 线上环境提审 # 1.0.53+2024052803xhj 线上环境,提审 sky 线上环境提审
# 1.0.53+2024052804xhj 线上环境,提审 修改鑫锁名字为星星锁 # 1.0.53+2024052804xhj 线上环境,提审 修改鑫锁名字为星星锁
# 1.0.54+2024053001xhj 线上环境,对外发布,提交测试 # 1.0.54+2024053001xhj 线上环境,对外发布,提交测试
# 1.0.56+202406401xhj 线上环境,对外发布,提交测试 # 1.0.56+2024060401xhj 线上环境,对外发布,提交测试
version: 1.0.56+202406401 version: 1.0.56+2024060401
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'