From 988cdbfe45c6285c99aa2881406dfb69e0f596ec Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Thu, 22 Sep 2022 23:37:06 +0800 Subject: [PATCH] refactor: list prop update --- lib/screens/bb_repo.dart | 6 +- lib/screens/code_theme.dart | 12 +- lib/screens/ge_repo.dart | 8 +- lib/screens/ge_tree.dart | 2 +- lib/screens/gh_gists_files.dart | 2 +- lib/screens/gh_meta.dart | 4 +- lib/screens/gh_object.dart | 2 +- lib/screens/gh_repo.dart | 16 +-- lib/screens/gh_user.dart | 5 +- lib/screens/gl_project.dart | 24 ++-- lib/screens/go_object.dart | 2 +- lib/screens/go_repo.dart | 10 +- lib/screens/go_user.dart | 2 +- lib/screens/gt_object.dart | 2 +- lib/screens/gt_repo.dart | 8 +- lib/screens/gt_user.dart | 2 +- lib/screens/settings.dart | 207 ++++++++++++++++---------------- lib/widgets/release_item.dart | 16 +-- 18 files changed, 167 insertions(+), 163 deletions(-) diff --git a/lib/screens/bb_repo.dart b/lib/screens/bb_repo.dart index bb85ccd..169e263 100644 --- a/lib/screens/bb_repo.dart +++ b/lib/screens/bb_repo.dart @@ -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), ), ], ), diff --git a/lib/screens/code_theme.dart b/lib/screens/code_theme.dart index 71f70f2..fbcb97d 100644 --- a/lib/screens/code_theme.dart +++ b/lib/screens/code_theme.dart @@ -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), ), ], ), diff --git a/lib/screens/ge_repo.dart b/lib/screens/ge_repo.dart index 5084a13..3d081fb 100644 --- a/lib/screens/ge_repo.dart +++ b/lib/screens/ge_repo.dart @@ -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), diff --git a/lib/screens/ge_tree.dart b/lib/screens/ge_tree.dart index d1bee8f..3ac1286 100644 --- a/lib/screens/ge_tree.dart +++ b/lib/screens/ge_tree.dart @@ -32,7 +32,7 @@ class GeTreeScreen extends StatelessWidget { }, bodyBuilder: (data, _) { return AntList( - items: [ + children: [ for (var item in data) createObjectTreeItem( type: item.type, diff --git a/lib/screens/gh_gists_files.dart b/lib/screens/gh_gists_files.dart index 88863eb..810178d 100644 --- a/lib/screens/gh_gists_files.dart +++ b/lib/screens/gh_gists_files.dart @@ -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: { diff --git a/lib/screens/gh_meta.dart b/lib/screens/gh_meta.dart index 1b0f8f1..a9ab634 100644 --- a/lib/screens/gh_meta.dart +++ b/lib/screens/gh_meta.dart @@ -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'), ), ], ); diff --git a/lib/screens/gh_object.dart b/lib/screens/gh_object.dart index 16802b1..f10fa54 100644 --- a/lib/screens/gh_object.dart +++ b/lib/screens/gh_object.dart @@ -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', diff --git a/lib/screens/gh_repo.dart b/lib/screens/gh_repo.dart index a990301..50e67aa 100644 --- a/lib/screens/gh_repo.dart +++ b/lib/screens/gh_repo.dart @@ -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( 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), ), ], ], diff --git a/lib/screens/gh_user.dart b/lib/screens/gh_user.dart index bf9c238..bdd3585 100644 --- a/lib/screens/gh_user.dart +++ b/lib/screens/gh_user.dart @@ -24,7 +24,6 @@ import 'package:go_router/go_router.dart'; import 'package:provider/provider.dart'; class _Repos extends StatelessWidget { - _Repos(final Iterable pinned, final Iterable? 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), diff --git a/lib/screens/gl_project.dart b/lib/screens/gl_project.dart index 815f79d..28d3f3e 100644 --- a/lib/screens/gl_project.dart +++ b/lib/screens/gl_project.dart @@ -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>( 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), ), ], ), diff --git a/lib/screens/go_object.dart b/lib/screens/go_object.dart index c4b6814..c6dc917 100644 --- a/lib/screens/go_object.dart +++ b/lib/screens/go_object.dart @@ -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, diff --git a/lib/screens/go_repo.dart b/lib/screens/go_repo.dart index 8a9c24a..8e4bd21 100644 --- a/lib/screens/go_repo.dart +++ b/lib/screens/go_repo.dart @@ -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), ), ], ), diff --git a/lib/screens/go_user.dart b/lib/screens/go_user.dart index e3c1d78..a14da65 100644 --- a/lib/screens/go_user.dart +++ b/lib/screens/go_user.dart @@ -72,7 +72,7 @@ class GoUserScreen extends StatelessWidget { ]), CommonStyle.border, AntList( - items: [ + children: [ AntListItem( prefix: const Icon(Octicons.home), child: const Text('Organizations'), diff --git a/lib/screens/gt_object.dart b/lib/screens/gt_object.dart index 93dcfdf..b40d49e 100644 --- a/lib/screens/gt_object.dart +++ b/lib/screens/gt_object.dart @@ -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, diff --git a/lib/screens/gt_repo.dart b/lib/screens/gt_repo.dart index 996a80f..35d48e3 100644 --- a/lib/screens/gt_repo.dart +++ b/lib/screens/gt_repo.dart @@ -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), diff --git a/lib/screens/gt_user.dart b/lib/screens/gt_user.dart index 2a4a90f..3d06855 100644 --- a/lib/screens/gt_user.dart +++ b/lib/screens/gt_user.dart @@ -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'), diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 7450b17..79a8dc6 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -27,104 +27,108 @@ class SettingsScreen extends StatelessWidget { body: Column( children: [ 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( - 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( - 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( + 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( + 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( 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), ), ], ), diff --git a/lib/widgets/release_item.dart b/lib/widgets/release_item.dart index 16ffc12..741be41 100644 --- a/lib/widgets/release_item.dart +++ b/lib/widgets/release_item.dart @@ -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: [ 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, ), ], )