change some expressions to IIFEs

This commit is contained in:
krawieck 2020-09-01 14:17:56 +02:00
parent 1c9848dced
commit f44c0f60a5
1 changed files with 26 additions and 23 deletions

View File

@ -25,30 +25,33 @@ class Comment extends StatelessWidget {
var comment = commentTree.comment;
// decide which username to use
var username;
final username = () {
if (comment.creatorPreferredUsername != null &&
comment.creatorPreferredUsername != '') {
username = comment.creatorPreferredUsername;
return comment.creatorPreferredUsername;
} else {
username = '@${comment.creatorName}';
return '@${comment.creatorName}';
}
}();
var body;
final body = () {
if (comment.deleted) {
body = Flexible(
return Flexible(
child: Text(
'comment deleted by creator',
style: TextStyle(fontStyle: FontStyle.italic),
));
} else if (comment.removed) {
body = Flexible(
return Flexible(
child: Text(
'comment deleted by moderator',
style: TextStyle(fontStyle: FontStyle.italic),
));
} else {
body = Flexible(child: MarkdownText(commentTree.comment.content));
return Flexible(child: MarkdownText(commentTree.comment.content));
}
}();
return Column(
children: [
Container(