style: single quotes and package imports

This commit is contained in:
Rongjian Zhang 2022-09-19 01:02:57 +08:00
parent 8eda3e36c8
commit 5b7b465b09
42 changed files with 665 additions and 678 deletions

View File

@ -22,8 +22,8 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
prefer_single_quotes: true
always_use_package_imports: true
analyzer:
exclude:

View File

@ -18,10 +18,10 @@ import 'package:uni_links/uni_links.dart';
import 'package:universal_io/io.dart';
import 'package:url_launcher/url_launcher.dart';
import '../utils/utils.dart';
import 'account.dart';
import 'gitlab.dart';
import 'gogs.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/models/account.dart';
import 'package:git_touch/models/gitlab.dart';
import 'package:git_touch/models/gogs.dart';
const clientId = 'df930d7d2e219f26142a';

View File

@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart';
import 'package:git_touch/models/github.dart';
import 'package:tuple/tuple.dart';
import '../utils/utils.dart';
import 'package:git_touch/utils/utils.dart';
class NotificationGroup {
String? fullName;

View File

@ -3,9 +3,9 @@ import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
import '../widgets/error_reload.dart';
import '../widgets/link.dart';
import '../widgets/loading.dart';
import 'package:git_touch/widgets/error_reload.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/loading.dart';
class LongListPayload<T, K> {
T header;

View File

@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';

View File

@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/repository_item.dart';
import 'package:provider/provider.dart';

View File

@ -23,7 +23,7 @@ class BbIssueScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple2<BbIssues, Iterable<BbComment>>>(
title: Text("Issue: #$number"),
title: Text('Issue: #$number'),
fetch: () async {
final auth = context.read<AuthModel>();
final res = await Future.wait([

View File

@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/issue_item.dart';

View File

@ -4,7 +4,6 @@ import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/blob_view.dart';

View File

@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/issue_item.dart';
import 'package:provider/provider.dart';

View File

@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/bitbucket.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/user_item.dart';
import 'package:provider/provider.dart';

View File

@ -20,7 +20,7 @@ class GeCommitScreen extends StatelessWidget {
Widget build(BuildContext context) {
final theme = context.watch<ThemeModel>();
return RefreshStatefulScaffold<GiteeCommit>(
title: Text("Commit: ${sha.substring(0, 7)}"),
title: Text('Commit: ${sha.substring(0, 7)}'),
fetch: () async {
final auth = context.read<AuthModel>();
final items = await auth.fetchGitee('/repos/$owner/$name/commits/$sha');

View File

@ -3,7 +3,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/commit_item.dart';
import 'package:provider/provider.dart';

View File

@ -5,7 +5,6 @@ import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:provider/provider.dart';
@ -66,7 +65,7 @@ class GeContributorsScreen extends StatelessWidget {
color: theme.palette.secondaryText,
fontSize: 16,
),
child: Text("Contributions: ${v.contributions}"),
child: Text('Contributions: ${v.contributions}'),
),
],
),

View File

@ -4,7 +4,6 @@ import 'package:flutter_gen/gen_l10n/S.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_button.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/files_item.dart';

View File

@ -55,7 +55,7 @@ class GeIssueScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple2<GiteeIssue, List<GiteeComment>>>(
title: Text("Issue: #$number"),
title: Text('Issue: #$number'),
fetch: () async {
final auth = context.read<AuthModel>();
final items = await Future.wait([

View File

@ -2,7 +2,6 @@ import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/action_entry.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/hex_color_tag.dart';

View File

@ -57,7 +57,7 @@ class GePullScreen extends StatelessWidget {
return RefreshStatefulScaffold<
Tuple4<GiteePull, List<GiteeComment>, List<GiteePullFile>,
List<GiteeCommit>>>(
title: Text("Pull Request: #$number"),
title: Text('Pull Request: #$number'),
fetch: () async {
final auth = context.read<AuthModel>();
final items = await Future.wait([

View File

@ -2,7 +2,6 @@ import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/hex_color_tag.dart';
import 'package:git_touch/widgets/issue_item.dart';

View File

@ -2,7 +2,6 @@ import 'package:flutter/widgets.dart';
import 'package:git_touch/models/auth.dart';
import 'package:git_touch/models/gitee.dart';
import 'package:git_touch/scaffolds/list_stateful.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/repository_item.dart';
import 'package:provider/provider.dart';

View File

@ -15,7 +15,7 @@ class GeUsersScreen extends StatelessWidget {
title = 'Followers';
const GeUsersScreen.following(String login)
: api = '/users/$login/following',
title = "Following";
title = 'Following';
// GeUsersScreen.member(String login)
// : api = '/orgs/$login/members',
// title = "Members";

View File

@ -43,7 +43,7 @@ class GhComparisonScreen extends StatelessWidget {
additions: vs.additions,
deletions: vs.deletions,
status: vs.status,
patch: vs.patch ?? "No text to be shown here",
patch: vs.patch ?? 'No text to be shown here',
))
.toList(),
);

View File

@ -14,8 +14,8 @@ import 'package:github/github.dart' as github;
import 'package:primer/primer.dart';
import 'package:provider/provider.dart';
import '../scaffolds/long_list.dart';
import '../widgets/comment_item.dart';
import 'package:git_touch/scaffolds/long_list.dart';
import 'package:git_touch/widgets/comment_item.dart';
class GhIssueScreen extends StatelessWidget {
final String owner;

View File

@ -10,10 +10,10 @@ import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:github/github.dart';
import 'package:provider/provider.dart';
import '../utils/utils.dart';
import '../widgets/empty.dart';
import '../widgets/list_group.dart';
import '../widgets/notification_item.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/empty.dart';
import 'package:git_touch/widgets/list_group.dart';
import 'package:git_touch/widgets/notification_item.dart';
class GhNotificationScreen extends StatefulWidget {
@override

View File

@ -19,7 +19,7 @@ class GhReleasesScreen extends StatelessWidget {
Widget build(BuildContext context) {
return ListStatefulScaffold<GReleasesData_repository_releases_nodes,
String?>(
title: const AppBarTitle("Releases"),
title: const AppBarTitle('Releases'),
fetch: (page) async {
final req = GReleasesReq((b) => b
..vars.owner = owner

View File

@ -15,7 +15,7 @@ class GoUsersScreen extends StatelessWidget {
title = 'Followers';
const GoUsersScreen.following(String login)
: api = '/users/$login/following',
title = "Following";
title = 'Following';
@override
Widget build(BuildContext context) {

View File

@ -55,7 +55,7 @@ class GtIssueScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return RefreshStatefulScaffold<Tuple2<GiteaIssue, List<GiteaComment>>>(
title: Text("Issue: #$number"),
title: Text('Issue: #$number'),
fetch: () async {
final auth = context.read<AuthModel>();
final items = await Future.wait([

View File

@ -16,10 +16,10 @@ class GtUsersScreen extends StatelessWidget {
title = 'Followers';
const GtUsersScreen.following(String login)
: api = '/users/$login/following',
title = "Following";
title = 'Following';
const GtUsersScreen.member(String login)
: api = '/orgs/$login/members',
title = "Members";
title = 'Members';
const GtUsersScreen.stargazers(String owner, String repo)
: api = '/repos/$owner/$repo/stargazers',
title = 'Stargazers';

View File

@ -11,9 +11,9 @@ import 'package:git_touch/widgets/app_bar_title.dart';
import 'package:git_touch/widgets/text_field.dart';
import 'package:provider/provider.dart';
import '../widgets/avatar.dart';
import '../widgets/link.dart';
import '../widgets/loading.dart';
import 'package:git_touch/widgets/avatar.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/loading.dart';
class LoginScreen extends StatefulWidget {
@override

View File

@ -24,5 +24,5 @@ class DateTimeSerializer implements PrimitiveSerializer<DateTime> {
Iterable<Type> get types => [DateTime];
@override
String get wireName => "DateTime";
String get wireName => 'DateTime';
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_highlight/flutter_highlight.dart';
import 'package:flutter_highlight/theme_map.dart';
import 'package:git_touch/models/code.dart';

View File

@ -9,10 +9,10 @@ import 'package:primer/primer.dart';
import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
import '../utils/utils.dart';
import 'avatar.dart';
import 'link.dart';
import 'user_name.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/avatar.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/user_name.dart';
class EmojiPayload {
GReactionContent key;

View File

@ -53,7 +53,7 @@ class ContributorItem extends StatelessWidget {
color: theme.palette.secondaryText,
fontSize: 16,
),
child: Text("Commits: $commits"),
child: Text('Commits: $commits'),
),
],
),

View File

@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:provider/provider.dart';
import 'link.dart';
import 'package:git_touch/widgets/link.dart';
class EntryItem extends StatelessWidget {
final int? count;

View File

@ -8,9 +8,9 @@ import 'package:git_touch/widgets/issue_icon.dart';
import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
import '../utils/utils.dart';
import '../widgets/link.dart';
import 'avatar.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:git_touch/widgets/avatar.dart';
class EventItem extends StatelessWidget {
final GithubEvent e;
@ -309,7 +309,7 @@ class EventItem extends StatelessWidget {
]);
case 'CheckSuiteEvent':
// Needs checks permission
String conclusion = "";
String conclusion = '';
switch (e.payload!.checkSuite!.conclusion) {
case 'success':
case 'failure':
@ -388,22 +388,22 @@ class EventItem extends StatelessWidget {
],
);
case 'GollumEvent':
String pageNamesCreated = "";
String pageNamesEdited = "";
String pageNamesCreated = '';
String pageNamesEdited = '';
for (GithubPagesItem page in e.payload!.pages!) {
if (page.action == "edited") {
pageNamesEdited += ", ${page.pageName!}";
if (page.action == 'edited') {
pageNamesEdited += ', ${page.pageName!}';
} else {
pageNamesCreated += ", ${page.pageName!}";
pageNamesCreated += ', ${page.pageName!}';
}
}
if (pageNamesCreated.isNotEmpty) {
pageNamesCreated =
" ${AppLocalizations.of(context)!.createdPages(pageNamesCreated)}";
' ${AppLocalizations.of(context)!.createdPages(pageNamesCreated)}';
}
if (pageNamesEdited.isNotEmpty) {
pageNamesEdited =
" ${AppLocalizations.of(context)!.editedPages(pageNamesEdited)}";
' ${AppLocalizations.of(context)!.editedPages(pageNamesEdited)}';
}
return _buildItem(
@ -427,22 +427,22 @@ class EventItem extends StatelessWidget {
e.payload!.installation!.repositoriesAdded!;
List<GithubNotificationItemRepo> repositoriesRemoved =
e.payload!.installation!.repositoriesRemoved!;
String addedRepos = "";
String removedRepos = "";
String addedRepos = '';
String removedRepos = '';
for (GithubNotificationItemRepo repo in repositoriesAdded) {
addedRepos += "${repo.fullName!}, ";
addedRepos += '${repo.fullName!}, ';
}
for (GithubNotificationItemRepo repo in repositoriesRemoved) {
removedRepos += "${repo.fullName!}, ";
removedRepos += '${repo.fullName!}, ';
}
String finalListOfRepos = "";
if (addedRepos != "") {
String finalListOfRepos = '';
if (addedRepos != '') {
finalListOfRepos +=
"${AppLocalizations.of(context)!.wereAddedTo(addedRepos, e.payload!.installation!.id.toString())}\n ";
'${AppLocalizations.of(context)!.wereAddedTo(addedRepos, e.payload!.installation!.id.toString())}\n ';
}
if (removedRepos != "") {
if (removedRepos != '') {
finalListOfRepos +=
"$removedRepos ${AppLocalizations.of(context)!.wereRemovedFrom(removedRepos, e.payload!.installation!.id.toString())}";
'$removedRepos ${AppLocalizations.of(context)!.wereRemovedFrom(removedRepos, e.payload!.installation!.id.toString())}';
}
return _buildItem(
context: context,
@ -490,23 +490,23 @@ class EventItem extends StatelessWidget {
final action = e.payload!.action;
var messageToDisplay;
switch (action) {
case "purchased":
case 'purchased':
messageToDisplay =
AppLocalizations.of(context)!.purchasedMarketplacePlan;
break;
case "cancelled":
case 'cancelled':
messageToDisplay =
AppLocalizations.of(context)!.cancelledMarketplacePlan;
break;
case "pending_change":
case 'pending_change':
messageToDisplay =
AppLocalizations.of(context)!.pendingMarketplacePlan;
break;
case "pending_change_cancelled":
case 'pending_change_cancelled':
messageToDisplay =
AppLocalizations.of(context)!.pendingChangeCancelled;
break;
case "changed":
case 'changed':
messageToDisplay =
AppLocalizations.of(context)!.changedMarketplacePlan;
break;

View File

@ -23,7 +23,7 @@ class _HtmlViewState extends State<HtmlView> {
updateHeight() async {
final value = await controller
.runJavascriptReturningResult("document.documentElement.scrollHeight;");
.runJavascriptReturningResult('document.documentElement.scrollHeight;');
// print(value);
if (mounted) {
setState(() {

View File

@ -4,8 +4,8 @@ import 'package:git_touch/widgets/avatar.dart';
import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
import '../utils/utils.dart';
import '../widgets/link.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/link.dart';
const issueGqlChunk = '''
url

View File

@ -1,8 +1,8 @@
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import '../models/theme.dart';
import '../widgets/empty.dart';
import 'package:git_touch/models/theme.dart';
import 'package:git_touch/widgets/empty.dart';
class ListGroup<T> extends StatelessWidget {
final Widget title;

View File

@ -6,7 +6,7 @@ import 'package:git_touch/widgets/issue_icon.dart';
import 'package:git_touch/widgets/link.dart';
import 'package:provider/provider.dart';
import '../models/theme.dart';
import 'package:git_touch/models/theme.dart';
class NotificationItem extends StatefulWidget {
final GithubNotificationItem payload;

View File

@ -62,7 +62,7 @@ class ReleaseItem extends StatelessWidget {
fontSize: 16,
),
child: Text(
"${login!} ${AppLocalizations.of(context)!.released} ${timeago.format(publishedAt!)}"),
'${login!} ${AppLocalizations.of(context)!.released} ${timeago.format(publishedAt!)}'),
),
],
),

View File

@ -8,8 +8,8 @@ import 'package:git_touch/models/theme.dart';
import 'package:git_touch/widgets/hex_color_tag.dart';
import 'package:provider/provider.dart';
import '../utils/utils.dart';
import 'comment_item.dart';
import 'package:git_touch/utils/utils.dart';
import 'package:git_touch/widgets/comment_item.dart';
TextSpan createUserSpan(BuildContext context, String? login) {
return createLinkSpan(context, login, '/github/$login');