feat: Redid UI For mentions

This commit is contained in:
Deven Joshi
2021-01-07 20:57:53 +05:30
parent e05033cce3
commit 3b19fe6c36
+100 -35
View File
@@ -1132,7 +1132,8 @@ class MessageInputState extends State<MessageInput> {
RenderBox renderBox = context.findRenderObject();
final size = renderBox.size;
return OverlayEntry(builder: (context) {
return OverlayEntry(
builder: (context) {
return Positioned(
bottom: size.height + MediaQuery.of(context).viewInsets.bottom,
left: 0,
@@ -1164,35 +1165,17 @@ class MessageInputState extends State<MessageInput> {
return ListView(
padding: const EdgeInsets.all(0),
shrinkWrap: true,
itemExtent: 58.0,
children: snapshot.data
.map((m) => ListTile(
leading: UserAvatar(
constraints: BoxConstraints.tight(
Size(
40,
40,
children: [
SizedBox(
height: 8.0,
),
),
user: m.user,
),
title: Text(
'${m.user.name}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold),
),
subtitle: Text(
'@${m.userId}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
trailing: StreamSvgIcon.mentions(
...snapshot.data.map(
(m) {
return Material(
color: StreamChatTheme.of(context)
.colorTheme
.accentBlue,
),
.white,
child: InkWell(
onTap: () {
_mentionedUsers.add(m.user);
@@ -1203,8 +1186,7 @@ class MessageInputState extends State<MessageInput> {
TextEditingValue(
text: rejoin +
textEditingController.text
.substring(
textEditingController
.substring(textEditingController
.selection.start),
selection: TextSelection.collapsed(
offset: rejoin.length,
@@ -1214,16 +1196,99 @@ class MessageInputState extends State<MessageInput> {
_mentionsOverlay?.remove();
_mentionsOverlay = null;
},
))
.toList(),
);
}),
child: Container(
height: 56.0,
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
SizedBox(
width: 16.0,
),
UserAvatar(
constraints: BoxConstraints.tight(
Size(
40,
40,
),
),
user: m.user,
),
SizedBox(
width: 8.0,
),
Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${m.user.name}',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: StreamChatTheme.of(
context)
.textTheme
.bodyBold,
),
SizedBox(
height: 2.0,
),
Text(
'@${m.userId}',
maxLines: 1,
overflow:
TextOverflow.ellipsis,
style: StreamChatTheme.of(
context)
.textTheme
.footnoteBold
.copyWith(
color: StreamChatTheme
.of(context)
.colorTheme
.grey),
),
],
),
),
),
Padding(
padding: const EdgeInsets.only(
right: 18.0, left: 8.0),
child: StreamSvgIcon.mentions(
color: StreamChatTheme.of(context)
.colorTheme
.accentBlue,
),
),
],
),
),
),
);
}),
},
).toList(),
SizedBox(
height: 8.0,
),
],
);
},
),
),
),
);
},
),
);
},
);
});
}
OverlayEntry _buildEmojiOverlay() {