refactor: Magic numbers
This commit is contained in:
parent
49c83a6e58
commit
f114d545f7
8 changed files with 63 additions and 54 deletions
|
|
@ -104,6 +104,8 @@ class SearchController extends State<Search> {
|
|||
String currentSearchTerm;
|
||||
List<Profile> foundProfiles = [];
|
||||
|
||||
static const searchUserDirectoryLimit = 10;
|
||||
|
||||
void searchUser(BuildContext context, String text) async {
|
||||
if (text.isEmpty) {
|
||||
setState(() {
|
||||
|
|
@ -115,7 +117,10 @@ class SearchController extends State<Search> {
|
|||
final matrix = Matrix.of(context);
|
||||
SearchUserDirectoryResponse response;
|
||||
try {
|
||||
response = await matrix.client.searchUserDirectory(text, limit: 10);
|
||||
response = await matrix.client.searchUserDirectory(
|
||||
text,
|
||||
limit: searchUserDirectoryLimit,
|
||||
);
|
||||
} catch (_) {}
|
||||
foundProfiles = List<Profile>.from(response?.results ?? []);
|
||||
if (foundProfiles.isEmpty && text.isValidMatrixId && text.sigil == '@') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue