|
|
|
@ -10,15 +10,30 @@ import '../controllers/devices_controller.dart'; |
|
|
|
|
|
|
|
// 设备类型枚举 |
|
|
|
enum DeviceType { |
|
|
|
Unknown(0, "未知设备"), |
|
|
|
Classic_bluetooth_Headset(1, "经典蓝牙耳机"), |
|
|
|
BLE_Bluetooth_Headset(2, "BLE蓝牙耳机"), |
|
|
|
Smart_Voice_Recorder(3, "智能录音笔"), |
|
|
|
SmartEye(4, "智能眼镜"); |
|
|
|
Unknown(0), |
|
|
|
Classic_bluetooth_Headset(1), |
|
|
|
BLE_Bluetooth_Headset(2), |
|
|
|
Smart_Voice_Recorder(3), |
|
|
|
SmartEye(4); |
|
|
|
|
|
|
|
const DeviceType(this.value, this.displayName); |
|
|
|
const DeviceType(this.value); |
|
|
|
final int value; |
|
|
|
final String displayName; |
|
|
|
|
|
|
|
// 使用getter获取多语言显示名称 |
|
|
|
String get displayName { |
|
|
|
switch (this) { |
|
|
|
case DeviceType.Unknown: |
|
|
|
return "deviceTypeUnknown".tr; |
|
|
|
case DeviceType.Classic_bluetooth_Headset: |
|
|
|
return "deviceTypeClassicBluetoothHeadset".tr; |
|
|
|
case DeviceType.BLE_Bluetooth_Headset: |
|
|
|
return "deviceTypeBleBluetoothHeadset".tr; |
|
|
|
case DeviceType.Smart_Voice_Recorder: |
|
|
|
return "deviceTypeSmartVoiceRecorder".tr; |
|
|
|
case DeviceType.SmartEye: |
|
|
|
return "deviceTypeSmartEye".tr; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static DeviceType fromValue(int value) { |
|
|
|
return DeviceType.values.firstWhere( |
|
|
|
@ -168,7 +183,7 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
), |
|
|
|
SizedBox(height: 20.h), |
|
|
|
Text( |
|
|
|
"暂未绑定任何设备", |
|
|
|
"noDevicesBound".tr, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[600], |
|
|
|
@ -176,7 +191,7 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
), |
|
|
|
SizedBox(height: 12.h), |
|
|
|
Text( |
|
|
|
"请先绑定设备后再进行管理", |
|
|
|
"pleaseBindDeviceFirst".tr, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
color: isDarkMode ? Colors.white54 : Colors.grey[500], |
|
|
|
@ -230,7 +245,9 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
device.devicename.isNotEmpty ? device.devicename : "未知设备", |
|
|
|
device.devicename.isNotEmpty |
|
|
|
? device.devicename |
|
|
|
: "deviceTypeUnknown".tr, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
@ -239,7 +256,9 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
), |
|
|
|
SizedBox(height: 4.h), |
|
|
|
Text( |
|
|
|
device.devicemac.isNotEmpty ? device.devicemac : "无MAC地址", |
|
|
|
device.devicemac.isNotEmpty |
|
|
|
? device.devicemac |
|
|
|
: "noMacAddress".tr, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[600], |
|
|
|
@ -248,7 +267,7 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
if (device.license.isNotEmpty) ...[ |
|
|
|
SizedBox(height: 4.h), |
|
|
|
Text( |
|
|
|
"授权码: ${device.license}", |
|
|
|
"${"licenseCode".tr}: ${device.license}", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
color: isDarkMode ? Colors.white54 : Colors.grey[500], |
|
|
|
@ -294,13 +313,15 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
AlertDialog( |
|
|
|
backgroundColor: isDarkMode ? AppColors.cardBackground : Colors.white, |
|
|
|
title: Text( |
|
|
|
"确认解绑", |
|
|
|
"confirmUnbind".tr, |
|
|
|
style: TextStyle( |
|
|
|
color: isDarkMode ? Colors.white : Colors.black87, |
|
|
|
), |
|
|
|
), |
|
|
|
content: Text( |
|
|
|
"确定要解绑设备 \"${device.devicename}\" 吗?", |
|
|
|
"confirmUnbindMessage" |
|
|
|
.tr |
|
|
|
.replaceAll('{deviceName}', device.devicename), |
|
|
|
style: TextStyle( |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.black54, |
|
|
|
), |
|
|
|
@ -309,7 +330,7 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
TextButton( |
|
|
|
onPressed: () => Get.back(), |
|
|
|
child: Text( |
|
|
|
"取消", |
|
|
|
"cancel".tr, |
|
|
|
style: TextStyle( |
|
|
|
color: isDarkMode ? Colors.white70 : Colors.grey[600], |
|
|
|
), |
|
|
|
@ -320,9 +341,9 @@ class DevicesView extends GetView<DevicesController> { |
|
|
|
Get.back(); |
|
|
|
controller.unbindearphone(device); |
|
|
|
}, |
|
|
|
child: const Text( |
|
|
|
"确认解绑", |
|
|
|
style: TextStyle(color: Colors.red), |
|
|
|
child: Text( |
|
|
|
"confirmUnbindAction".tr, |
|
|
|
style: const TextStyle(color: Colors.red), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
|