change some expressions to IIFEs
This commit is contained in:
parent
1c9848dced
commit
f44c0f60a5
|
@ -25,30 +25,33 @@ class Comment extends StatelessWidget {
|
||||||
var comment = commentTree.comment;
|
var comment = commentTree.comment;
|
||||||
|
|
||||||
// decide which username to use
|
// decide which username to use
|
||||||
var username;
|
final username = () {
|
||||||
if (comment.creatorPreferredUsername != null &&
|
if (comment.creatorPreferredUsername != null &&
|
||||||
comment.creatorPreferredUsername != '') {
|
comment.creatorPreferredUsername != '') {
|
||||||
username = comment.creatorPreferredUsername;
|
return comment.creatorPreferredUsername;
|
||||||
} else {
|
} else {
|
||||||
username = '@${comment.creatorName}';
|
return '@${comment.creatorName}';
|
||||||
}
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
final body = () {
|
||||||
|
if (comment.deleted) {
|
||||||
|
return Flexible(
|
||||||
|
child: Text(
|
||||||
|
'comment deleted by creator',
|
||||||
|
style: TextStyle(fontStyle: FontStyle.italic),
|
||||||
|
));
|
||||||
|
} else if (comment.removed) {
|
||||||
|
return Flexible(
|
||||||
|
child: Text(
|
||||||
|
'comment deleted by moderator',
|
||||||
|
style: TextStyle(fontStyle: FontStyle.italic),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
return Flexible(child: MarkdownText(commentTree.comment.content));
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
var body;
|
|
||||||
if (comment.deleted) {
|
|
||||||
body = Flexible(
|
|
||||||
child: Text(
|
|
||||||
'comment deleted by creator',
|
|
||||||
style: TextStyle(fontStyle: FontStyle.italic),
|
|
||||||
));
|
|
||||||
} else if (comment.removed) {
|
|
||||||
body = Flexible(
|
|
||||||
child: Text(
|
|
||||||
'comment deleted by moderator',
|
|
||||||
style: TextStyle(fontStyle: FontStyle.italic),
|
|
||||||
));
|
|
||||||
} else {
|
|
||||||
body = Flexible(child: MarkdownText(commentTree.comment.content));
|
|
||||||
}
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
|
|
Loading…
Reference in New Issue