refactor: list prop update
This commit is contained in:
parent
e8eb860222
commit
988cdbfe45
|
@ -58,15 +58,15 @@ class BbRepoScreen extends StatelessWidget {
|
|||
),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
extra: Text(filesize(p.size)),
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/bitbucket/$owner/$name/src/${branch ?? p.mainbranch!.name}');
|
||||
},
|
||||
child: const Text('Code'),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
|
@ -92,7 +92,6 @@ class BbRepoScreen extends StatelessWidget {
|
|||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${(branch ?? p.mainbranch!.name)!} • ${branches.length}'),
|
||||
onClick: () async {
|
||||
|
@ -115,6 +114,7 @@ class BbRepoScreen extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -46,9 +46,8 @@ class MyApp extends StatelessWidget {
|
|||
CommonStyle.verticalGap,
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.fontStyle),
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.fontSize),
|
||||
extra: Text(codeProvider.fontSize.toString()),
|
||||
onClick: () {
|
||||
theme.showPicker(
|
||||
|
@ -65,9 +64,9 @@ class MyApp extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.fontSize),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.fontFamily),
|
||||
extra: Text(codeProvider.fontFamily),
|
||||
onClick: () {
|
||||
theme.showPicker(
|
||||
|
@ -83,15 +82,15 @@ class MyApp extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.fontFamily),
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.syntaxHighlighting),
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.light),
|
||||
extra: Text(codeProvider.theme),
|
||||
onClick: () {
|
||||
theme.showPicker(
|
||||
|
@ -107,9 +106,9 @@ class MyApp extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.light),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.dark),
|
||||
extra: Text(codeProvider.themeDark),
|
||||
onClick: () {
|
||||
theme.showPicker(
|
||||
|
@ -125,6 +124,7 @@ class MyApp extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.dark),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -134,23 +134,23 @@ class GeRepoScreen extends StatelessWidget {
|
|||
),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
extra: Text(p.license ?? ''),
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitee/$owner/$name/tree/${branch ?? p.defaultBranch}');
|
||||
},
|
||||
child: const Text('Code'),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: const Text('Issues'),
|
||||
extra: Text(numberFormat.format(p.openIssuesCount)),
|
||||
onClick: () {
|
||||
context.push('/gitee/$owner/$name/issues');
|
||||
},
|
||||
child: const Text('Issues'),
|
||||
),
|
||||
if (p.pullRequestsEnabled!)
|
||||
AntListItem(
|
||||
|
@ -170,7 +170,6 @@ class GeRepoScreen extends StatelessWidget {
|
|||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${(branch ?? p.defaultBranch)!} • ${branches.length}'),
|
||||
onClick: () async {
|
||||
|
@ -193,6 +192,7 @@ class GeRepoScreen extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.organization),
|
||||
|
|
|
@ -32,7 +32,7 @@ class GeTreeScreen extends StatelessWidget {
|
|||
},
|
||||
bodyBuilder: (data, _) {
|
||||
return AntList(
|
||||
items: [
|
||||
children: [
|
||||
for (var item in data)
|
||||
createObjectTreeItem(
|
||||
type: item.type,
|
||||
|
|
|
@ -32,7 +32,7 @@ class GhGistsFilesScreen extends StatelessWidget {
|
|||
},
|
||||
bodyBuilder: (payload, _) {
|
||||
return AntList(
|
||||
items: payload!.files!.map((v) {
|
||||
children: payload!.files!.map((v) {
|
||||
final uri = Uri(
|
||||
path: '/github/$login/gists/$id/${v.name}',
|
||||
queryParameters: {
|
||||
|
|
|
@ -21,10 +21,10 @@ class GhMetaScreen extends StatelessWidget {
|
|||
},
|
||||
bodyBuilder: (meta, _) {
|
||||
return AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
child: const Text('Service SHA'),
|
||||
extra: Text(meta.gitHubServicesSha),
|
||||
child: const Text('Service SHA'),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -60,7 +60,7 @@ class GhObjectScreen extends StatelessWidget {
|
|||
bodyBuilder: (data, _) {
|
||||
if (data.isDirectory) {
|
||||
return AntList(
|
||||
items: data.tree!.map((v) {
|
||||
children: data.tree!.map((v) {
|
||||
// if (item.type == 'commit') return null;
|
||||
final uri = Uri(
|
||||
path: '/github/$owner/$name/blob/$ref',
|
||||
|
|
|
@ -241,11 +241,10 @@ class GhRepoScreen extends StatelessWidget {
|
|||
]),
|
||||
],
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
if (ref != null)
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: Text(repo.primaryLanguage?.name ?? 'Code'),
|
||||
extra: Text(
|
||||
(license == null ? '' : '$license • ') +
|
||||
filesize(repo.diskUsage! * 1000),
|
||||
|
@ -253,39 +252,39 @@ class GhRepoScreen extends StatelessWidget {
|
|||
onClick: () {
|
||||
context.push('/github/$owner/$name/blob/${ref.name}');
|
||||
},
|
||||
child: Text(repo.primaryLanguage?.name ?? 'Code'),
|
||||
),
|
||||
if (repo.hasIssuesEnabled)
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: Text(AppLocalizations.of(context)!.issues),
|
||||
extra: Text(numberFormat.format(repo.issues.totalCount)),
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/issues');
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.issues),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: Text(AppLocalizations.of(context)!.pullRequests),
|
||||
extra:
|
||||
Text(numberFormat.format(repo.pullRequests.totalCount)),
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/pulls');
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.pullRequests),
|
||||
),
|
||||
if (ref != null) ...[
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: Text(AppLocalizations.of(context)!.commits),
|
||||
extra: Text(((ref.target as GRepoCommit).history.totalCount)
|
||||
.toString()),
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/commits/${ref.name}');
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.commits),
|
||||
),
|
||||
if (repo.refs != null)
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${ref.name} • ${numberFormat.format(repo.refs!.totalCount)}'),
|
||||
onClick: () async {
|
||||
|
@ -309,10 +308,10 @@ class GhRepoScreen extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.organization),
|
||||
child: Text(AppLocalizations.of(context)!.contributors),
|
||||
extra: FutureBuilder<int>(
|
||||
future: contributionFuture,
|
||||
builder: (context, snapshot) {
|
||||
|
@ -322,14 +321,15 @@ class GhRepoScreen extends StatelessWidget {
|
|||
onClick: () {
|
||||
context.push('/github/$owner/$name/contributors');
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.contributors),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.book),
|
||||
child: Text(AppLocalizations.of(context)!.releases),
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/releases');
|
||||
},
|
||||
extra: Text(repo.releases.totalCount.toString()),
|
||||
child: Text(AppLocalizations.of(context)!.releases),
|
||||
),
|
||||
],
|
||||
],
|
||||
|
|
|
@ -24,7 +24,6 @@ import 'package:go_router/go_router.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
|
||||
class _Repos extends StatelessWidget {
|
||||
|
||||
_Repos(final Iterable<GRepoParts> pinned, final Iterable<GRepoParts>? repos)
|
||||
: title =
|
||||
pinned.isNotEmpty ? 'pinned repositories' : 'popular repositories',
|
||||
|
@ -120,7 +119,7 @@ class _User extends StatelessWidget {
|
|||
),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.rss),
|
||||
child: Text(AppLocalizations.of(context)!.events),
|
||||
|
@ -224,7 +223,7 @@ class _Org extends StatelessWidget {
|
|||
),
|
||||
]),
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.rss),
|
||||
child: Text(AppLocalizations.of(context)!.events),
|
||||
|
|
|
@ -157,9 +157,16 @@ class GlProjectScreen extends StatelessWidget {
|
|||
),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
extra: p.statistics == null
|
||||
? null
|
||||
: Text(filesize(p.statistics!.repositorySize)),
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitlab/projects/$id/tree/${branch ?? p.defaultBranch}');
|
||||
},
|
||||
child: FutureBuilder<Map<String, double>>(
|
||||
future: langFuture,
|
||||
builder: (context, snapshot) {
|
||||
|
@ -173,23 +180,16 @@ class GlProjectScreen extends StatelessWidget {
|
|||
}
|
||||
},
|
||||
),
|
||||
extra: p.statistics == null
|
||||
? null
|
||||
: Text(filesize(p.statistics!.repositorySize)),
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitlab/projects/$id/tree/${branch ?? p.defaultBranch}');
|
||||
},
|
||||
),
|
||||
if (p.issuesEnabled!)
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: Text(AppLocalizations.of(context)!.issues),
|
||||
extra: Text(numberFormat.format(p.openIssuesCount)),
|
||||
onClick: () {
|
||||
context
|
||||
.push('/gitlab/projects/$id/issues?prefix=$prefix');
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.issues),
|
||||
),
|
||||
if (p.mergeRequestsEnabled!)
|
||||
AntListItem(
|
||||
|
@ -202,18 +202,17 @@ class GlProjectScreen extends StatelessWidget {
|
|||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: Text(AppLocalizations.of(context)!.commits),
|
||||
extra: p.statistics == null
|
||||
? null
|
||||
: Text(p.statistics!.commitCount.toString()),
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitlab/projects/$id/commits?prefix=$prefix&branch=${branch ?? p.defaultBranch}');
|
||||
}, // EDIT
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.commits), // EDIT
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${(branch ?? p.defaultBranch) ?? ''} • ${branches.length}'),
|
||||
onClick: () async {
|
||||
|
@ -236,6 +235,7 @@ class GlProjectScreen extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -45,7 +45,7 @@ class GoObjectScreen extends StatelessWidget {
|
|||
items.sort((a, b) {
|
||||
return sortByKey('dir', a.type, b.type);
|
||||
});
|
||||
return AntList(items: [
|
||||
return AntList(children: [
|
||||
for (var v in items)
|
||||
createObjectTreeItem(
|
||||
name: v.name,
|
||||
|
|
|
@ -92,7 +92,7 @@ class GoRepoScreen extends StatelessWidget {
|
|||
),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
|
@ -108,9 +108,9 @@ class GoRepoScreen extends StatelessWidget {
|
|||
context.push('/gogs/$owner/$name/issues');
|
||||
},
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: const Text(
|
||||
const AntListItem(
|
||||
prefix: Icon(Octicons.git_pull_request),
|
||||
child: Text(
|
||||
'Pull requests'), // TODO: when API endpoint is available
|
||||
),
|
||||
AntListItem(
|
||||
|
@ -123,7 +123,6 @@ class GoRepoScreen extends StatelessWidget {
|
|||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${branch ?? 'master'} • ${branches.length.toString()}'),
|
||||
onClick: () async {
|
||||
|
@ -144,6 +143,7 @@ class GoRepoScreen extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -72,7 +72,7 @@ class GoUserScreen extends StatelessWidget {
|
|||
]),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.home),
|
||||
child: const Text('Organizations'),
|
||||
|
|
|
@ -44,7 +44,7 @@ class GtObjectScreen extends StatelessWidget {
|
|||
items.sort((a, b) {
|
||||
return sortByKey('dir', a.type, b.type);
|
||||
});
|
||||
return AntList(items: [
|
||||
return AntList(children: [
|
||||
for (var v in items)
|
||||
createObjectTreeItem(
|
||||
name: v.name,
|
||||
|
|
|
@ -82,30 +82,30 @@ class GtRepoScreen extends StatelessWidget {
|
|||
),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
extra: Text(filesize(p.size! * 1000)),
|
||||
onClick: () {
|
||||
context.push('/gitea/$owner/$name/blob');
|
||||
},
|
||||
child: const Text('Code'),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: const Text('Issues'),
|
||||
extra: Text(numberFormat.format(p.openIssuesCount)),
|
||||
onClick: () {
|
||||
context.push('/gitea/$owner/$name/issues');
|
||||
},
|
||||
child: const Text('Issues'),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: const Text('Pull requests'),
|
||||
extra: Text(numberFormat.format(p.openPrCounter)),
|
||||
onClick: () {
|
||||
context.push('/gitea/$owner/$name/pulls');
|
||||
},
|
||||
child: const Text('Pull requests'),
|
||||
),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
|
|
|
@ -131,7 +131,7 @@ class GtUserScreen extends StatelessWidget {
|
|||
ContributionWidget(weeks: p.userHeatmap),
|
||||
CommonStyle.border,
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.home),
|
||||
child: const Text('Organizations'),
|
||||
|
|
|
@ -27,104 +27,108 @@ class SettingsScreen extends StatelessWidget {
|
|||
body: Column(
|
||||
children: <Widget>[
|
||||
CommonStyle.verticalGap,
|
||||
AntList(header: Text(AppLocalizations.of(context)!.system), items: [
|
||||
if (auth.activeAccount!.platform == PlatformType.github) ...[
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.githubStatus),
|
||||
onClick: () {
|
||||
launchStringUrl('https://www.githubstatus.com/');
|
||||
},
|
||||
),
|
||||
AntListItem(
|
||||
child: const Text('Meta'),
|
||||
onClick: () {
|
||||
context.push('/settings/github-meta');
|
||||
},
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.reviewPermissions),
|
||||
onClick: () {
|
||||
launchStringUrl(
|
||||
'https://github.com/settings/connections/applications/$clientId');
|
||||
},
|
||||
extra: Text(auth.activeAccount!.login),
|
||||
),
|
||||
],
|
||||
if (auth.activeAccount!.platform == PlatformType.gitlab)
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.gitlabStatus),
|
||||
onClick: () {
|
||||
launchStringUrl('${auth.activeAccount!.domain}/help');
|
||||
},
|
||||
extra: FutureBuilder<String>(
|
||||
future:
|
||||
auth.fetchGitlab('/version').then((v) => v['version']),
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data ?? '');
|
||||
},
|
||||
),
|
||||
),
|
||||
if (auth.activeAccount!.platform == PlatformType.gitea)
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.info),
|
||||
child: Text(AppLocalizations.of(context)!.giteaStatus),
|
||||
onClick: () {
|
||||
context.push('/gitea/status');
|
||||
},
|
||||
extra: FutureBuilder<String>(
|
||||
future: auth.fetchGitea('/version').then((v) => v['version']),
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data ?? '');
|
||||
},
|
||||
),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.switchAccounts),
|
||||
onClick: () {
|
||||
context.push('/login');
|
||||
},
|
||||
extra: Text(auth.activeAccount!.login),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.appLanguage),
|
||||
extra: Text(theme.locale == null
|
||||
? AppLocalizations.of(context)!.followSystem
|
||||
: localeNameMap[theme.locale!] ?? theme.locale!),
|
||||
onClick: () {
|
||||
// TODO: too many options, better use a new page
|
||||
theme.showActions(context, [
|
||||
for (final key in [
|
||||
null,
|
||||
...AppLocalizations.supportedLocales
|
||||
.map((l) => l.toString())
|
||||
.where((key) => localeNameMap[key] != null)
|
||||
])
|
||||
ActionItem(
|
||||
text: key == null
|
||||
? AppLocalizations.of(context)!.followSystem
|
||||
: localeNameMap[key],
|
||||
onTap: (_) async {
|
||||
final res = await theme.showConfirm(
|
||||
context,
|
||||
const Text(
|
||||
'The app will reload to make the language setting take effect'),
|
||||
);
|
||||
if (res == true && theme.locale != key) {
|
||||
await theme.setLocale(key);
|
||||
auth.reloadApp();
|
||||
}
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.system),
|
||||
children: [
|
||||
if (auth.activeAccount!.platform == PlatformType.github) ...[
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.githubStatus),
|
||||
onClick: () {
|
||||
launchStringUrl('https://www.githubstatus.com/');
|
||||
},
|
||||
),
|
||||
AntListItem(
|
||||
child: const Text('Meta'),
|
||||
onClick: () {
|
||||
context.push('/settings/github-meta');
|
||||
},
|
||||
),
|
||||
AntListItem(
|
||||
onClick: () {
|
||||
launchStringUrl(
|
||||
'https://github.com/settings/connections/applications/$clientId');
|
||||
},
|
||||
extra: Text(auth.activeAccount!.login),
|
||||
child:
|
||||
Text(AppLocalizations.of(context)!.reviewPermissions),
|
||||
),
|
||||
],
|
||||
if (auth.activeAccount!.platform == PlatformType.gitlab)
|
||||
AntListItem(
|
||||
onClick: () {
|
||||
launchStringUrl('${auth.activeAccount!.domain}/help');
|
||||
},
|
||||
extra: FutureBuilder<String>(
|
||||
future: auth
|
||||
.fetchGitlab('/version')
|
||||
.then((v) => v['version']),
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data ?? '');
|
||||
},
|
||||
)
|
||||
]);
|
||||
},
|
||||
)
|
||||
]),
|
||||
),
|
||||
child: Text(AppLocalizations.of(context)!.gitlabStatus),
|
||||
),
|
||||
if (auth.activeAccount!.platform == PlatformType.gitea)
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.info),
|
||||
onClick: () {
|
||||
context.push('/gitea/status');
|
||||
},
|
||||
extra: FutureBuilder<String>(
|
||||
future:
|
||||
auth.fetchGitea('/version').then((v) => v['version']),
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data ?? '');
|
||||
},
|
||||
),
|
||||
child: Text(AppLocalizations.of(context)!.giteaStatus),
|
||||
),
|
||||
AntListItem(
|
||||
onClick: () {
|
||||
context.push('/login');
|
||||
},
|
||||
extra: Text(auth.activeAccount!.login),
|
||||
child: Text(AppLocalizations.of(context)!.switchAccounts),
|
||||
),
|
||||
AntListItem(
|
||||
extra: Text(theme.locale == null
|
||||
? AppLocalizations.of(context)!.followSystem
|
||||
: localeNameMap[theme.locale!] ?? theme.locale!),
|
||||
onClick: () {
|
||||
// TODO: too many options, better use a new page
|
||||
theme.showActions(context, [
|
||||
for (final key in [
|
||||
null,
|
||||
...AppLocalizations.supportedLocales
|
||||
.map((l) => l.toString())
|
||||
.where((key) => localeNameMap[key] != null)
|
||||
])
|
||||
ActionItem(
|
||||
text: key == null
|
||||
? AppLocalizations.of(context)!.followSystem
|
||||
: localeNameMap[key],
|
||||
onTap: (_) async {
|
||||
final res = await theme.showConfirm(
|
||||
context,
|
||||
const Text(
|
||||
'The app will reload to make the language setting take effect'),
|
||||
);
|
||||
if (res == true && theme.locale != key) {
|
||||
await theme.setLocale(key);
|
||||
auth.reloadApp();
|
||||
}
|
||||
},
|
||||
)
|
||||
]);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.appLanguage),
|
||||
)
|
||||
]),
|
||||
CommonStyle.verticalGap,
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.theme),
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.brightness),
|
||||
extra: Text(theme.brighnessValue == AppBrightnessType.light
|
||||
? AppLocalizations.of(context)!.light
|
||||
: theme.brighnessValue == AppBrightnessType.dark
|
||||
|
@ -150,16 +154,16 @@ class SettingsScreen extends StatelessWidget {
|
|||
)
|
||||
]);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.brightness),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.codeTheme),
|
||||
onClick: () {
|
||||
context.push('/choose-code-theme');
|
||||
},
|
||||
extra: Text('${code.fontFamily}, ${code.fontSize}pt'),
|
||||
child: Text(AppLocalizations.of(context)!.codeTheme),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.markdownRenderEngine),
|
||||
extra: Text(theme.markdown == AppMarkdownType.flutter
|
||||
? AppLocalizations.of(context)!.flutter
|
||||
: AppLocalizations.of(context)!.webview),
|
||||
|
@ -181,15 +185,15 @@ class SettingsScreen extends StatelessWidget {
|
|||
)
|
||||
]);
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.markdownRenderEngine),
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.feedback),
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.submitAnIssue),
|
||||
extra: const Text('git-touch/git-touch'),
|
||||
onClick: () {
|
||||
const suffix = 'git-touch/git-touch/issues/new';
|
||||
|
@ -199,6 +203,7 @@ class SettingsScreen extends StatelessWidget {
|
|||
launchStringUrl('https://github.com/$suffix');
|
||||
}
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.submitAnIssue),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.rateThisApp),
|
||||
|
@ -210,21 +215,20 @@ class SettingsScreen extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.email),
|
||||
extra: const Text('pd4d10@gmail.com'),
|
||||
arrow: null,
|
||||
onClick: () {
|
||||
launchStringUrl('mailto:pd4d10@gmail.com');
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.email),
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.about),
|
||||
items: [
|
||||
children: [
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.version),
|
||||
extra: FutureBuilder<String>(
|
||||
future:
|
||||
PackageInfo.fromPlatform().then((info) => info.version),
|
||||
|
@ -232,9 +236,9 @@ class SettingsScreen extends StatelessWidget {
|
|||
return Text(snapshot.data ?? '');
|
||||
},
|
||||
),
|
||||
child: Text(AppLocalizations.of(context)!.version),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.sourceCode),
|
||||
extra: const Text('git-touch/git-touch'),
|
||||
onClick: () {
|
||||
const suffix = 'git-touch/git-touch';
|
||||
|
@ -244,6 +248,7 @@ class SettingsScreen extends StatelessWidget {
|
|||
launchStringUrl('https://github.com/$suffix');
|
||||
}
|
||||
},
|
||||
child: Text(AppLocalizations.of(context)!.sourceCode),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'package:provider/provider.dart';
|
|||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
class ReleaseItem extends StatelessWidget {
|
||||
|
||||
const ReleaseItem(
|
||||
{required this.login,
|
||||
required this.publishedAt,
|
||||
|
@ -88,10 +87,17 @@ class ReleaseItem extends StatelessWidget {
|
|||
),
|
||||
children: <Widget>[
|
||||
AntList(
|
||||
items: [
|
||||
children: [
|
||||
if (releaseAssets != null)
|
||||
for (var asset in releaseAssets!.nodes!)
|
||||
AntListItem(
|
||||
extra: IconButton(
|
||||
onPressed: () {
|
||||
theme.push(context, asset.downloadUrl);
|
||||
},
|
||||
icon: const Icon(Ionicons.download_outline),
|
||||
),
|
||||
arrow: null,
|
||||
child: Text(
|
||||
asset.name,
|
||||
style: TextStyle(
|
||||
|
@ -100,12 +106,6 @@ class ReleaseItem extends StatelessWidget {
|
|||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
extra: IconButton(
|
||||
onPressed: () {
|
||||
theme.push(context, asset.downloadUrl);
|
||||
},
|
||||
icon: const Icon(Ionicons.download_outline)),
|
||||
arrow: null,
|
||||
),
|
||||
],
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue