Skip to content

Commit eeb88f6

Browse files
committed
autocomplete: Add user avatars to user-mention autocompletes
Fixes: zulip#227
1 parent 9044a9a commit eeb88f6

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

lib/widgets/autocomplete.dart

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22

3+
import 'content.dart';
34
import 'store.dart';
45
import '../model/autocomplete.dart';
56
import '../model/compose.dart';
@@ -123,23 +124,31 @@ class _ComposeAutocompleteState extends State<ComposeAutocomplete> with PerAccou
123124

124125
Widget _buildItem(BuildContext _, int index) {
125126
final option = _resultsToDisplay[index];
127+
Widget avatar;
126128
String label;
127129
switch (option) {
128130
case UserMentionAutocompleteResult(:var userId):
129-
// TODO(#227) avatar
131+
avatar = Avatar(userId: userId, size: 28, borderRadius: 3);
130132
label = PerAccountStoreWidget.of(context).users[userId]!.fullName;
131133
case WildcardMentionAutocompleteResult():
134+
avatar = const SizedBox.shrink();
132135
label = '[unimplemented]'; // TODO(#234)
133136
case UserGroupMentionAutocompleteResult():
137+
avatar = const SizedBox.shrink();
134138
label = '[unimplemented]'; // TODO(#233)
135139
}
136140
return InkWell(
137141
onTap: () {
138142
_onTapOption(option);
139143
},
140144
child: Padding(
141-
padding: const EdgeInsets.all(16.0),
142-
child: Text(label)));
145+
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
146+
child: Row(
147+
children: [
148+
avatar,
149+
const SizedBox(width: 8),
150+
Text(label),
151+
])));
143152
}
144153

145154
@override

0 commit comments

Comments
 (0)