设备时区优化

This commit is contained in:
sky_min 2025-11-07 16:08:39 +08:00
parent 2ccf8cac6b
commit f95ee0518e

View File

@ -153,9 +153,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
visible: state.lockSetInfoData.value.lockFeature?.wifi == 1,
child: CommonItem(
leftTitel: '设备时区'.tr,
rightTitle: _formatTimezoneName(
state.lockSetInfoData.value.lockBasicInfo?.timezoneName
),
rightTitle: state.lockSetInfoData.value.lockBasicInfo?.timezoneName,
allHeight: 70.h,
isHaveLine: true,
),
@ -246,37 +244,4 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
// 线: percentage = (rssi + 100) * 100 / 70
return ((clampedRssi + 100) * 100 ~/ 70).clamp(0, 100);
}
String _formatTimezoneName(String? timezone) {
if (timezone == null || timezone.isEmpty) return '-';
//
final Map<String, String> timezoneMap = {
'Antarctica/Casey': '南极凯西站 (UTC+8)',
'Asia/Shanghai': '中国上海 (UTC+8)',
'America/New_York': '美国纽约 (UTC-5/-4)',
'Asia/Tokyo': '日本东京 (UTC+9)',
'Europe/London': '英国伦敦 (UTC+0/+1)',
'Europe/Paris': '法国巴黎 (UTC+1/+2)',
'America/Los_Angeles': '美国洛杉矶 (UTC-8/-7)',
'America/Chicago': '美国芝加哥 (UTC-6/-5)',
'Asia/Hong_Kong': '中国香港 (UTC+8)',
'Asia/Singapore': '新加坡 (UTC+8)',
'Australia/Sydney': '澳大利亚悉尼 (UTC+10/+11)',
'Pacific/Auckland': '新西兰奥克兰 (UTC+12/+13)',
'Asia/Dubai': '阿联酋迪拜 (UTC+4)',
'Asia/Kolkata': '印度孟买 (UTC+5:30)',
'America/Sao_Paulo': '巴西圣保罗 (UTC-3)',
'Africa/Johannesburg': '南非约翰内斯堡 (UTC+2)',
'Asia/Seoul': '韩国首尔 (UTC+9)',
'Asia/Bangkok': '泰国曼谷 (UTC+7)',
'Europe/Moscow': '俄罗斯莫斯科 (UTC+3)',
'America/Toronto': '加拿大 Toronto (UTC-5/-4)',
'America/Mexico_City': '墨西哥城 (UTC-6/-5)',
'Asia/Jakarta': '印尼雅加达 (UTC+7)',
'Europe/Berlin': '德国柏林 (UTC+1/+2)',
'Asia/Taipei': '中国台湾 (UTC+8)',
'Australia/Melbourne': '澳大利亚墨尔本 (UTC+10/+11)',
};
return timezoneMap[timezone] ?? timezone;
}
}