Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release
This commit is contained in:
commit
efd475394d
@ -10,14 +10,14 @@ import io.flutter.embedding.engine.FlutterEngine;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
class MainActivity : FlutterActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
GeneratedPluginRegistrant.registerWith(flutterEngine!!)
|
||||
MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
|
||||
if (call.method == "loadNativeShare") {
|
||||
var map = call.arguments as Map<String, String>
|
||||
shareText(map["shareText"], "分享")
|
||||
shareText(map["shareText"] , "分享")
|
||||
} else if (call.method == "sendGetBlueStatus") {
|
||||
// 蓝牙是否开启
|
||||
// println("收到原生的信息了 methodmethodmethod: ${call.method}")
|
||||
@ -58,8 +58,7 @@ class MainActivity: FlutterActivity() {
|
||||
|
||||
override fun configureFlutterEngine(flutterEngine: 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") {
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
@property(nonatomic,strong) FlutterMethodChannel* methodChannel;
|
||||
@property (nonatomic, copy) NSString *textToShare;
|
||||
@property (nonatomic, copy) NSString *urlToShare;
|
||||
|
||||
@end
|
||||
|
||||
@ -24,7 +25,8 @@
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
self.textToShare = [[NSString alloc] init];
|
||||
|
||||
self.textToShare = [[NSString alloc] init];
|
||||
|
||||
[self methodChannelFunction];
|
||||
}
|
||||
- (void)methodChannelFunction {
|
||||
@ -44,10 +46,12 @@
|
||||
NSDictionary *paramDic = (NSDictionary *)params;
|
||||
//分享的标题
|
||||
self.textToShare = paramDic[@"shareText"];
|
||||
self.urlToShare = paramDic[@"urlToShare"];
|
||||
}
|
||||
//分享的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];
|
||||
|
||||
|
||||
@ -151,7 +151,13 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
|
||||
arguments: <String, ElectronicKeyListItem>{
|
||||
'itemData': indexEntity,
|
||||
}).then((Object? val) {
|
||||
if (val != null) {
|
||||
if (val == 'deletScuess') {
|
||||
state.itemDataList.removeWhere(
|
||||
( ElectronicKeyListItem item) =>
|
||||
item.keyId ==
|
||||
indexEntity.keyId!);
|
||||
setState(() {});
|
||||
} else if (val != null) {
|
||||
logic
|
||||
.refreshIndividualKeys(
|
||||
lockId: indexEntity.lockId!,
|
||||
|
||||
@ -182,7 +182,13 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
|
||||
arguments: <String, ElectronicKeyListItem>{
|
||||
'itemData': indexEntity,
|
||||
}).then((Object? val) {
|
||||
if (val != null) {
|
||||
if (val == 'deletScuess') {
|
||||
state.itemDataList.removeWhere(
|
||||
( ElectronicKeyListItem item) =>
|
||||
item.keyId ==
|
||||
indexEntity.keyId!);
|
||||
setState(() {});
|
||||
} else if (val != null) {
|
||||
logic
|
||||
.refreshIndividualKeys(
|
||||
lockId: indexEntity.lockId!,
|
||||
|
||||
@ -20,13 +20,16 @@ import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
SendElectronicKeyViewLogic(this.type);
|
||||
|
||||
String type;
|
||||
final SendElectronicKeyViewState state = SendElectronicKeyViewState();
|
||||
int? keyId;
|
||||
|
||||
String? emailOrPhone;
|
||||
|
||||
List<dynamic> get weekDayStr {
|
||||
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList();
|
||||
return state.weekdaysList
|
||||
.map((e) => TimeUtils.translateWeekday(e))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -178,6 +181,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
? state.idCardController.text
|
||||
: '');
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
emailOrPhone = state.emailOrPhoneController.text;
|
||||
state.createUser.value = 0;
|
||||
state.isSendSuccess = true;
|
||||
keyId = entity.data!.keyId;
|
||||
@ -185,6 +189,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
update();
|
||||
eventBus.fire(ElectronicKeyListRefreshUI());
|
||||
} else {
|
||||
emailOrPhone = null;
|
||||
if (entity.errorCode == 425) {
|
||||
//用户未注册
|
||||
update();
|
||||
@ -249,12 +254,12 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
}
|
||||
final NoticeTemplateEntity entity = await ApiRepository.to
|
||||
.getNoticeTemplate(
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!,
|
||||
keyId: keyId!,
|
||||
channelType: isPhone ? 1 : 2);
|
||||
lockId: CommonDataManage().currentKeyInfo.lockId!,
|
||||
keyId: keyId!,
|
||||
channelType: isPhone ? 1 : 2);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
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) {
|
||||
final Item item = list.first!;
|
||||
final String template = item.template ?? '';
|
||||
|
||||
@ -422,27 +422,27 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
|
||||
// _openModalBottomSheet();
|
||||
// },
|
||||
// ),
|
||||
OutLineBtn(
|
||||
btnName:
|
||||
logic.state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知',
|
||||
onClick: () {
|
||||
if (logic.state.emailOrPhoneController.text.contains('@')) {
|
||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||
} else {
|
||||
logic.sendMsg(isPhone: true);
|
||||
}
|
||||
},
|
||||
),
|
||||
if (logic.emailOrPhone != null)
|
||||
OutLineBtn(
|
||||
btnName: logic.emailOrPhone!.contains('@') ? '邮件通知' : '短信通知',
|
||||
onClick: () {
|
||||
if (logic.emailOrPhone!.contains('@')) {
|
||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||
} else {
|
||||
logic.sendMsg(isPhone: true);
|
||||
}
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
OutLineBtn(
|
||||
btnName: '微信通知',
|
||||
onClick: () {
|
||||
logic.sendMsg(
|
||||
isPhone: logic.state.emailOrPhoneController.text.contains('@'));
|
||||
},
|
||||
),
|
||||
if (logic.emailOrPhone != null)
|
||||
OutLineBtn(
|
||||
btnName: '微信通知',
|
||||
onClick: () {
|
||||
logic.sendMsg(isPhone: logic.emailOrPhone!.contains('@'));
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ class FingerprintDetailLogic extends BaseGetXController{
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
showToast('删除成功'.tr, something: (){
|
||||
Get.back(result: 'addScuess');
|
||||
Get.back(result: 'deletScuess');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -69,7 +68,8 @@ class _FingerprintListPageState extends State<FingerprintListPage>
|
||||
onPressed: () async {
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
ShowTipView().showIosTipWithContentDialog('重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
|
||||
state.isDeletAll = true;
|
||||
state.deletKeyID = '1';
|
||||
state.deletFingerNo = 0;
|
||||
@ -161,11 +161,18 @@ class _FingerprintListPageState extends State<FingerprintListPage>
|
||||
fingerprintItemData.fingerprintName!,
|
||||
logic.getKeyType(fingerprintItemData),
|
||||
logic.getKeyDateType(fingerprintItemData), () async {
|
||||
final data = await Get.toNamed(Routers.fingerprintDetailPage,
|
||||
final data = await Get.toNamed(
|
||||
Routers.fingerprintDetailPage,
|
||||
arguments: <String, FingerprintItemData>{
|
||||
'fingerprintItemData': fingerprintItemData,
|
||||
});
|
||||
if (data != null) {
|
||||
if (data == 'deletScuess') {
|
||||
state.fingerprintItemListData.removeWhere(
|
||||
(FingerprintItemData item) =>
|
||||
item.fingerprintId ==
|
||||
fingerprintItemData.fingerprintId!);
|
||||
setState(() {});
|
||||
} else if (data != null) {
|
||||
logic
|
||||
.refreshIndividualKeys(
|
||||
fingerprintId: fingerprintItemData.fingerprintId!)
|
||||
|
||||
@ -509,6 +509,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 下级界面修改成功后传递数据
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent = eventBus
|
||||
@ -567,18 +568,19 @@ class LockSetLogic extends BaseGetXController {
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
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((_) {
|
||||
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);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
BlueManage().connectDeviceMacAddress = '';
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
|
||||
final bool isXHJ = F.isXHJ;
|
||||
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) {
|
||||
Get.close(3);
|
||||
} else {
|
||||
@ -604,6 +604,9 @@ class LockSetLogic extends BaseGetXController {
|
||||
Get.close(onlyOneDataInt);
|
||||
}
|
||||
});
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
|
||||
@ -70,7 +71,8 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
keyID: '0',
|
||||
userID: (await Storage.getUid())!,
|
||||
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,
|
||||
isAdmin: 0,
|
||||
useCountLimit: 0xffff,
|
||||
@ -157,7 +159,8 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
keyID: '0',
|
||||
userID: (await Storage.getUid())!,
|
||||
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,
|
||||
isAdmin: 0,
|
||||
useCountLimit: 0xffff,
|
||||
@ -228,28 +231,28 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
/**
|
||||
* //请求操作记录列表(门锁日志)
|
||||
void mockNetworkDataRequest({required bool isRefresh}) async {
|
||||
// 如果是下拉刷新,清空已有数据
|
||||
if (isRefresh) {
|
||||
* //请求操作记录列表(门锁日志)
|
||||
void mockNetworkDataRequest({required bool isRefresh}) async {
|
||||
// 如果是下拉刷新,清空已有数据
|
||||
if (isRefresh) {
|
||||
state.lockLogItemList.clear();
|
||||
pageNo = 1;
|
||||
}
|
||||
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||
lockId: state.keyInfos.value.lockId!,
|
||||
lockEventType: state.dropdownValue.value,
|
||||
pageNo: pageNo,
|
||||
pageSize: int.parse(pageSize),
|
||||
startDate: state.startDate.value,
|
||||
endDate: state.endDate.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
}
|
||||
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||
lockId: state.keyInfos.value.lockId!,
|
||||
lockEventType: state.dropdownValue.value,
|
||||
pageNo: pageNo,
|
||||
pageSize: int.parse(pageSize),
|
||||
startDate: state.startDate.value,
|
||||
endDate: state.endDate.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// 更新数据列表
|
||||
state.lockLogItemList.addAll(entity.data!.itemList!);
|
||||
// 更新页码
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//请求密码钥匙列表
|
||||
Future<PasswordKeyListEntity> mockNetworkDataRequest(
|
||||
@ -396,10 +399,10 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
Future<void> refreshIndividualKeys(
|
||||
{required int lockId, required int keyboardPwdId}) async {
|
||||
final PasswordKeyEntity entity =
|
||||
await ApiRepository.to.passwordKey(lockId, keyboardPwdId);
|
||||
await ApiRepository.to.passwordKey(lockId, keyboardPwdId);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
final int index = state.itemDataList
|
||||
.indexWhere((PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId);
|
||||
final int index = state.itemDataList.indexWhere(
|
||||
(PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId);
|
||||
state.itemDataList.removeAt(index);
|
||||
state.itemDataList.insert(index, entity.data!);
|
||||
}
|
||||
@ -407,6 +410,7 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
|
||||
/// 刷新密码列表
|
||||
StreamSubscription? _getPasswordListRefreshUIEvent;
|
||||
|
||||
void _getPasswordListRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getPasswordListRefreshUIEvent = eventBus
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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),
|
||||
),
|
||||
onPressed: () async {
|
||||
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
final bool? isDemoMode =
|
||||
await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
if (state.itemDataList.isEmpty) {
|
||||
logic.showToast('暂无密码,无需重置'.tr);
|
||||
return;
|
||||
}
|
||||
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, logic.getUserInfoRequest);
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'该锁的密码都将被删除'.tr, logic.getUserInfoRequest);
|
||||
} else {
|
||||
logic.showToast('演示模式'.tr);
|
||||
}
|
||||
@ -105,9 +106,10 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.passwordKeyPerpetualPage,
|
||||
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfo.value})
|
||||
.then((Object? val) {
|
||||
context, Routers.passwordKeyPerpetualPage,
|
||||
arguments: <String, LockListInfoItemEntity>{
|
||||
'keyInfo': state.keyInfo.value
|
||||
}).then((Object? val) {
|
||||
if (val != null) {
|
||||
getHttpData(isRefresh: true);
|
||||
}
|
||||
@ -146,7 +148,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
children: <Widget>[
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context) {
|
||||
ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () async {
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'确定要删除吗?'.tr, () async {
|
||||
state.itemData = passwordKeyListItem;
|
||||
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
||||
state.pwd = passwordKeyListItem.keyboardPwd!;
|
||||
@ -162,10 +165,23 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
),
|
||||
child: _electronicKeyItem(index, 'images/icon_password.png',
|
||||
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem})
|
||||
.then((Object? val) {
|
||||
if (val != null) {
|
||||
// getHttpData(isRefresh: true);
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||
arguments: <String, PasswordKeyListItem>{
|
||||
'itemData': passwordKeyListItem
|
||||
}).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) {
|
||||
final PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
||||
String lockTypeTitle, String useDateStr, Function()? action) {
|
||||
final PasswordKeyListItem passwordKeyListItem =
|
||||
state.itemDataList[itemIndex];
|
||||
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
@ -223,11 +241,13 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
]),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
if (passwordKeyListItem.keyboardPwdStatus == 2) Text(
|
||||
'已过期'.tr,
|
||||
style:
|
||||
TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||
) else Container(),
|
||||
if (passwordKeyListItem.keyboardPwdStatus == 2)
|
||||
Text(
|
||||
'已过期'.tr,
|
||||
style: TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||
)
|
||||
else
|
||||
Container(),
|
||||
// SizedBox(width: 15.w)
|
||||
],
|
||||
),
|
||||
|
||||
@ -230,25 +230,20 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
|
||||
Widget _xhjLockInfoListItem(
|
||||
LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
|
||||
String lockAlias = keyInfo.lockAlias!;
|
||||
final String lockAlias = keyInfo.lockAlias!;
|
||||
final TextStyle lockAliasTextStyle = TextStyle(
|
||||
fontSize: 24.sp,
|
||||
fontSize: 25.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: keyInfo.passageMode == 1
|
||||
? AppColors.openPassageModeColor
|
||||
: AppColors.darkGrayTextColor,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
final TextPainter textPainter = TextPainter(
|
||||
text: TextSpan(text: lockAlias, style: lockAliasTextStyle),
|
||||
maxLines: 1,
|
||||
textDirection: TextDirection.ltr)
|
||||
..layout(minWidth: 0, maxWidth: double.infinity);
|
||||
final List<String> useKeyTypeListStr = logic.getUseKeyTypeListStr(
|
||||
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType);
|
||||
final bool isThree = useKeyTypeListStr.length == 3;
|
||||
final bool isOne = useKeyTypeListStr.length == 1;
|
||||
|
||||
final double textSizeWidth = textPainter.size.width; // 获取文本的尺寸
|
||||
if (textSizeWidth > Get.width * .6) {
|
||||
lockAlias = '${lockAlias.substring(0, 14)}...';
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
@ -270,6 +265,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'images/icon_lock_circle.png',
|
||||
@ -277,50 +273,86 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
height: 48.r,
|
||||
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(
|
||||
height: 10.h,
|
||||
height: 8.h,
|
||||
),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(lockAlias, style: lockAliasTextStyle, maxLines: 1),
|
||||
Text(
|
||||
lockAlias,
|
||||
style: lockAliasTextStyle,
|
||||
maxLines: 2,
|
||||
),
|
||||
Visibility(
|
||||
visible: keyInfo.passageMode == 1,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 5.h),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: AppColors.openPassageModeColor,
|
||||
),
|
||||
child: Text('常开模式开启'.tr,
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Visibility(
|
||||
visible: keyInfo.passageMode == 1,
|
||||
child: 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.openPassageModeColor,
|
||||
),
|
||||
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(
|
||||
fontSize: 18.sp,
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
fontSize: 18.sp, color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
Visibility(
|
||||
visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
@ -331,7 +363,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusExpired),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 20.h),
|
||||
padding: EdgeInsets.only(top: 5.h),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
@ -353,37 +385,40 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
),
|
||||
)),
|
||||
SizedBox(height: 5.h),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
keyInfo.isLockOwner == 1
|
||||
? '超级管理员'.tr
|
||||
: (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr),
|
||||
if (isThree)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
Characters(useKeyTypeListStr[0]).join('\u{200B}'),
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
),
|
||||
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(
|
||||
Characters(logic.getUseKeyTypeStr(
|
||||
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType))
|
||||
.join('\u{200B}'),
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp, color: AppColors.darkGrayTextColor),
|
||||
)
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
Characters(useKeyTypeListStr[1]).join('\u{200B}'),
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(width: 5.w),
|
||||
Text(
|
||||
useKeyTypeListStr[2],
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
else if (isOne)
|
||||
Text(
|
||||
useKeyTypeListStr[0],
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
|
||||
import '../app_settings/app_settings.dart';
|
||||
|
||||
@ -19,8 +20,9 @@ class NativeInteractionTool {
|
||||
|
||||
///加载原生分享
|
||||
void loadNativeShare({required String shareText}) {
|
||||
final String urlToShare = '${F.apiPrefix}/apps';
|
||||
sendChannel.invokeMethod(
|
||||
'loadNativeShare', <String, String>{'shareText': shareText});
|
||||
'loadNativeShare', <String, String>{'shareText': shareText,'urlToShare':urlToShare});
|
||||
}
|
||||
|
||||
///获取设备蓝牙状态
|
||||
|
||||
@ -21,7 +21,7 @@ class BaseGetXController extends GetxController {
|
||||
|
||||
bool currentPage = true;
|
||||
var pageNo = 1;
|
||||
var pageSize = "20";
|
||||
var pageSize = '20';
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
@ -93,7 +93,7 @@ class BaseGetXController extends GetxController {
|
||||
}
|
||||
|
||||
void showBlueConnetctToast() {
|
||||
bool isContains = BlueManage().connectDeviceName.contains("T9A");
|
||||
bool isContains = BlueManage().connectDeviceName.contains('T9A');
|
||||
showToast(
|
||||
"${'操作失败,请确认锁是否在附近,或重启手机蓝牙后再试。'.tr}${isContains == true ? "如果是全自动锁,请使屏幕变亮" : ""}");
|
||||
}
|
||||
@ -123,10 +123,10 @@ class BaseGetXController extends GetxController {
|
||||
}
|
||||
|
||||
void showOperationSuccessful({String? status, Function? something}) =>
|
||||
showSuccess(status ?? "成功", something: something);
|
||||
showSuccess(status ?? '成功', something: something);
|
||||
|
||||
void showOperationFailed({String? status, Function? something}) =>
|
||||
showError(status ?? "失败", something: something);
|
||||
showError(status ?? '失败', something: something);
|
||||
|
||||
void logOff() async {
|
||||
await ClientManager().logOff();
|
||||
@ -136,11 +136,11 @@ class BaseGetXController extends GetxController {
|
||||
void checkBlueIsOpen(void Function() action) {
|
||||
NativeInteractionTool().sendGetBlueStatus();
|
||||
NativeInteractionTool().receiveChannelBlueIsOnEvent((String status) {
|
||||
if (status == "1") {
|
||||
if (status == '1') {
|
||||
// 蓝牙已打开
|
||||
AppLog.log('蓝牙已打开');
|
||||
action();
|
||||
} else if (status == "0") {
|
||||
} else if (status == '0') {
|
||||
// 蓝牙未打开
|
||||
AppLog.log('蓝牙未打开');
|
||||
showIosTipViewDialog();
|
||||
@ -148,7 +148,7 @@ class BaseGetXController extends GetxController {
|
||||
} else {
|
||||
// 蓝牙未打开
|
||||
AppLog.log('设备不支持蓝牙');
|
||||
showToast("设备不支持蓝牙");
|
||||
showToast('设备不支持蓝牙');
|
||||
return;
|
||||
}
|
||||
});
|
||||
@ -159,8 +159,8 @@ class BaseGetXController extends GetxController {
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "蓝牙未打开,请到设置里面打开蓝牙",
|
||||
title: '提示',
|
||||
tipTitle: '蓝牙未打开,请到设置里面打开蓝牙',
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
if (Platform.isIOS) {
|
||||
@ -184,23 +184,45 @@ class BaseGetXController extends GetxController {
|
||||
"${DateTool().dateToYMDHNString(startDate.toString())}-${DateTool().dateToYMDHNString(endDate.toString())} ${"限时".tr}";
|
||||
} else if (keyType == XSConstantMacro.keyTypeLong) {
|
||||
//永久
|
||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)}\n永久';
|
||||
useDateStr = '永久'.tr;
|
||||
} else if (keyType == XSConstantMacro.keyTypeOnce) {
|
||||
//单次
|
||||
// DateTime dateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.date!);
|
||||
// useDateStr = '${dateStr.toLocal().toString().substring(0, 16)} \n单次';
|
||||
useDateStr = '单次'.tr;
|
||||
} else if (keyType == XSConstantMacro.keyTypeLoop) {
|
||||
//循环
|
||||
useDateStr =
|
||||
"${DateTool().dateToYMDString(startDate.toString())}-${DateTool().dateToYMDString(endDate.toString())} ${"循环".tr}";
|
||||
}
|
||||
|
||||
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) {
|
||||
if (len <= 1) {
|
||||
return [list];
|
||||
|
||||
@ -62,9 +62,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.53+2024052803:xhj 线上环境,提审 sky 线上环境提审
|
||||
# 1.0.53+2024052804:xhj 线上环境,提审 修改鑫锁名字为星星锁
|
||||
# 1.0.54+2024053001:xhj 线上环境,对外发布,提交测试
|
||||
# 1.0.56+202406401:xhj 线上环境,对外发布,提交测试
|
||||
# 1.0.56+2024060401:xhj 线上环境,对外发布,提交测试
|
||||
|
||||
version: 1.0.56+202406401
|
||||
version: 1.0.56+2024060401
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user