mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +00:00
Made search results work
This commit is contained in:
parent
620ad0d5cf
commit
4c749ec6ac
@ -5,6 +5,7 @@ import 'package:comunic/lists/groups_list.dart';
|
|||||||
import 'package:comunic/lists/search_results_list.dart';
|
import 'package:comunic/lists/search_results_list.dart';
|
||||||
import 'package:comunic/lists/users_list.dart';
|
import 'package:comunic/lists/users_list.dart';
|
||||||
import 'package:comunic/models/search_result.dart';
|
import 'package:comunic/models/search_result.dart';
|
||||||
|
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/group_icon_widget.dart';
|
import 'package:comunic/ui/widgets/group_icon_widget.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
@ -129,7 +130,10 @@ class _GlobalSearchFieldState extends State<GlobalSearchField> {
|
|||||||
height: 300,
|
height: 300,
|
||||||
child: Material(
|
child: Material(
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
child: _SearchResultsWidget(results: _searchResultsList),
|
child: _SearchResultsWidget(
|
||||||
|
results: _searchResultsList,
|
||||||
|
onTap: _removeOverlay,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -137,8 +141,14 @@ class _GlobalSearchFieldState extends State<GlobalSearchField> {
|
|||||||
|
|
||||||
class _SearchResultsWidget extends StatelessWidget {
|
class _SearchResultsWidget extends StatelessWidget {
|
||||||
final _SearchResults results;
|
final _SearchResults results;
|
||||||
|
final Function() onTap;
|
||||||
|
|
||||||
const _SearchResultsWidget({Key key, this.results}) : super(key: key);
|
const _SearchResultsWidget({
|
||||||
|
Key key,
|
||||||
|
@required this.results,
|
||||||
|
@required this.onTap,
|
||||||
|
}) : assert(onTap != null),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -158,6 +168,10 @@ class _SearchResultsWidget extends StatelessWidget {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
leading: AccountImageWidget(user: user),
|
leading: AccountImageWidget(user: user),
|
||||||
title: Text(user.displayName),
|
title: Text(user.displayName),
|
||||||
|
onTap: () {
|
||||||
|
MainController.of(context).openUserPage(user.id);
|
||||||
|
onTap();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
case SearchResultKind.GROUP:
|
case SearchResultKind.GROUP:
|
||||||
@ -165,6 +179,10 @@ class _SearchResultsWidget extends StatelessWidget {
|
|||||||
return ListTile(
|
return ListTile(
|
||||||
leading: GroupIcon(group: group),
|
leading: GroupIcon(group: group),
|
||||||
title: Text(group.displayName),
|
title: Text(group.displayName),
|
||||||
|
onTap: () {
|
||||||
|
MainController.of(context).openGroup(group.id);
|
||||||
|
onTap();
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
throw Exception("Unreachable statement!");
|
throw Exception("Unreachable statement!");
|
||||||
|
Loading…
Reference in New Issue
Block a user