I'm working on a simple chatscreen UI in Flutter. There's a user-defined widget MessageBubble that accepts three parameters: sender (String), text (String), isMe (bool). Currently it is being passed static values one by one, like this:
List<MessageBubble> messages = [
MessageBubble(
sender: "Me",
text: "Hi!",
isMe: true,
),
MessageBubble(
sender: "Not Me",
text: "Hey, hi!",
isMe: false,
),
];
What I want to do instead, is I've created a class BubbleData like this:
class BubbleData {
List <String> sender = ['Not Me', 'Not Me'];
List <String> text = ['Hey Hi', "What's new?"];
List <bool> isMe = [false, false];
}
Now the problem at hand lies that how do I iterate these listitems through the MessageBubble using a ListView builder?