|
@@ -41,13 +41,23 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
@@ -41,13 +41,23 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
41
|
: userHistoryEntity.rname;
|
41
|
: userHistoryEntity.rname;
|
|
42
|
String pinyinFirst = userHistoryEntity.pinyinFirst;
|
42
|
String pinyinFirst = userHistoryEntity.pinyinFirst;
|
|
43
|
List<String> pinyinList = userHistoryEntity.pinyinList;
|
43
|
List<String> pinyinList = userHistoryEntity.pinyinList;
|
|
44
|
-
|
|
|
|
45
|
- if (pinyinList.indexOf(key) != -1) {
|
|
|
|
46
|
- keyTemp = name.substring(
|
|
|
|
47
|
- pinyinList.indexOf(key), pinyinList.indexOf(key) + 1);
|
|
|
|
48
|
- } else if (pinyinFirst.contains(key)) {
|
44
|
+ String pinyin = userHistoryEntity.pinyin;
|
|
|
|
45
|
+ // if (pinyinList.indexOf(key) != -1) {
|
|
|
|
46
|
+ // //全拼音检索一个字
|
|
|
|
47
|
+ // keyTemp = name.substring(
|
|
|
|
48
|
+ // pinyinList.indexOf(key), pinyinList.indexOf(key) + 1);
|
|
|
|
49
|
+ // } else
|
|
|
|
50
|
+ if (pinyinFirst.contains(key)) {
|
|
49
|
keyTemp = name.substring(
|
51
|
keyTemp = name.substring(
|
|
50
|
- pinyinFirst.indexOf(key), pinyinFirst.indexOf(key) + 1);
|
52
|
+ pinyinFirst.indexOf(key), pinyinFirst.indexOf(key) + key.length);
|
|
|
|
53
|
+ } else if (pinyin.indexOf(key) != -1) {
|
|
|
|
54
|
+ if (pinyinList.indexOf(key) != -1) {
|
|
|
|
55
|
+//全拼音检索 lilao
|
|
|
|
56
|
+ keyTemp = name.substring(0, pinyinList.indexOf(key) + 1);
|
|
|
|
57
|
+ } else if (pinyinFirst.contains(key)) {
|
|
|
|
58
|
+ keyTemp = name.substring(
|
|
|
|
59
|
+ pinyinFirst.indexOf(key), pinyinFirst.indexOf(key) + key.length);
|
|
|
|
60
|
+ }
|
|
51
|
}
|
61
|
}
|
|
52
|
|
62
|
|
|
53
|
print(keyTemp);
|
63
|
print(keyTemp);
|
|
@@ -130,7 +140,7 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
@@ -130,7 +140,7 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
130
|
|
140
|
|
|
131
|
String key = widget.model.controller.text;
|
141
|
String key = widget.model.controller.text;
|
|
132
|
String pinyinFirst = userHistoryEntity.pinyinFirst;
|
142
|
String pinyinFirst = userHistoryEntity.pinyinFirst;
|
|
133
|
-
|
143
|
+ List<String> pinyinList = userHistoryEntity.pinyinList;
|
|
134
|
if (key == '') {
|
144
|
if (key == '') {
|
|
135
|
return Text(name,
|
145
|
return Text(name,
|
|
136
|
style: TextStyle(
|
146
|
style: TextStyle(
|
|
@@ -138,11 +148,15 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
@@ -138,11 +148,15 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
138
|
} else {
|
148
|
} else {
|
|
139
|
return (name.contains(key) && name.length != key.length) ||
|
149
|
return (name.contains(key) && name.length != key.length) ||
|
|
140
|
(pinyinFirst.contains(key) && pinyinFirst.length != key.length) ||
|
150
|
(pinyinFirst.contains(key) && pinyinFirst.length != key.length) ||
|
|
141
|
- (pinyinFirst.contains(key) && pinyinFirst.length != key.length)
|
151
|
+ (pinyinList.contains(key) && pinyinList.length != key.length)
|
|
142
|
? _startPlaceWidget(name, key, userHistoryEntity)
|
152
|
? _startPlaceWidget(name, key, userHistoryEntity)
|
|
143
|
: Text(name,
|
153
|
: Text(name,
|
|
144
|
style: TextStyle(
|
154
|
style: TextStyle(
|
|
145
|
- color: name.length == key.length
|
155
|
+ color: ((name.contains(key) && name.length == key.length) ||
|
|
|
|
156
|
+ (pinyinFirst.contains(key) &&
|
|
|
|
157
|
+ pinyinFirst.length == key.length) ||
|
|
|
|
158
|
+ (pinyinList.contains(key) &&
|
|
|
|
159
|
+ pinyinList.length == key.length))
|
|
146
|
? MyColours.color_199095
|
160
|
? MyColours.color_199095
|
|
147
|
: MyColours.color_333333,
|
161
|
: MyColours.color_333333,
|
|
148
|
fontSize: ScreenUtil().setSp(32)));
|
162
|
fontSize: ScreenUtil().setSp(32)));
|
|
@@ -157,20 +171,17 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
@@ -157,20 +171,17 @@ class _ContantItemPageState extends State<ContantItemPage> { |
|
157
|
: userHistoryEntity.phone;
|
171
|
: userHistoryEntity.phone;
|
|
158
|
|
172
|
|
|
159
|
String key = widget.model.controller.text;
|
173
|
String key = widget.model.controller.text;
|
|
160
|
- String pinyinFirst = userHistoryEntity.pinyinFirst;
|
|
|
|
161
|
|
174
|
|
|
162
|
if (key == '') {
|
175
|
if (key == '') {
|
|
163
|
return Text(phone,
|
176
|
return Text(phone,
|
|
164
|
style: TextStyle(
|
177
|
style: TextStyle(
|
|
165
|
color: MyColours.color_333333, fontSize: ScreenUtil().setSp(32)));
|
178
|
color: MyColours.color_333333, fontSize: ScreenUtil().setSp(32)));
|
|
166
|
} else {
|
179
|
} else {
|
|
167
|
- return (phone.contains(key) && phone.length != key.length) ||
|
|
|
|
168
|
- (pinyinFirst.contains(key) && pinyinFirst.length != key.length) ||
|
|
|
|
169
|
- (pinyinFirst.contains(key) && pinyinFirst.length != key.length)
|
180
|
+ return (phone.contains(key) && phone.length != key.length)
|
|
170
|
? _getWidget(phone, key, fontSize: 30)
|
181
|
? _getWidget(phone, key, fontSize: 30)
|
|
171
|
: Text(phone,
|
182
|
: Text(phone,
|
|
172
|
style: TextStyle(
|
183
|
style: TextStyle(
|
|
173
|
- color: phone.length == key.length
|
184
|
+ color: phone.contains(key) && phone.length == key.length
|
|
174
|
? MyColours.color_199095
|
185
|
? MyColours.color_199095
|
|
175
|
: MyColours.color_333333,
|
186
|
: MyColours.color_333333,
|
|
176
|
fontSize: ScreenUtil().setSp(30)));
|
187
|
fontSize: ScreenUtil().setSp(30)));
|