Home > Software design >  Flutter message list voice record bug
Flutter message list voice record bug

Time:08-01

I have a chat application. Its working perfectly. I have reversed listview for show it. When i send message or photo its working so well. Sending audio is working perfectly too. But if i send audios repeatly its having strange bug.For example if i send 3 voice message repeatly and their seconds like first one is 2 seconds, second one is 5 seconds and third one is 10 seconds. Its just showing 2 seconds voices 3 times until i close and open chat detail again or until i scroll up on listview and scroll back. For make it clear some photos :

I record 9 seconds of voice and its sent and its working perfect . enter image description here

After that i recording 2 seconds of voice and sending it but.... enter image description here

If i scroll up on listview and scroll down :

enter image description here

Its fixing. How can i solve it ? Thanks for help!! This is how i put new audio to my list :

connection.value!.on("newMessage", (arguments) {
//Its coming from SignalR and model is coming true and inserting into my list.(GetX) (I using list reversed. )

  ChatDetailsModel model = ChatDetailsModel.fromJson(arguments![0]["data"]);
  messageList.value.insert(0, model);
  messageList.refresh();
});

CodePudding user response:

Add keys to voice widgets to help flutter distinguish them. For example:

MyVoiceWidget(key: ValueKey(chatMessageId));
  • Related