bubble
bubble copied to clipboard
Dynamic list of bubbles
Hello,
I have the following code to implement a dynamic list of chat bubbles. The issue is that in the setState the bubbles are not redrawn. Could you please provide an example of dynamically generating bubbles.
Also, how do I autoscroll to the bottom that new bubbles are added?
Thank you.
List<Widget> bubbles = <Widget>[];
void onSomeEvent() {
setState(() {
bubbles.add(new Bubble(color: Colors.blue, child: new Text('Hello Bubble');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Quantum AI Scribe"),
),
body: Container(
color: Colors.black12,
child: ListView(
padding: const EdgeInsets.all(8),
children: bubbles,
),
)
);
}