diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart index 44277007..83fada97 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_page.dart @@ -500,7 +500,10 @@ class _LockSetPageState extends State isHaveLine: true, isHaveDirection: true, action: () { - Get.toNamed(Routers.motorPowerPage); + Get.toNamed(Routers.motorPowerPage, + arguments: { + 'lockSetInfoData': state.lockSetInfoData.value + }); })), // 蓝牙广播(关闭则不能使用蓝牙主动开锁) /* 2024-01-12 会议确定去掉“蓝牙广播” by DaisyWu diff --git a/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart b/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart index 0085779e..44b72e64 100755 --- a/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart +++ b/lib/main/lockDetail/lockSet/motorPower/motorPower_logic.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; +import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart'; import '../../../../blue/blue_manage.dart'; @@ -28,6 +29,7 @@ class MotorPowerLogic extends BaseGetXController { if (entity.errorCode!.codeIsSuccessful) { state.lockSetInfoData.value.lockSettingInfo!.openDirectionValue = state.motorTorsion.value; + eventBus .fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); showToast('操作成功'.tr); @@ -36,6 +38,7 @@ class MotorPowerLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; + void _initReplySubscription() { _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { @@ -43,6 +46,10 @@ class MotorPowerLogic extends BaseGetXController { _replySetSupportFunctionsWithParameters(reply); } + if (reply is SetSupportFunctionsWithParametersReply) { + _replySetSupportFunctionsWithParameters(reply); + } + // 读取支持功能(带参数) // if(reply is ReadSupportFunctionsNoParametersReply) { // _readSupportFunctionsWithParametersReply(reply); diff --git a/lib/main/lockDetail/lockSet/motorPower/motorPower_page.dart b/lib/main/lockDetail/lockSet/motorPower/motorPower_page.dart index ac023d66..7aa478c6 100755 --- a/lib/main/lockDetail/lockSet/motorPower/motorPower_page.dart +++ b/lib/main/lockDetail/lockSet/motorPower/motorPower_page.dart @@ -21,53 +21,60 @@ class _MotorPowerPageState extends State { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.white, - appBar: TitleAppBar( - barTitle: '电机功率设置'.tr, - haveBack: true, - backgroundColor: AppColors.mainColor), - body: Column( - children: [ - SizedBox( - height: 40.h, + backgroundColor: Colors.white, + appBar: TitleAppBar( + barTitle: '电机功率设置'.tr, + haveBack: true, + backgroundColor: AppColors.mainColor), + body: Column( + children: [ + SizedBox( + height: 40.h, + ), + Container( + margin: EdgeInsets.only(left: 40.w), + alignment: Alignment.centerLeft, + child: Text( + '请根据门锁实际情况,请谨慎选择电机功率:'.tr, + style: TextStyle( + fontSize: 24.sp, + color: Colors.black, + fontWeight: FontWeight.w500), ), - Container( - margin: EdgeInsets.only(left: 40.w), - alignment: Alignment.centerLeft, - child: Text( - '请根据门锁实际情况,请谨慎选择电机功率:'.tr, - style: TextStyle( - fontSize: 24.sp, - color: Colors.black, - fontWeight: FontWeight.w500), - ), - ), - SizedBox( - height: 40.h, - ), - _buildTipsView( + ), + SizedBox( + height: 40.h, + ), + Obx( + () => _buildTipsView( '${'小功率:'.tr}\n', '耗电少'.tr, state.motorTorsion.value == 1, () { state.motorTorsion.value = 1; logic.sendOpenDoorDirection(); }), - SizedBox( - height: 20.h, - ), - _buildTipsView( + ), + SizedBox( + height: 20.h, + ), + Obx( + () => _buildTipsView( '${'中功率'.tr}\n', '常规使用'.tr, state.motorTorsion.value == 2, () { state.motorTorsion.value = 2; logic.sendOpenDoorDirection(); }), - SizedBox( - height: 20.h, - ), - _buildTipsView( + ), + SizedBox( + height: 20.h, + ), + Obx( + () => _buildTipsView( '${'大功率'.tr}\n', '大功率提示'.tr, state.motorTorsion.value == 3, () { state.motorTorsion.value = 3; logic.sendOpenDoorDirection(); }), - ], - )); + ) + ], + ), + ); } Widget _buildTipsView(