更新眠花糖选择城市
This commit is contained in:
@@ -6,13 +6,13 @@ import 'package:flutter_svg/svg.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/pojo/city.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/controller/mh_controller/mh_language_controller.dart';
|
||||
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
|
||||
ThemeController themeController = Get.find();
|
||||
@@ -20,6 +20,31 @@ LanguageController languageController = Get.find();
|
||||
MHLanguageController mhLanguageController = Get.find();
|
||||
|
||||
class MyUtils {
|
||||
// 获取城市显示文本
|
||||
// 更详细的显示逻辑(可选)
|
||||
static String getDetailedCityDisplayText(CityModel? cityModel) {
|
||||
if (cityModel == null) {
|
||||
return '选择城市'.tr;
|
||||
}
|
||||
|
||||
// 根据数据层级显示不同的格式
|
||||
if (cityModel.city != null && cityModel.city!.isNotEmpty) {
|
||||
// 三级数据:国家-省份-城市
|
||||
return '${cityModel.country ?? ''}-${cityModel.province ?? ''}-${cityModel.city ?? cityModel.value ?? ''}';
|
||||
} else if (cityModel.province != null && cityModel.province!.isNotEmpty) {
|
||||
// 二级数据:国家-省份
|
||||
return '${cityModel.country ?? ''}-${cityModel.province ?? cityModel.value ?? ''}';
|
||||
} else if (cityModel.country != null && cityModel.country!.isNotEmpty) {
|
||||
// 一级数据:国家
|
||||
return cityModel.country!;
|
||||
} else if (cityModel.value != null && cityModel.value!.isNotEmpty) {
|
||||
// 只有 value 字段
|
||||
return cityModel.value!;
|
||||
} else {
|
||||
return '选择城市'.tr;
|
||||
}
|
||||
}
|
||||
|
||||
static String formatTimestampToSleep(int milliseconds) {
|
||||
final date = DateTime.fromMillisecondsSinceEpoch(milliseconds);
|
||||
return "${date.year}-${date.month}-${date.day}";
|
||||
|
||||
Reference in New Issue
Block a user