fix:修复设置电机功率出现错误的问题

This commit is contained in:
liyi 2025-02-18 09:59:25 +08:00
parent c9ba5aa769
commit 9cf186dab5
3 changed files with 52 additions and 35 deletions

View File

@ -500,7 +500,10 @@ class _LockSetPageState extends State<LockSetPage>
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.motorPowerPage);
Get.toNamed(Routers.motorPowerPage,
arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// 广使
/* 2024-01-12 广 by DaisyWu

View File

@ -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<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription =
EventBusManager().eventBus!.on<Reply>().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);

View File

@ -21,53 +21,60 @@ class _MotorPowerPageState extends State<MotorPowerPage> {
@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(