use listview.builder

This commit is contained in:
Salvatore Giordano
2020-11-05 16:12:54 +01:00
parent 3a5ae9af01
commit 7de9206e60
+41 -36
View File
@@ -714,44 +714,49 @@ class MessageInputState extends State<MessageInput> {
], ],
color: StreamChatTheme.of(context).primaryColor, color: StreamChatTheme.of(context).primaryColor,
), ),
child: ListView( child: ListView.builder(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
shrinkWrap: true, shrinkWrap: true,
children: [ itemCount: emojis.length + 1,
Padding( itemBuilder: (context, i) {
padding: const EdgeInsets.only(left: 8.0, top: 8.0), if (i == 0) {
child: Row( return Padding(
children: [ padding: const EdgeInsets.only(left: 8.0, top: 8.0),
Padding( child: Row(
padding: const EdgeInsets.symmetric(horizontal: 8.0), children: [
child: Icon( Padding(
StreamIcons.smile, padding:
color: StreamChatTheme.of(context).accentColor, const EdgeInsets.symmetric(horizontal: 8.0),
), child: Icon(
StreamIcons.smile,
color: StreamChatTheme.of(context).accentColor,
),
),
Text(
'Emoji matching "$query"',
style: TextStyle(
color: Colors.black.withOpacity(.5),
),
)
],
), ),
Text( );
'Emoji matching "$query"', }
style: TextStyle(
color: Colors.black.withOpacity(.5), final emoji = emojis[i - 1];
), return ListTile(
) title: Text(
], "${emoji.char} ${emoji.name.replaceAll('_', ' ')}",
), style: TextStyle(
), fontWeight: FontWeight.bold,
...emojis.map((emoji) => ListTile( fontSize: 14.5,
title: Text(
"${emoji.char} ${emoji.name.replaceAll('_', ' ')}",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.5,
),
), ),
onTap: () { ),
_chooseEmoji(splits, emoji); onTap: () {
}, _chooseEmoji(splits, emoji);
)) },
], );
), }),
), ),
), ),
); );