fix: 调整蓝牙开锁时出现重复响应,增加防抖处理。调整动画控制器在初始化之前进行赋值

This commit is contained in:
liyi 2025-09-25 18:23:35 +08:00
parent 8fd0a5243e
commit 8a5de7d442
3 changed files with 141 additions and 264 deletions

View File

@ -131,12 +131,12 @@ jobs:
echo "🔍 Getting version info from basic-setup job..."
# 设置默认版本号,如果环境变量为空
if [ -z "$NEXT_VERSION" ]; then
if [ -z "${{ needs.basic-setup.outputs.NEXT_VERSION }}" ]; then
VERSION_FOR_FILENAME="1-0-0"
echo "⚠️ Version not found, using default: $VERSION_FOR_FILENAME"
else
# 格式化版本号用于文件名
VERSION_FOR_FILENAME=$(echo "$NEXT_VERSION" | sed 's/v//g' | sed 's/\./-/g')
VERSION_FOR_FILENAME=$(echo "${{ needs.basic-setup.outputs.NEXT_VERSION }}" | sed 's/v//g' | sed 's/\./-/g')
echo "✅ Version found: $VERSION_FOR_FILENAME"
fi
@ -165,12 +165,12 @@ jobs:
echo "🔍 Getting version info from basic-setup job..."
# 设置默认版本号,如果环境变量为空
if [ -z "$NEXT_VERSION" ]; then
if [ -z "${{ needs.basic-setup.outputs.NEXT_VERSION }}" ]; then
VERSION_FOR_FILENAME="1-0-0"
echo "⚠️ Version not found, using default: $VERSION_FOR_FILENAME"
else
# 格式化版本号用于文件名
VERSION_FOR_FILENAME=$(echo "$NEXT_VERSION" | sed 's/v//g' | sed 's/\./-/g')
VERSION_FOR_FILENAME=$(echo "${{ needs.basic-setup.outputs.NEXT_VERSION }}" | sed 's/v//g' | sed 's/\./-/g')
echo "✅ Version found: $VERSION_FOR_FILENAME"
fi
@ -200,12 +200,12 @@ jobs:
echo "🔍 Getting version info from basic-setup job..."
# 设置默认版本号,如果环境变量为空
if [ -z "$NEXT_VERSION" ]; then
if [ -z "${{ needs.basic-setup.outputs.NEXT_VERSION }}" ]; then
VERSION_FOR_FILENAME="1-0-0"
echo "⚠️ Version not found, using default: $VERSION_FOR_FILENAME"
else
# 格式化版本号用于文件名
VERSION_FOR_FILENAME=$(echo "$NEXT_VERSION" | sed 's/v//g' | sed 's/\./-/g')
VERSION_FOR_FILENAME=$(echo "${{ needs.basic-setup.outputs.NEXT_VERSION }}" | sed 's/v//g' | sed 's/\./-/g')
echo "✅ Version found: $VERSION_FOR_FILENAME"
fi
@ -217,7 +217,7 @@ jobs:
echo "🔧 Configuring iOS automatic code signing for CI environment..."
# 构建iOS IPA使用自动签名模式
flutter build ipa --no-tree-shake-icons --release --flavor sky -t lib/main_sky_full.dart --build-number=$BUILD_NUMBER --build-name="sky-star-lock-release-$VERSION_FOR_FILENAME.ipa" --codesign="auto"
flutter build ipa --no-tree-shake-icons --release --flavor sky -t lib/main_sky_full.dart --build-number=$BUILD_NUMBER --build-name="sky-star-lock-release-$VERSION_FOR_FILENAME.ipa" --codesign
# 重命名IPA文件
mv build/ios/ipa/*.ipa "$IPA_FILENAME"
@ -247,5 +247,5 @@ jobs:
echo " ✅ IPA: sky-star-lock-release-*.ipa"
fi
echo ""
echo "🏷️ Version: $NEXT_VERSION"
echo "🏷️ Version: ${{ needs.basic-setup.outputs.NEXT_VERSION }}"
echo "📁 Files available in artifacts section"

View File

@ -54,12 +54,27 @@ class LockDetailLogic extends BaseGetXController {
//
FunctionBlocker functionBlocker = FunctionBlocker(duration: const Duration(seconds: 2));
// Timer
Timer? _openDoorReplyDebounceTimer;
//
void _handleOpenDoorReplyWithDebounce(Reply reply) {
// Timer
_openDoorReplyDebounceTimer?.cancel();
// Timer200ms后执行
_openDoorReplyDebounceTimer = Timer(const Duration(milliseconds: 300), () {
_replyOpenLock(reply);
});
}
//
void initReplySubscription() {
state.replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
//
if (reply is OpenDoorReply) {
_replyOpenLock(reply);
_handleOpenDoorReplyWithDebounce(reply);
}
//

View File

@ -34,11 +34,7 @@ import '../../lockMian/entity/lockListInfo_entity.dart';
import 'lockDetail_logic.dart';
class LockDetailPage extends StatefulWidget {
const LockDetailPage(
{required this.isOnlyOneData,
required this.lockListInfoItemEntity,
Key? key})
: super(key: key);
const LockDetailPage({required this.isOnlyOneData, required this.lockListInfoItemEntity, Key? key}) : super(key: key);
final bool isOnlyOneData;
final LockListInfoItemEntity lockListInfoItemEntity;
@ -46,18 +42,14 @@ class LockDetailPage extends StatefulWidget {
State<LockDetailPage> createState() => _LockDetailPageState();
}
class _LockDetailPageState extends State<LockDetailPage>
with TickerProviderStateMixin, RouteAware {
class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStateMixin, RouteAware {
// with RouteAware
final LockDetailLogic logic = Get.put(LockDetailLogic());
final LockDetailState state = Get.find<LockDetailLogic>().state;
@override
void initState() {
super.initState();
state.animationController =
AnimationController(duration: const Duration(seconds: 1), vsync: this);
state.animationController = AnimationController(duration: const Duration(seconds: 1), vsync: this);
state.animationController!.repeat();
//StatusListener
state.animationController!.addStatusListener((AnimationStatus status) {
@ -69,6 +61,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.animationController!.forward();
}
});
super.initState();
state.pageController.addListener(() {
state.currentPage.value = state.pageController.page!.round();
@ -77,9 +70,7 @@ class _LockDetailPageState extends State<LockDetailPage>
_initRefreshLockDetailInfoDataEventAction();
logic.initReplySubscription();
logic.initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
logic.loadData(
lockListInfoItemEntity: widget.lockListInfoItemEntity,
isOnlyOneData: widget.isOnlyOneData);
logic.loadData(lockListInfoItemEntity: widget.lockListInfoItemEntity, isOnlyOneData: widget.isOnlyOneData);
}
@override
@ -95,9 +86,8 @@ class _LockDetailPageState extends State<LockDetailPage>
void _initRefreshLockDetailInfoDataEventAction() {
// eventBus
_lockRefreshLockDetailInfoDataEvent = eventBus
.on<RefreshLockDetailInfoDataEvent>()
.listen((RefreshLockDetailInfoDataEvent event) {
_lockRefreshLockDetailInfoDataEvent =
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((RefreshLockDetailInfoDataEvent event) {
setState(() {});
});
}
@ -109,17 +99,12 @@ class _LockDetailPageState extends State<LockDetailPage>
//
Widget xhjWidget() {
final bool isShowTip = (state.keyInfos.value.keyType ==
XSConstantMacro.keyTypeTime ||
final bool isShowTip = (state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) &&
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <=
15 &&
DateTool()
.compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >=
0) &&
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 &&
DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) &&
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse ||
state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitReceive);
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive);
return Scaffold(
backgroundColor: Colors.white,
body: Obx(() {
@ -141,8 +126,7 @@ class _LockDetailPageState extends State<LockDetailPage>
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style: TextStyle(
color: const Color(0xffCBA74B), fontSize: 24.sp)),
style: TextStyle(color: const Color(0xffCBA74B), fontSize: 24.sp)),
),
),
SizedBox(height: 10.h),
@ -161,10 +145,7 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox(
height: 20.h,
),
labelText(
img: 'images/icon_slider_horizontal.png',
text: '功能'.tr,
child: bottomWidget()),
labelText(img: 'images/icon_slider_horizontal.png', text: '功能'.tr, child: bottomWidget()),
btnText(
img: 'images/main/icon_main_set.png',
text: '设置'.tr,
@ -172,17 +153,13 @@ class _LockDetailPageState extends State<LockDetailPage>
if (state.openDoorBtnisUneable.value == false) {
return;
}
Get.toNamed(Routers.lockSetPage,
arguments: <String, Object?>{
'lockId': state.keyInfos.value.lockId,
'isOnlyOneData': state.isOnlyOneData
});
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
'lockId': state.keyInfos.value.lockId,
'isOnlyOneData': state.isOnlyOneData
});
}),
if (!F.isProductionEnv)
labelText(
img: 'images/icon_puzzlepiece_extension.png',
text: '配件'.tr,
child: attachmentWidget()),
labelText(img: 'images/icon_puzzlepiece_extension.png', text: '配件'.tr, child: attachmentWidget()),
],
),
),
@ -201,24 +178,21 @@ class _LockDetailPageState extends State<LockDetailPage>
);
}
Widget btnText(
{required String img, required String text, required var onTap}) {
Widget btnText({required String img, required String text, required var onTap}) {
return GestureDetector(
onTap: onTap,
child: Container(
margin: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 15.h),
padding: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 30.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.r),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 5.r,
spreadRadius: 0,
),
]),
decoration:
BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(16.r), boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 5.r,
spreadRadius: 0,
),
]),
child: Row(
children: <Widget>[
FlavorsImg(
@ -247,22 +221,18 @@ class _LockDetailPageState extends State<LockDetailPage>
);
}
Widget labelText(
{required String img, required String text, required Widget child}) {
Widget labelText({required String img, required String text, required Widget child}) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 15.h),
padding: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 15.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.r),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 5.r,
spreadRadius: 0,
),
]),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(16.r), boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.15),
offset: const Offset(0, 0),
blurRadius: 5.r,
spreadRadius: 0,
),
]),
child: Column(
children: <Widget>[
Row(
@ -328,13 +298,10 @@ class _LockDetailPageState extends State<LockDetailPage>
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Image.asset(showElectricIcon(state.electricQuantity.value),
width: 30.w, height: 24.w),
Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w),
SizedBox(width: 2.w),
Text('${state.electricQuantity.value}%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
Icon(
Icons.info, // 使 warning
@ -345,24 +312,17 @@ class _LockDetailPageState extends State<LockDetailPage>
],
),
Visibility(
visible: state
.keyInfos.value.lockFeature!.isSupportBackupBattery ==
1,
visible: state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlavorsImg(
child: Image.asset(
showElectricIcon(
state.electricQuantityStandby.value),
width: 30.w,
height: 24.w),
child: Image.asset(showElectricIcon(state.electricQuantityStandby.value),
width: 30.w, height: 24.w),
),
SizedBox(width: 2.w),
Text('${state.electricQuantityStandby.value}%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
FlavorsImg(
child: Icon(
@ -386,8 +346,7 @@ class _LockDetailPageState extends State<LockDetailPage>
child: GestureDetector(
onTap: () {
if (state.openDoorBtnisUneable.value == true) {
logic.functionBlocker
.block(isNeedRealNameAuthThenOpenLock);
logic.functionBlocker.block(isNeedRealNameAuthThenOpenLock);
}
},
onLongPressStart: (LongPressStartDetails details) {
@ -457,12 +416,10 @@ class _LockDetailPageState extends State<LockDetailPage>
right: 90.w,
bottom: 1,
child: Obx(() => Visibility(
visible:
state.keyInfos.value.lockSetting!.remoteUnlock == 1,
visible: state.keyInfos.value.lockSetting!.remoteUnlock == 1,
child: GestureDetector(
onTap: () {
ShowCupertinoAlertView().isToRemoteUnLockAlert(
remoteUnlockAction: () {
ShowCupertinoAlertView().isToRemoteUnLockAlert(remoteUnlockAction: () {
if (state.keyInfos.value.hasGateway != 1) {
logic.showToast('附近没有可用网关'.tr);
}
@ -508,34 +465,24 @@ class _LockDetailPageState extends State<LockDetailPage>
return ListView(
children: <Widget>[
Visibility(
visible:
(state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
state.keyInfos.value.keyType ==
XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) <=
15 &&
DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) >=
0) && // 030
(state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusNormalUse ||
state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitReceive) // 使
visible: (state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 &&
DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 030
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse ||
state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive) // 使
,
child: Container(
// height: 30.h,
width: 1.sw,
color: const Color(0xFFFBEFD4),
padding:
EdgeInsets.only(top: 8.h, bottom: 8.h, right: 10.w, left: 10.h),
padding: EdgeInsets.only(top: 8.h, bottom: 8.h, right: 10.w, left: 10.h),
child: Text(
"${"钥匙将在".tr}${DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!)}${"天后失效".tr}",
maxLines: 2,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
style:
TextStyle(color: const Color(0xffCBA74B), fontSize: 24.sp)),
style: TextStyle(color: const Color(0xffCBA74B), fontSize: 24.sp)),
),
),
Stack(children: <Widget>[
@ -618,16 +565,11 @@ class _LockDetailPageState extends State<LockDetailPage>
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlavorsImg(
child: Image.asset(
showElectricIcon(state.electricQuantity.value),
width: 30.w,
height: 24.w),
child: Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w),
),
SizedBox(width: 2.w),
Text('${state.electricQuantity.value}%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
state.keyInfos.value.network?.isOnline == 1
? Icon(
@ -649,24 +591,17 @@ class _LockDetailPageState extends State<LockDetailPage>
),
),
Visibility(
visible: state
.keyInfos.value.lockFeature!.isSupportBackupBattery ==
1,
visible: state.keyInfos.value.lockFeature!.isSupportBackupBattery == 1,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FlavorsImg(
child: Image.asset(
showElectricIcon(
state.electricQuantityStandby.value),
width: 30.w,
height: 24.w),
child: Image.asset(showElectricIcon(state.electricQuantityStandby.value),
width: 30.w, height: 24.w),
),
SizedBox(width: 2.w),
Text('${state.electricQuantityStandby.value}%',
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
FlavorsImg(
child: Icon(
@ -756,12 +691,10 @@ class _LockDetailPageState extends State<LockDetailPage>
right: 90.w,
bottom: 1,
child: Obx(() => Visibility(
visible:
state.keyInfos.value.lockSetting!.remoteUnlock == 1,
visible: state.keyInfos.value.lockSetting!.remoteUnlock == 1,
child: GestureDetector(
onTap: () {
ShowCupertinoAlertView().isToRemoteUnLockAlert(
remoteUnlockAction: () {
ShowCupertinoAlertView().isToRemoteUnLockAlert(remoteUnlockAction: () {
if (state.keyInfos.value.hasGateway != 1) {
logic.showToast('附近没有可用网关'.tr);
}
@ -792,10 +725,7 @@ class _LockDetailPageState extends State<LockDetailPage>
logic.getKeyStatusTextAndShow(),
maxLines: 2,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.btnDisableColor,
fontWeight: FontWeight.w500),
style: TextStyle(fontSize: 22.sp, color: AppColors.btnDisableColor, fontWeight: FontWeight.w500),
),
),
),
@ -818,8 +748,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget adminInfoView({bool center = true, bool max = true}) {
return Row(
mainAxisAlignment:
center ? MainAxisAlignment.center : MainAxisAlignment.start,
mainAxisAlignment: center ? MainAxisAlignment.center : MainAxisAlignment.start,
children: <Widget>[
Row(
mainAxisSize: max ? MainAxisSize.max : MainAxisSize.min,
@ -834,11 +763,8 @@ class _LockDetailPageState extends State<LockDetailPage>
Text(
state.keyInfos.value.isLockOwner == 1
? '超级管理员英文'.tr
: (state.keyInfos.value.keyRight == 1
? '授权管理员英文'.tr
: '普通用户'.tr),
style: TextStyle(
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
: (state.keyInfos.value.keyRight == 1 ? '授权管理员英文'.tr : '普通用户'.tr),
style: TextStyle(fontSize: 20.sp, color: AppColors.darkGrayTextColor),
),
SizedBox(width: 40.w),
],
@ -860,9 +786,7 @@ class _LockDetailPageState extends State<LockDetailPage>
'网关设备英文'.tr,
style: TextStyle(
fontSize: 20.sp,
color: state.keyInfos.value.hasGateway == 1
? AppColors.mainColor
: AppColors.btnDisableColor),
color: state.keyInfos.value.hasGateway == 1 ? AppColors.mainColor : AppColors.btnDisableColor),
),
SizedBox(width: 20.w),
],
@ -874,18 +798,14 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Image.asset('images/main/icon_lockDetail_needNetwork.png',
width: 24.w,
height: 20.w,
color: state.isOpenLockNeedOnline.value == 1
? AppColors.mainColor
: AppColors.btnDisableColor),
color: state.isOpenLockNeedOnline.value == 1 ? AppColors.mainColor : AppColors.btnDisableColor),
),
SizedBox(width: 6.w),
Text(
'手机需联网英文'.tr,
style: TextStyle(
fontSize: 20.sp,
color: state.isOpenLockNeedOnline.value == 1
? AppColors.mainColor
: AppColors.btnDisableColor),
color: state.isOpenLockNeedOnline.value == 1 ? AppColors.mainColor : AppColors.btnDisableColor),
),
],
)
@ -894,8 +814,7 @@ class _LockDetailPageState extends State<LockDetailPage>
}
//
Widget xhjBuildRotationTransition(
{required double width, required double height}) {
Widget xhjBuildRotationTransition({required double width, required double height}) {
return Positioned(
child: RotationTransition(
//
@ -907,17 +826,14 @@ class _LockDetailPageState extends State<LockDetailPage>
'images/icon_circle_dotted.png',
width: width,
height: height,
color: state.isOpenPassageMode.value == 1
? Colors.red
: AppColors.mainColor,
color: state.isOpenPassageMode.value == 1 ? Colors.red : AppColors.mainColor,
),
),
);
}
//
Widget buildRotationTransition(
{required double width, required double height}) {
Widget buildRotationTransition({required double width, required double height}) {
return Positioned(
child: RotationTransition(
//
@ -949,9 +865,7 @@ class _LockDetailPageState extends State<LockDetailPage>
margin: EdgeInsets.symmetric(vertical: 10.0.w, horizontal: 6.0.w),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: state.currentPage.value == index
? AppColors.mainColor
: Colors.grey,
color: state.currentPage.value == index ? AppColors.mainColor : Colors.grey,
),
);
}),
@ -997,8 +911,7 @@ class _LockDetailPageState extends State<LockDetailPage>
// '开门器', state.bottomBtnisUneable.value, () {}));
//
showWidgetArr.add(bottomItem('images/main/icon_main_addLock.png', '新增配件'.tr,
state.bottomBtnisEable.value, () {
showWidgetArr.add(bottomItem('images/main/icon_main_addLock.png', '新增配件'.tr, state.bottomBtnisEable.value, () {
Navigator.pushNamed(context, Routers.accessoriesListPage);
}));
@ -1015,8 +928,7 @@ class _LockDetailPageState extends State<LockDetailPage>
crossAxisSpacing: 0.h,
mainAxisExtent: 90.0, // item
),
itemCount: (state.keyInfos.value.isLockOwner == 1 ||
state.keyInfos.value.keyRight == 1)
itemCount: (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1)
? getAllWidget().length
: getNormalWidget().length,
itemBuilder: (context, index) {
@ -1041,8 +953,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
List<Widget> getBottomWidget() {
if (state.keyInfos.value.isLockOwner == 1 ||
state.keyInfos.value.keyRight == 1) {
if (state.keyInfos.value.isLockOwner == 1 || state.keyInfos.value.keyRight == 1) {
//
return getAllWidget();
} else {
@ -1062,22 +973,17 @@ class _LockDetailPageState extends State<LockDetailPage>
// }));
// }
//
showWidgetArr.add(bottomItem('images/main/icon_main_operatingRecord.png',
'操作记录'.tr, state.bottomBtnisEable.value, () {
showWidgetArr
.add(bottomItem('images/main/icon_main_operatingRecord.png', '操作记录'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.doorLockLogPage,
arguments: <String, LockListInfoItemEntity>{
'keyInfo': state.keyInfos.value
});
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfos.value});
}));
//
if (F.isSKY) {
showWidgetArr
.add(bottomItem('images/main/icon_main_set.png', '设置'.tr, true, () {
Get.toNamed(Routers.lockSetPage, arguments: <String, Object?>{
'lockId': state.keyInfos.value.lockId,
'isOnlyOneData': state.isOnlyOneData
});
showWidgetArr.add(bottomItem('images/main/icon_main_set.png', '设置'.tr, true, () {
Get.toNamed(Routers.lockSetPage,
arguments: <String, Object?>{'lockId': state.keyInfos.value.lockId, 'isOnlyOneData': state.isOnlyOneData});
}));
}
@ -1097,26 +1003,22 @@ class _LockDetailPageState extends State<LockDetailPage>
// }
//
showWidgetArr.add(bottomItem('images/main/icon_main_electronicKey.png',
'电子钥匙'.tr, state.bottomBtnisEable.value, () {
showWidgetArr
.add(bottomItem('images/main/icon_main_electronicKey.png', '电子钥匙'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.electronicKeyListPage);
}));
//
if (state.keyInfos.value.lockFeature!.password == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_password.png',
'密码'.tr, state.bottomBtnisEable.value, () {
showWidgetArr.add(bottomItem('images/main/icon_main_password.png', '密码'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.passwordKeyListPage,
arguments: <String, LockListInfoItemEntity>{
'keyInfo': state.keyInfos.value
});
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfos.value});
}));
}
// ic卡
if (state.keyInfos.value.lockFeature!.icCard == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', ''.tr,
state.bottomBtnisEable.value, () {
showWidgetArr.add(bottomItem('images/main/icon_main_icCard.png', ''.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.cardListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
@ -1125,8 +1027,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//
if (state.keyInfos.value.lockFeature!.fingerprint == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png',
'指纹'.tr, state.bottomBtnisEable.value, () {
showWidgetArr.add(bottomItem('images/main/icon_main_fingerprint.png', '指纹'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.fingerprintListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
@ -1135,8 +1036,8 @@ class _LockDetailPageState extends State<LockDetailPage>
//
if (state.keyInfos.value.lockFeature!.bluetoothRemoteControl == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_remoteControl.png',
'遥控'.tr, state.bottomBtnisEable.value, () {
showWidgetArr
.add(bottomItem('images/main/icon_main_remoteControl.png', '遥控'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.remoteControlListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
@ -1146,9 +1047,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//->
if (state.keyInfos.value.lockFeature!.d3Face == 1) {
showWidgetArr.add(
bottomItem(
'images/main/icon_face.png', '人脸'.tr, state.bottomBtnisEable.value,
() {
bottomItem('images/main/icon_face.png', '人脸'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.faceListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
@ -1158,9 +1057,7 @@ class _LockDetailPageState extends State<LockDetailPage>
if (state.keyInfos.value.lockFeature!.isSupportIris == 1) {
showWidgetArr.add(
bottomItem(
'images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value,
() {
bottomItem('images/main/icon_iris.png', '虹膜'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.irisListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
@ -1170,9 +1067,7 @@ class _LockDetailPageState extends State<LockDetailPage>
if (state.keyInfos.value.lockFeature!.palmVein == 1) {
showWidgetArr.add(
bottomItem(
'images/main/icon_palm.png', '掌静脉'.tr, state.bottomBtnisEable.value,
() {
bottomItem('images/main/icon_palm.png', '掌静脉'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.palmListPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
@ -1183,8 +1078,7 @@ class _LockDetailPageState extends State<LockDetailPage>
//->
if (state.keyInfos.value.lockFeature!.isSupportCatEye == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_catEyes.png', '监控'.tr,
state.bottomBtnisEable.value, () async {
bottomItem('images/main/icon_catEyes.png', '监控'.tr, state.bottomBtnisEable.value, () async {
logic.sendMonitorMessage();
}),
);
@ -1192,33 +1086,28 @@ class _LockDetailPageState extends State<LockDetailPage>
//
if (state.keyInfos.value.isLockOwner == 1) {
showWidgetArr.add(bottomItem('images/main/icon_main_authorizedAdmin.png',
'授权管理员'.tr, state.bottomBtnisEable.value, () {
showWidgetArr
.add(bottomItem('images/main/icon_main_authorizedAdmin.png', '授权管理员'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.authorizedAdminListPage,
arguments: <String, LockListInfoItemEntity>{
'keyInfo': state.keyInfos.value
});
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfos.value});
}));
}
final List<Widget> endWiddget = <Widget>[];
endWiddget.add(
//
bottomItem('images/main/icon_main_operatingRecord.png', '操作记录'.tr,
state.bottomBtnisEable.value, () {
bottomItem('images/main/icon_main_operatingRecord.png', '操作记录'.tr, state.bottomBtnisEable.value, () {
// Get.toNamed(Routers.lockOperatingRecordPage,
// arguments: {"keyInfo": state.keyInfos.value});
Get.toNamed(Routers.doorLockLogPage,
arguments: <String, LockListInfoItemEntity>{
'keyInfo': state.keyInfos.value
});
arguments: <String, LockListInfoItemEntity>{'keyInfo': state.keyInfos.value});
}),
);
if (state.keyInfos.value.lockFeature!.isSupportCatEye == 1) {
//
endWiddget.add(bottomItem('images/main/icon_lockDetail_videoLog.png',
'视频日志'.tr, state.bottomBtnisEable.value, () {
endWiddget
.add(bottomItem('images/main/icon_lockDetail_videoLog.png', '视频日志'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.videoLogPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
});
@ -1227,12 +1116,10 @@ class _LockDetailPageState extends State<LockDetailPage>
if (!F.isProductionEnv) {
endWiddget.add(
//
bottomItem('images/main/icon_lockDetail_messageReminding.png',
'消息提醒'.tr, state.bottomBtnisEable.value, () {
bottomItem('images/main/icon_lockDetail_messageReminding.png', '消息提醒'.tr, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.msgNotificationPage, arguments: <String, int?>{
'lockId': state.keyInfos.value.lockId,
'isSupportCatEye':
state.keyInfos.value.lockFeature!.isSupportCatEye,
'isSupportCatEye': state.keyInfos.value.lockFeature!.isSupportCatEye,
});
}),
);
@ -1254,8 +1141,7 @@ class _LockDetailPageState extends State<LockDetailPage>
return showWidgetArr;
}
Widget bottomItem(
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
Widget bottomItem(String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
final Widget child = F.sw(
skyCall: () => Container(
color: Colors.white,
@ -1268,9 +1154,7 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Image.asset(iconUrl,
width: 42.w,
height: 42.w,
color: bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable,
color: bottomBtnisEable ? AppColors.mainColor : AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
SizedBox(height: 5.h),
@ -1278,9 +1162,7 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Text(name,
style: TextStyle(
fontSize: 20.sp,
color: bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable),
color: bottomBtnisEable ? AppColors.blackColor : AppColors.lockDetailBottomBtnUneable),
textAlign: TextAlign.center))
],
),
@ -1298,9 +1180,7 @@ class _LockDetailPageState extends State<LockDetailPage>
child: Image.asset(iconUrl,
width: 42.w,
height: 42.w,
color: bottomBtnisEable
? AppColors.mainColor
: AppColors.lockDetailBottomBtnUneable,
color: bottomBtnisEable ? AppColors.mainColor : AppColors.lockDetailBottomBtnUneable,
fit: BoxFit.fitWidth),
),
SizedBox(height: 15.h),
@ -1313,9 +1193,7 @@ class _LockDetailPageState extends State<LockDetailPage>
style: TextStyle(
fontSize: 20.sp,
height: 1.0,
color: bottomBtnisEable
? AppColors.blackColor
: AppColors.lockDetailBottomBtnUneable),
color: bottomBtnisEable ? AppColors.blackColor : AppColors.lockDetailBottomBtnUneable),
),
],
),
@ -1347,18 +1225,14 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget _unlockSuccessWidget() {
String lockAlias = state.keyInfos.value.lockAlias!;
final TextStyle lockAliasTextStyle =
TextStyle(color: AppColors.placeholderTextColor, fontSize: 24.sp);
final TextStyle lockAliasTextStyle = TextStyle(color: AppColors.placeholderTextColor, fontSize: 24.sp);
final TextPainter textPainter = TextPainter(
text: TextSpan(text: lockAlias, style: lockAliasTextStyle),
maxLines: 1,
textDirection: TextDirection.ltr)
text: TextSpan(text: lockAlias, style: lockAliasTextStyle), maxLines: 1, textDirection: TextDirection.ltr)
..layout(minWidth: 0, maxWidth: double.infinity);
final double textSizeWidth = textPainter.size.width; //
if (textSizeWidth > 358.w * 2 - 20) {
lockAlias =
'${lockAlias.substring(0, lockAlias.length > 25 ? 25 : lockAlias.length)}...';
lockAlias = '${lockAlias.substring(0, lockAlias.length > 25 ? 25 : lockAlias.length)}...';
}
return Center(
child: Stack(
@ -1378,17 +1252,13 @@ class _LockDetailPageState extends State<LockDetailPage>
Text(state.iSOpenLock.value == true ? '已开锁'.tr : '已闭锁'.tr,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.mainColor,
fontSize: 32.sp,
fontWeight: FontWeight.w600)),
style: TextStyle(color: AppColors.mainColor, fontSize: 32.sp, fontWeight: FontWeight.w600)),
SizedBox(
height: 10.h,
),
Text(
lockAlias,
style: TextStyle(
color: AppColors.placeholderTextColor, fontSize: 24.sp),
style: TextStyle(color: AppColors.placeholderTextColor, fontSize: 24.sp),
maxLines: 2,
),
SizedBox(
@ -1396,8 +1266,7 @@ class _LockDetailPageState extends State<LockDetailPage>
),
Text(
getCurrentFormattedTime(),
style: TextStyle(
color: AppColors.darkGrayTextColor, fontSize: 24.sp),
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 24.sp),
)
],
)),
@ -1476,10 +1345,7 @@ class _LockDetailPageState extends State<LockDetailPage>
// AppLog.log('点击开锁 state.openDoorModel = 0 不需要联网');
// FlutterBuglyPlugin.reportException(exceptionName: '点击了不需要联网开锁');
BuglyTool.uploadException(
message: '点击了不需要联网开锁',
detail: '点击了不需要联网开锁 openDoorModel:${state.openDoorModel}',
upload: false,
begin: true);
message: '点击了不需要联网开锁', detail: '点击了不需要联网开锁 openDoorModel:${state.openDoorModel}', upload: false, begin: true);
AppLog.log('点击开锁 state.openDoorModel = 0 不需要联网');
logic.openDoorAction();
} else {
@ -1488,10 +1354,7 @@ class _LockDetailPageState extends State<LockDetailPage>
// AppLog.log('点击开锁 state.openDoorModel = 2 需要联网');
// FlutterBuglyPlugin.reportException(exceptionName: '点击了需要联网开锁');
BuglyTool.uploadException(
message: '点击了需要联网开锁',
detail: '点击了需要联网开锁 openDoorModel:${state.openDoorModel}',
upload: false,
begin: true);
message: '点击了需要联网开锁', detail: '点击了需要联网开锁 openDoorModel:${state.openDoorModel}', upload: false, begin: true);
AppLog.log('点击开锁 state.openDoorModel = 2 需要联网');
logic.getLockNetToken();
}
@ -1526,8 +1389,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.closedUnlockSuccessfulTimer?.cancel();
_lockRefreshLockDetailInfoDataEvent?.cancel();
state.replySubscription.cancel();
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent
?.cancel();
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent?.cancel();
state.LockSetChangeSetRefreshLockDetailWithTypeSubscription?.cancel();
if (state.animationController != null) {
state.animationController!.dispose();