From 8d11f3cf5f47084e305bb8c2e3934c58dc91d2ea Mon Sep 17 00:00:00 2001 From: czz <862977248@qq.com> Date: Tue, 1 Jul 2025 09:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E9=A6=96=E5=AD=97=E6=AF=8D?= =?UTF-8?q?=E6=8B=BC=E9=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mh_controller/address_controller.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/controller/mh_controller/address_controller.dart b/lib/controller/mh_controller/address_controller.dart index 8805d68..cf48d39 100644 --- a/lib/controller/mh_controller/address_controller.dart +++ b/lib/controller/mh_controller/address_controller.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_city_picker/model/address.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:json_annotation/json_annotation.dart'; +import 'package:lpinyin/lpinyin.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; @@ -209,11 +210,11 @@ class AddressController extends GetControllerEx { // 工具:中文首字母转大写英文(你也可以用更专业的拼音库) String _getLetter(String name) { - return name; - // if (name.isEmpty) return "#"; - // String pinyin = PinyinHelper.getPinyinE(name, - // separator: '', defPinyin: '', format: PinyinFormat.WITHOUT_TONE); - // if (pinyin.isEmpty) return "#"; - // return pinyin[0].toUpperCase(); + // return name; + if (name.isEmpty) return "#"; + String pinyin = PinyinHelper.getPinyinE(name, + separator: '', defPinyin: '', format: PinyinFormat.WITHOUT_TONE); + if (pinyin.isEmpty) return "#"; + return pinyin[0].toUpperCase(); } }