mirror of
https://github.com/git-touch/git-touch
synced 2024-12-16 18:28:51 +01:00
refactor: with collection if
This commit is contained in:
parent
2d6c8871f3
commit
8e024a2b5d
@ -115,12 +115,10 @@ class CommitsScreen extends StatelessWidget {
|
||||
DateTime.parse(payload['committedDate'])),
|
||||
style: TextStyle(
|
||||
color: PrimerColors.gray600, fontSize: 14)),
|
||||
...(payload['status'] == null
|
||||
? []
|
||||
: [
|
||||
SizedBox(width: 4),
|
||||
_buildStatus(payload['status']['state'])
|
||||
])
|
||||
if (payload['status'] != null) ...[
|
||||
SizedBox(width: 4),
|
||||
_buildStatus(payload['status']['state'])
|
||||
],
|
||||
],
|
||||
)
|
||||
],
|
||||
|
@ -101,15 +101,12 @@ class EventItem extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
...(detailWidget == null
|
||||
? []
|
||||
: [
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: PrimerColors.gray500, fontSize: 14),
|
||||
child: detailWidget,
|
||||
)
|
||||
]),
|
||||
if (detailWidget != null)
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: PrimerColors.gray500, fontSize: 14),
|
||||
child: detailWidget,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Icon(iconData, color: PrimerColors.gray700, size: 13),
|
||||
|
@ -114,7 +114,7 @@ class RepoItem extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
color: PrimerColors.gray700, fontSize: 14),
|
||||
),
|
||||
...(inRepoScreen ? [] : [_buildStatus()])
|
||||
if (!inRepoScreen) _buildStatus(),
|
||||
]),
|
||||
),
|
||||
),
|
||||
|
@ -43,12 +43,10 @@ class TableView extends StatelessWidget {
|
||||
var widget = Container(
|
||||
height: 44,
|
||||
child: Row(children: [
|
||||
...(item.leftWidget == null
|
||||
? []
|
||||
: [
|
||||
SizedBox(width: 12),
|
||||
item.leftWidget,
|
||||
]),
|
||||
if (item.leftWidget != null) ...[
|
||||
SizedBox(width: 12),
|
||||
item.leftWidget,
|
||||
],
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: DefaultTextStyle(
|
||||
@ -56,7 +54,7 @@ class TableView extends StatelessWidget {
|
||||
style: TextStyle(fontSize: 16, color: PrimerColors.gray900),
|
||||
),
|
||||
),
|
||||
...(item.rightWidget == null ? [] : [item.rightWidget]),
|
||||
if (item.rightWidget != null) item.rightWidget,
|
||||
SizedBox(width: 12),
|
||||
]),
|
||||
);
|
||||
@ -76,18 +74,15 @@ class TableView extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
...(headerText == null
|
||||
? []
|
||||
: [
|
||||
Container(
|
||||
color: PrimerColors.gray100,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: Text(
|
||||
headerText,
|
||||
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
||||
),
|
||||
)
|
||||
]),
|
||||
if (headerText != null)
|
||||
Container(
|
||||
color: PrimerColors.gray100,
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: Text(
|
||||
headerText,
|
||||
style: TextStyle(color: PrimerColors.gray600, fontSize: 13),
|
||||
),
|
||||
),
|
||||
_border,
|
||||
...join(_seperator, items.map(_buildItem).toList()),
|
||||
_border,
|
||||
|
Loading…
Reference in New Issue
Block a user