更新设备名称时候的为空的bug
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
@@ -94,6 +96,18 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
borderRadius: 16.rpx,
|
||||
gradientDirection: GradientDirection.vertical,
|
||||
onTap: () async {
|
||||
final MHTBlueToothController bluetoothController =
|
||||
Get.find();
|
||||
final device =
|
||||
bluetoothController.currentFullDevice;
|
||||
if (editedData['name'] == null ||
|
||||
editedData['name'] == '') {
|
||||
if (device!.type == 2) {
|
||||
editedData['name'] = '智能电动床';
|
||||
} else {
|
||||
editedData['name'] = '律动智能床垫';
|
||||
}
|
||||
}
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
@@ -112,12 +126,7 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
TopSlideNotification.show(context,
|
||||
text: "修改名称成功".tr);
|
||||
deviceListController.getDeviceList();
|
||||
|
||||
Map data = {};
|
||||
final MHTBlueToothController
|
||||
bluetoothController = Get.find();
|
||||
final device =
|
||||
bluetoothController.currentFullDevice;
|
||||
data['_id'] = device!.deviceID;
|
||||
data['isNextStep'] = true;
|
||||
Get.toNamed("/roomPickerPage", arguments: data);
|
||||
@@ -193,7 +202,6 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
maxLength: AppConstants().text_length,
|
||||
decoration: InputDecoration(
|
||||
hintText: "请输入设备的名称",
|
||||
// counterText: "",
|
||||
contentPadding:
|
||||
const EdgeInsetsDirectional
|
||||
.fromSTEB(10, 0, 10, 0),
|
||||
@@ -271,6 +279,14 @@ class _EditBedPageState extends State<EditBedPage> {
|
||||
ServiceConstant.device_show;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
if (editedData['name'] == null ||
|
||||
editedData['name'] == '') {
|
||||
if (editedData['device_type'] == 2) {
|
||||
editedData['name'] = '智能电动床';
|
||||
} else {
|
||||
editedData['name'] = '律动智能床垫';
|
||||
}
|
||||
}
|
||||
await requestWithLog(
|
||||
logTitle: "更新设备信息",
|
||||
method: MyHttpMethod.put,
|
||||
|
||||
Reference in New Issue
Block a user