Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// mobile/lib/livestream_channel.dart:51
Widget buildMessages() {
return Flexible(
child: ListView(
padding: EdgeInsets.all(10.0),
reverse: true,
children: _messages.reversed.map<Widget>(buildMessage).toList(),
),
);
}
Widget buildMessage(dynamic message) {
var isMyMessage = message['userId'] == widget.account['user'];
return Row(
mainAxisAlignment: isMyMessage ? MainAxisAlignment.end : MainAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Text(
message['text'],
style: TextStyle(color: isMyMessage ? Colors.white : Colors.black),
),
padding: EdgeInsets.fromLTRB(15.0, 10.0, 15.0, 10.0),
width: 200.0,
decoration: BoxDecoration(
color: isMyMessage ? Colors.blueAccent : Colors.black12, borderRadius: BorderRadius.circular(8.0)),
margin: EdgeInsets.only(right: 10.0),
),
Container(
margin: EdgeInsets.only(left: 15.0, top: 5.0, bottom: 10.0),
child: isMyMessage
? null
: Text(
message['userId'],
style: TextStyle(color: Colors.black54, fontSize: 10.0),
),
),
],
)
],
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.