style: apply dartfmt

This commit is contained in:
Rongjian Zhang 2020-04-16 11:36:48 +08:00
parent b088ccaae7
commit 129505947e
8 changed files with 155 additions and 167 deletions

View File

@ -26,7 +26,6 @@ class Home extends StatefulWidget {
} }
class _HomeState extends State<Home> { class _HomeState extends State<Home> {
// Created 5 different variables instead of a list as list doesn't work // Created 5 different variables instead of a list as list doesn't work
final GlobalKey<NavigatorState> tab1 = GlobalKey<NavigatorState>(); final GlobalKey<NavigatorState> tab1 = GlobalKey<NavigatorState>();
final GlobalKey<NavigatorState> tab2 = GlobalKey<NavigatorState>(); final GlobalKey<NavigatorState> tab2 = GlobalKey<NavigatorState>();
@ -213,7 +212,9 @@ class _HomeState extends State<Home> {
case AppThemeType.cupertino: case AppThemeType.cupertino:
return WillPopScope( return WillPopScope(
onWillPop: () async { onWillPop: () async {
return !await getNavigatorKey(_controller.index).currentState.maybePop(); return !await getNavigatorKey(_controller.index)
.currentState
.maybePop();
}, },
child: CupertinoTabScaffold( child: CupertinoTabScaffold(
controller: _controller, controller: _controller,
@ -222,19 +223,18 @@ class _HomeState extends State<Home> {
navigatorKey: getNavigatorKey(index), navigatorKey: getNavigatorKey(index),
builder: (context) { builder: (context) {
return _buildScreen(index); return _buildScreen(index);
} });
);
}, },
tabBar: CupertinoTabBar(items: _navigationItems, tabBar: CupertinoTabBar(
items: _navigationItems,
onTap: (index) { onTap: (index) {
if (active == index) { if (active == index) {
getNavigatorKey(index).currentState.popUntil((route) => route.isFirst); getNavigatorKey(index)
.currentState
.popUntil((route) => route.isFirst);
} }
active = index; active = index;
} })));
)
)
);
default: default:
return Scaffold( return Scaffold(
body: _buildScreen(active), body: _buildScreen(active),

View File

@ -269,7 +269,8 @@ class GithubInstallationRepositoriesItem {
String repositoriesSelection; String repositoriesSelection;
int id; int id;
GithubInstallationRepositoriesItem(); GithubInstallationRepositoriesItem();
factory GithubInstallationRepositoriesItem.fromJson(Map<String, dynamic> json) => factory GithubInstallationRepositoriesItem.fromJson(
Map<String, dynamic> json) =>
_$GithubInstallationRepositoriesItemFromJson(json); _$GithubInstallationRepositoriesItemFromJson(json);
} }
@ -300,4 +301,3 @@ class GithubContentReferenceItem {
factory GithubContentReferenceItem.fromJson(Map<String, dynamic> json) => factory GithubContentReferenceItem.fromJson(Map<String, dynamic> json) =>
_$GithubContentReferenceItemFromJson(json); _$GithubContentReferenceItemFromJson(json);
} }

View File

@ -68,8 +68,7 @@ class GhTrendingScreen extends StatelessWidget {
color: theme.palette.secondaryText, color: theme.palette.secondaryText,
), ),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
) ))
)
], ],
), ),
), ),

View File

@ -257,12 +257,11 @@ class EventItem extends StatelessWidget {
// https://developer.github.com/v3/activity/events/types/#event-types--payloads // https://developer.github.com/v3/activity/events/types/#event-types--payloads
switch (e.type) { switch (e.type) {
case 'CheckRunEvent': case 'CheckRunEvent':
return _buildItem( return _buildItem(context: context, spans: [
context: context, TextSpan(
spans: [ text:
TextSpan(text: ' ${e.payload.action} a check run for ${e.payload.checkRun.name} '), ' ${e.payload.action} a check run for ${e.payload.checkRun.name} '),
] ]);
);
case 'CheckSuiteEvent': case 'CheckSuiteEvent':
// Needs checks permission // Needs checks permission
String conclusion = ""; String conclusion = "";
@ -284,7 +283,9 @@ class EventItem extends StatelessWidget {
return _buildItem( return _buildItem(
context: context, context: context,
spans: [ spans: [
TextSpan(text: ' ${e.payload.action} the check suite and the conclusion is that $conclusion'), TextSpan(
text:
' ${e.payload.action} the check suite and the conclusion is that $conclusion'),
], ],
); );
case 'CommitCommentEvent': case 'CommitCommentEvent':
@ -298,20 +299,16 @@ class EventItem extends StatelessWidget {
card: _buildCommitsCard(context), card: _buildCommitsCard(context),
); );
case 'ContentReferenceEvent': case 'ContentReferenceEvent':
return _buildItem( return _buildItem(context: context, spans: [
context: context,
spans: [
TextSpan(text: ' ${e.payload.action} a content reference at '), TextSpan(text: ' ${e.payload.action} a content reference at '),
_buildLinkSpan( _buildLinkSpan(context, e.payload.contentReference.reference,
context, e.payload.contentReference.reference, e.payload.contentReference.reference), e.payload.contentReference.reference),
] ]);
);
case 'CreateEvent': case 'CreateEvent':
return _buildItem( return _buildItem(
context: context, context: context,
spans: <InlineSpan>[ spans: <InlineSpan>[
TextSpan( TextSpan(text: ' created a ${e.payload.refType} '),
text: ' created a ${e.payload.refType} '),
_buildRepo(context), _buildRepo(context),
], ],
); );
@ -319,9 +316,7 @@ class EventItem extends StatelessWidget {
return _buildItem( return _buildItem(
context: context, context: context,
spans: <InlineSpan>[ spans: <InlineSpan>[
TextSpan( TextSpan(text: ' deleted ${e.payload.refType} '),
text: ' deleted ${e.payload.refType} '
),
_buildRepo(context), _buildRepo(context),
], ],
); );
@ -356,12 +351,7 @@ class EventItem extends StatelessWidget {
return _buildItem( return _buildItem(
context: context, context: context,
spans: [ spans: [TextSpan(text: ' $pageNamesCreated\n$pageNamesEdited ')]);
TextSpan(
text: ' $pageNamesCreated\n$pageNamesEdited '
)
]
);
case 'InstallationEvent': case 'InstallationEvent':
String action = e.payload.action; String action = e.payload.action;
if (action == 'new_permissions_accepted') { if (action == 'new_permissions_accepted') {
@ -370,12 +360,16 @@ class EventItem extends StatelessWidget {
return _buildItem( return _buildItem(
context: context, context: context,
spans: [ spans: [
TextSpan(text: ' $action for the Github App with id ${e.payload.installation.id}'), TextSpan(
text:
' $action for the Github App with id ${e.payload.installation.id}'),
], ],
); );
case 'InstallationRepositoriesEvent': case 'InstallationRepositoriesEvent':
List<GithubNotificationItemRepo> repositoriesAdded = e.payload.installation.repositoriesAdded; List<GithubNotificationItemRepo> repositoriesAdded =
List<GithubNotificationItemRepo> repositoriesRemoved = e.payload.installation.repositoriesRemoved; e.payload.installation.repositoriesAdded;
List<GithubNotificationItemRepo> repositoriesRemoved =
e.payload.installation.repositoriesRemoved;
String addedRepos = ""; String addedRepos = "";
String removedRepos = ""; String removedRepos = "";
for (GithubNotificationItemRepo repo in repositoriesAdded) { for (GithubNotificationItemRepo repo in repositoriesAdded) {
@ -394,7 +388,9 @@ class EventItem extends StatelessWidget {
return _buildItem( return _buildItem(
context: context, context: context,
spans: [ spans: [
TextSpan(text: ' $finalListOfRepos the installation id ${e.payload.installation.id} '), TextSpan(
text:
' $finalListOfRepos the installation id ${e.payload.installation.id} '),
], ],
); );
case 'IssueCommentEvent': case 'IssueCommentEvent':
@ -463,11 +459,11 @@ class EventItem extends StatelessWidget {
case 'MemberEvent': case 'MemberEvent':
final action = e.payload.action; final action = e.payload.action;
return _buildItem( return _buildItem(
context: context, context: context,
spans: [ spans: [
TextSpan( TextSpan(
text: ' was ${e.payload.action} ${action == 'added' ? 'to' : 'from' } '), text:
' was ${e.payload.action} ${action == 'added' ? 'to' : 'from'} '),
_buildRepo(context), _buildRepo(context),
], ],
); );
@ -486,20 +482,18 @@ class EventItem extends StatelessWidget {
], ],
); );
case 'ProjectColumnEvent': case 'ProjectColumnEvent':
return _buildItem( return _buildItem(context: context, spans: [
context: context, TextSpan(
spans: [ text:
TextSpan(text: ' ${e.payload.action} the project column ${e.payload.projectColumn.name} at '), ' ${e.payload.action} the project column ${e.payload.projectColumn.name} at '),
_buildRepo(context), _buildRepo(context),
] ]);
);
case 'ProjectEvent': case 'ProjectEvent':
return _buildItem( return _buildItem(context: context, spans: [
context: context, TextSpan(
spans: [ text:
TextSpan(text: ' ${e.payload.action} the project ${e.payload.project.name} '), ' ${e.payload.action} the project ${e.payload.project.name} '),
] ]);
);
case 'PublicEvent': case 'PublicEvent':
return _buildItem( return _buildItem(
context: context, context: context,
@ -523,15 +517,12 @@ class EventItem extends StatelessWidget {
); );
case 'PullRequestReviewEvent': case 'PullRequestReviewEvent':
final pr = e.payload.pullRequest; final pr = e.payload.pullRequest;
return _buildItem( return _buildItem(context: context, spans: [
context: context,
spans: [
TextSpan(text: ' ${e.payload.action} the pull request review '), TextSpan(text: ' ${e.payload.action} the pull request review '),
_buildIssue(context, pr.number, isPullRequest: true), _buildIssue(context, pr.number, isPullRequest: true),
TextSpan(text: ' at '), TextSpan(text: ' at '),
_buildRepo(context), _buildRepo(context),
] ]);
);
case 'PullRequestReviewCommentEvent': case 'PullRequestReviewCommentEvent':
final pr = e.payload.pullRequest; final pr = e.payload.pullRequest;
return _buildItem( return _buildItem(
@ -565,23 +556,19 @@ class EventItem extends StatelessWidget {
// case 'RepositoryImportEvent': // case 'RepositoryImportEvent':
// // Uses Source Imports API // // Uses Source Imports API
case 'RepositoryVulnerabilityAlertEvent': case 'RepositoryVulnerabilityAlertEvent':
return _buildItem( return _buildItem(context: context, spans: [
context: context,
spans: [
TextSpan( TextSpan(
text: ' Security alert involving the package ${e.payload.alert.affectedPackageName} between versions ${e.payload.alert.affectedRange} was {e.payload.action}ed', text:
' Security alert involving the package ${e.payload.alert.affectedPackageName} between versions ${e.payload.alert.affectedRange} was {e.payload.action}ed',
) )
] ]);
);
case 'SecurityAdvisoryEvent': case 'SecurityAdvisoryEvent':
return _buildItem( return _buildItem(context: context, spans: [
context: context,
spans: [
TextSpan( TextSpan(
text: ' Security advisory regarding ${e.payload.securityAdvisory.summary} was ${e.payload.action} ', text:
' Security advisory regarding ${e.payload.securityAdvisory.summary} was ${e.payload.action} ',
) )
] ]);
);
case 'WatchEvent': case 'WatchEvent':
return _buildItem( return _buildItem(
context: context, context: context,

View File

@ -274,7 +274,9 @@ class TimelineItem extends StatelessWidget {
actor: p['actor']['login'], actor: p['actor']['login'],
textSpan: TextSpan( textSpan: TextSpan(
children: [ children: [
TextSpan(text: ' transferred this issue from ' + p['fromRepository']['name']) TextSpan(
text: ' transferred this issue from ' +
p['fromRepository']['name'])
], ],
), ),
); );
@ -321,12 +323,15 @@ class TimelineItem extends StatelessWidget {
case 'DeployedEvent': case 'DeployedEvent':
return TimelineEventItem( return TimelineEventItem(
actor: p['actor']['login'], actor: p['actor']['login'],
textSpan: TextSpan(text: ' deployed the pull request ' + p['pullRequest']['name']), textSpan: TextSpan(
text: ' deployed the pull request ' + p['pullRequest']['name']),
); );
case 'DeploymentEnvironmentChangedEvent': case 'DeploymentEnvironmentChangedEvent':
return TimelineEventItem( return TimelineEventItem(
actor: p['actor']['login'], actor: p['actor']['login'],
textSpan: TextSpan(text: ' changed the deployment environment to ' + p['deploymentStatus']['deployment']['environment']), textSpan: TextSpan(
text: ' changed the deployment environment to ' +
p['deploymentStatus']['deployment']['environment']),
); );
case 'HeadRefDeletedEvent': case 'HeadRefDeletedEvent':
return TimelineEventItem( return TimelineEventItem(
@ -342,15 +347,12 @@ class TimelineItem extends StatelessWidget {
case 'HeadRefRestoredEvent': case 'HeadRefRestoredEvent':
return TimelineEventItem( return TimelineEventItem(
actor: p['actor']['login'], actor: p['actor']['login'],
textSpan: TextSpan( textSpan: TextSpan(children: [
children: [
TextSpan(text: ' restored the '), TextSpan(text: ' restored the '),
WidgetSpan( WidgetSpan(
child: PrimerBranchName(p['pullRequest']['headRef']['name']) child: PrimerBranchName(p['pullRequest']['headRef']['name'])),
),
TextSpan(text: ' branch') TextSpan(text: ' branch')
] ]),
),
); );
case 'HeadRefForcePushedEvent': case 'HeadRefForcePushedEvent':
return TimelineEventItem( return TimelineEventItem(