地址首字母拼音
This commit is contained in:
@@ -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<AddressModel> {
|
||||
|
||||
// 工具:中文首字母转大写英文(你也可以用更专业的拼音库)
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user