|
|
|
@ -1,4 +1,5 @@ |
|
|
|
import 'package:json_annotation/json_annotation.dart'; |
|
|
|
import 'package:get/get.dart'; |
|
|
|
|
|
|
|
part 'appconfig_model.g.dart'; // 生成的文件名 |
|
|
|
|
|
|
|
@ -136,3 +137,24 @@ enum DeviceType { |
|
|
|
/// 设备类型对应的整数值 |
|
|
|
final int value; |
|
|
|
} |
|
|
|
|
|
|
|
// 为 DeviceType 添加扩展方法 |
|
|
|
extension DeviceTypeExtension on DeviceType { |
|
|
|
/// 获取设备类型的显示名称 |
|
|
|
/// @Description 根据设备类型返回对应的翻译键 |
|
|
|
String get displayName { |
|
|
|
switch (this) { |
|
|
|
case DeviceType.unknown: |
|
|
|
return "deviceTypeUnknown".tr; // 未知设备 |
|
|
|
case DeviceType.classicBluetoothHeadset: |
|
|
|
return "deviceTypeClassicBluetoothHeadset".tr; // 经典蓝牙耳机 |
|
|
|
case DeviceType.bleBluetoothDoubleHeadset: |
|
|
|
case DeviceType.bleBluetoothSingleHeadset: |
|
|
|
return "deviceTypeBleBluetoothHeadset".tr; // BLE蓝牙耳机(单端和双端都使用同一个翻译键) |
|
|
|
case DeviceType.smartVoiceRecorder: |
|
|
|
return "deviceTypeSmartVoiceRecorder".tr; // 智能录音笔 |
|
|
|
case DeviceType.smartEye: |
|
|
|
return "deviceTypeSmartEye".tr; // 智能眼镜 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|