feat: search by uid

Closes #157

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-13 19:22:07 +08:00
parent 4b7581d9fe
commit a395055bdc
2 changed files with 31 additions and 5 deletions

View File

@@ -21,6 +21,8 @@ class SSearchController extends GetxController {
int initIndex = 0;
RxBool showUidBtn = false.obs;
@override
void onInit() {
super.onInit();
@@ -44,7 +46,12 @@ class SSearchController extends GetxController {
}
}
void validateUid() {
showUidBtn.value = RegExp(r'^\d+$').hasMatch(controller.text);
}
void onChange(String value) {
validateUid();
if (value.isEmpty) {
searchSuggestList.clear();
} else {
@@ -57,6 +64,7 @@ class SSearchController extends GetxController {
controller.clear();
searchSuggestList.clear();
searchFocusNode.requestFocus();
showUidBtn.value = false;
} else {
Get.back();
}
@@ -69,6 +77,7 @@ class SSearchController extends GetxController {
return;
}
controller.text = hintText;
validateUid();
}
historyList.remove(controller.text);
@@ -98,6 +107,8 @@ class SSearchController extends GetxController {
void onClickKeyword(String keyword) {
controller.text = keyword;
validateUid();
searchSuggestList.clear();
submit();
}