diff --git a/lib/screens/commits.dart b/lib/screens/commits.dart index 2267c0b..b6b95cd 100644 --- a/lib/screens/commits.dart +++ b/lib/screens/commits.dart @@ -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']) + ], ], ) ], diff --git a/lib/widgets/event_item.dart b/lib/widgets/event_item.dart index 75ff21e..9bae941 100644 --- a/lib/widgets/event_item.dart +++ b/lib/widgets/event_item.dart @@ -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: [ Icon(iconData, color: PrimerColors.gray700, size: 13), diff --git a/lib/widgets/repo_item.dart b/lib/widgets/repo_item.dart index 0cd9562..dcaf335 100644 --- a/lib/widgets/repo_item.dart +++ b/lib/widgets/repo_item.dart @@ -114,7 +114,7 @@ class RepoItem extends StatelessWidget { style: TextStyle( color: PrimerColors.gray700, fontSize: 14), ), - ...(inRepoScreen ? [] : [_buildStatus()]) + if (!inRepoScreen) _buildStatus(), ]), ), ), diff --git a/lib/widgets/table_view.dart b/lib/widgets/table_view.dart index 4792615..77fb845 100644 --- a/lib/widgets/table_view.dart +++ b/lib/widgets/table_view.dart @@ -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: [ - ...(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,