feat: Also suggest username completions based on their slugs

This commit is contained in:
Sorunome 2021-07-21 20:46:17 +02:00
parent f01c62c23d
commit 3d980df674
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
3 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart'; import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:slugify/slugify.dart';
import 'avatar.dart'; import 'avatar.dart';
import 'matrix.dart'; import 'matrix.dart';
@ -110,7 +111,9 @@ class InputBar extends StatelessWidget {
final userSearch = userMatch[1].toLowerCase(); final userSearch = userMatch[1].toLowerCase();
for (final user in room.getParticipants()) { for (final user in room.getParticipants()) {
if ((user.displayName != null && if ((user.displayName != null &&
user.displayName.toLowerCase().contains(userSearch)) || (user.displayName.toLowerCase().contains(userSearch) ||
slugify(user.displayName.toLowerCase())
.contains(userSearch))) ||
user.id.split(':')[0].toLowerCase().contains(userSearch)) { user.id.split(':')[0].toLowerCase().contains(userSearch)) {
ret.add({ ret.add({
'type': 'user', 'type': 'user',

View File

@ -1111,7 +1111,7 @@ packages:
source: sdk source: sdk
version: "0.0.99" version: "0.0.99"
slugify: slugify:
dependency: transitive dependency: "direct main"
description: description:
name: slugify name: slugify
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"

View File

@ -64,6 +64,7 @@ dependencies:
scroll_to_index: ^2.0.0 scroll_to_index: ^2.0.0
sentry: ^5.1.0 sentry: ^5.1.0
share: ^2.0.4 share: ^2.0.4
slugify: ^2.0.0
swipe_to_action: ^0.2.0 swipe_to_action: ^0.2.0
uni_links: ^0.5.1 uni_links: ^0.5.1
unifiedpush: ^1.0.6 unifiedpush: ^1.0.6