mirror of
https://github.com/git-touch/git-touch
synced 2025-02-02 08:56:54 +01:00
refactor: use list
This commit is contained in:
parent
f0b52e82ab
commit
e5929aa1b8
@ -47,12 +47,12 @@
|
||||
// style: TextStyle(fontSize: 20, color: theme.palette.text),
|
||||
// ),
|
||||
// SizedBox(height: 48),
|
||||
// TableView(items: [
|
||||
// TableViewItem(text: Text('Version'), rightWidget: Text(_version)),
|
||||
// TableViewItem(text: Text('Source Code'), url: '/pd4d10/git-touch'),
|
||||
// TableViewItem(
|
||||
// AntList(items: [
|
||||
// AntListItem(text: Text('Version'), rightWidget: Text(_version)),
|
||||
// AntListItem(text: Text('Source Code'), url: '/pd4d10/git-touch'),
|
||||
// AntListItem(
|
||||
// text: Text('Feedback'), url: '/pd4d10/git-touch/issues/new'),
|
||||
// TableViewItem(
|
||||
// AntListItem(
|
||||
// text: Text('Rate This App'),
|
||||
// onTap: () {
|
||||
// LaunchReview.launch(
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
@ -11,7 +12,7 @@ import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/repo_header.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
@ -56,33 +57,41 @@ class BbRepoScreen extends StatelessWidget {
|
||||
homepageUrl: p.website,
|
||||
),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.code,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
extra: Text(filesize(p.size)),
|
||||
url:
|
||||
'/bitbucket/$owner/$name/src/${branch ?? p.mainbranch!.name}',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/bitbucket/$owner/$name/src/${branch ?? p.mainbranch!.name}');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.issue_opened,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: const Text('Issues'),
|
||||
url: '/bitbucket/$owner/$name/issues',
|
||||
onClick: () {
|
||||
context.push('/bitbucket/$owner/$name/issues');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_pull_request,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: const Text('Pull requests'),
|
||||
url: '/bitbucket/$owner/$name/pulls',
|
||||
onClick: () {
|
||||
context.push('/bitbucket/$owner/$name/pulls');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.history,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: const Text('Commits'),
|
||||
url:
|
||||
'/bitbucket/$owner/$name/commits/${branch ?? p.mainbranch!.name}',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/bitbucket/$owner/$name/commits/${branch ?? p.mainbranch!.name}');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_branch,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${(branch ?? p.mainbranch!.name)!} • ${branches.length}'),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
@ -8,7 +9,6 @@ import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/single.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CodeThemeScreen extends StatelessWidget {
|
||||
@ -44,10 +44,10 @@ class MyApp extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: <Widget>[
|
||||
CommonStyle.verticalGap,
|
||||
TableView(
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.fontStyle),
|
||||
items: [
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.fontSize),
|
||||
extra: Text(codeProvider.fontSize.toString()),
|
||||
onClick: () {
|
||||
@ -66,7 +66,7 @@ class MyApp extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.fontFamily),
|
||||
extra: Text(codeProvider.fontFamily),
|
||||
onClick: () {
|
||||
@ -87,10 +87,10 @@ class MyApp extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
TableView(
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.syntaxHighlighting),
|
||||
items: [
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.light),
|
||||
extra: Text(codeProvider.theme),
|
||||
onClick: () {
|
||||
@ -108,7 +108,7 @@ class MyApp extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.dark),
|
||||
extra: Text(codeProvider.themeDark),
|
||||
onClick: () {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
@ -13,7 +14,7 @@ import 'package:git_touch/widgets/entry_item.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/mutation_button.dart';
|
||||
import 'package:git_touch/widgets/repo_header.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
@ -132,34 +133,43 @@ class GeRepoScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.code,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
extra: Text(p.license ?? ''),
|
||||
url: '/gitee/$owner/$name/tree/${branch ?? p.defaultBranch}',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitee/$owner/$name/tree/${branch ?? p.defaultBranch}');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.issue_opened,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: const Text('Issues'),
|
||||
extra: Text(numberFormat.format(p.openIssuesCount)),
|
||||
url: '/gitee/$owner/$name/issues',
|
||||
onClick: () {
|
||||
context.push('/gitee/$owner/$name/issues');
|
||||
},
|
||||
),
|
||||
if (p.pullRequestsEnabled!)
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_pull_request,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: const Text('Pull requests'),
|
||||
url: '/gitee/$owner/$name/pulls',
|
||||
onClick: () {
|
||||
context.push('/gitee/$owner/$name/pulls');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.history,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: const Text('Commits'),
|
||||
url:
|
||||
'/gitee/$owner/$name/commits?branch=${branch ?? p.defaultBranch}',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitee/$owner/$name/commits?branch=${branch ?? p.defaultBranch}');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_branch,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${(branch ?? p.defaultBranch)!} • ${branches.length}'),
|
||||
@ -184,10 +194,13 @@ class GeRepoScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.organization,
|
||||
child: const Text('Contributors'),
|
||||
url: '/gitee/$owner/$name/contributors'),
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.organization),
|
||||
child: const Text('Contributors'),
|
||||
onClick: () {
|
||||
context.push('/gitee/$owner/$name/contributors');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
@ -7,7 +8,6 @@ import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/object_tree.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class GeTreeScreen extends StatelessWidget {
|
||||
@ -31,7 +31,7 @@ class GeTreeScreen extends StatelessWidget {
|
||||
return items;
|
||||
},
|
||||
bodyBuilder: (data, _) {
|
||||
return TableView(
|
||||
return AntList(
|
||||
items: [
|
||||
for (var item in data)
|
||||
createObjectTreeItem(
|
||||
|
@ -85,10 +85,10 @@ class GeUserScreen extends StatelessWidget {
|
||||
url: '/gitee/$login?tab=following',
|
||||
),
|
||||
]),
|
||||
// TableView(
|
||||
// AntList(
|
||||
// hasIcon: true,
|
||||
// items: [
|
||||
// TableViewItem(
|
||||
// AntListItem(
|
||||
// leftIconData: Octicons.home,
|
||||
// text: Text('Organizations'),
|
||||
// url: '/gitee/$login?tab=organizations',
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:ferry/ferry.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@ -9,7 +10,6 @@ import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/object_tree.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class GhGistsFilesScreen extends StatelessWidget {
|
||||
@ -31,7 +31,7 @@ class GhGistsFilesScreen extends StatelessWidget {
|
||||
return gist;
|
||||
},
|
||||
bodyBuilder: (payload, _) {
|
||||
return TableView(
|
||||
return AntList(
|
||||
items: payload!.files!.map((v) {
|
||||
final uri = Uri(
|
||||
path: '/github/$login/gists/$id/${v.name}',
|
||||
@ -46,7 +46,7 @@ class GhGistsFilesScreen extends StatelessWidget {
|
||||
downloadUrl: null,
|
||||
size: v.size,
|
||||
);
|
||||
}),
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -1,9 +1,9 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||
import 'package:git_touch/graphql/__generated__/github.req.gql.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class GhMetaScreen extends StatelessWidget {
|
||||
@ -20,9 +20,9 @@ class GhMetaScreen extends StatelessWidget {
|
||||
return res.data!.meta;
|
||||
},
|
||||
bodyBuilder: (meta, _) {
|
||||
return TableView(
|
||||
return AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: const Text('Service SHA'),
|
||||
extra: Text(meta.gitHubServicesSha),
|
||||
),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
@ -7,7 +8,6 @@ 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';
|
||||
import 'package:git_touch/widgets/object_tree.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:github/github.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@ -59,7 +59,7 @@ class GhObjectScreen extends StatelessWidget {
|
||||
},
|
||||
bodyBuilder: (data, _) {
|
||||
if (data.isDirectory) {
|
||||
return TableView(
|
||||
return AntList(
|
||||
items: data.tree!.map((v) {
|
||||
// if (item.type == 'commit') return null;
|
||||
final uri = Uri(
|
||||
@ -76,7 +76,7 @@ class GhObjectScreen extends StatelessWidget {
|
||||
downloadUrl: v.downloadUrl,
|
||||
size: v.type == 'file' ? v.size : null,
|
||||
);
|
||||
}),
|
||||
}).toList(),
|
||||
);
|
||||
} else {
|
||||
// TODO: Markdown base path
|
||||
|
@ -19,8 +19,8 @@ import 'package:git_touch/widgets/language_bar.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/mutation_button.dart';
|
||||
import 'package:git_touch/widgets/repo_header.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:github/github.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:primer/primer.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
@ -240,43 +240,51 @@ class GhRepoScreen extends StatelessWidget {
|
||||
)
|
||||
]),
|
||||
],
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
if (ref != null)
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.code,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: Text(repo.primaryLanguage?.name ?? 'Code'),
|
||||
extra: Text(
|
||||
(license == null ? '' : '$license • ') +
|
||||
filesize(repo.diskUsage! * 1000),
|
||||
),
|
||||
url: '/github/$owner/$name/blob/${ref.name}',
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/blob/${ref.name}');
|
||||
},
|
||||
),
|
||||
if (repo.hasIssuesEnabled)
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.issue_opened,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: Text(AppLocalizations.of(context)!.issues),
|
||||
extra: Text(numberFormat.format(repo.issues.totalCount)),
|
||||
url: '/github/$owner/$name/issues',
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/issues');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_pull_request,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: Text(AppLocalizations.of(context)!.pullRequests),
|
||||
extra:
|
||||
Text(numberFormat.format(repo.pullRequests.totalCount)),
|
||||
url: '/github/$owner/$name/pulls',
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/pulls');
|
||||
},
|
||||
),
|
||||
if (ref != null) ...[
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.history,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: Text(AppLocalizations.of(context)!.commits),
|
||||
extra: Text(((ref.target as GRepoCommit).history.totalCount)
|
||||
.toString()),
|
||||
url: '/github/$owner/$name/commits/${ref.name}',
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/commits/${ref.name}');
|
||||
},
|
||||
),
|
||||
if (repo.refs != null)
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_branch,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${ref.name} • ${numberFormat.format(repo.refs!.totalCount)}'),
|
||||
@ -302,8 +310,8 @@ class GhRepoScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.organization,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.organization),
|
||||
child: Text(AppLocalizations.of(context)!.contributors),
|
||||
extra: FutureBuilder<int>(
|
||||
future: contributionFuture,
|
||||
@ -311,12 +319,16 @@ class GhRepoScreen extends StatelessWidget {
|
||||
return Text(snapshot.data?.toString() ?? '');
|
||||
},
|
||||
),
|
||||
url: '/github/$owner/$name/contributors',
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/contributors');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.book,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.book),
|
||||
child: Text(AppLocalizations.of(context)!.releases),
|
||||
url: '/github/$owner/$name/releases',
|
||||
onClick: () {
|
||||
context.push('/github/$owner/$name/releases');
|
||||
},
|
||||
extra: Text(repo.releases.totalCount.toString()),
|
||||
),
|
||||
],
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:ferry/ferry.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@ -19,6 +20,7 @@ import 'package:git_touch/widgets/repository_item.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:git_touch/widgets/text_with_at.dart';
|
||||
import 'package:git_touch/widgets/user_header.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class _Repos extends StatelessWidget {
|
||||
@ -117,26 +119,32 @@ class _User extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.rss,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.rss),
|
||||
child: Text(AppLocalizations.of(context)!.events),
|
||||
url: '/github/$login?tab=events',
|
||||
onClick: () {
|
||||
context.push('/github/$login?tab=events');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.book,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.book),
|
||||
child: Text(AppLocalizations.of(context)!.gists),
|
||||
url: '/github/$login?tab=gists',
|
||||
onClick: () {
|
||||
context.push('/github/$login?tab=gists');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.home,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.home),
|
||||
child: Text(AppLocalizations.of(context)!.organizations),
|
||||
url: '/github/$login?tab=organizations',
|
||||
onClick: () {
|
||||
context.push('/github/$login?tab=organizations');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.company))
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.organization,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.organization),
|
||||
child: TextWithAt(
|
||||
text: p!.company!,
|
||||
linkFactory: (text) => '/github/${text.substring(1)}',
|
||||
@ -145,8 +153,8 @@ class _User extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.location))
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.location,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.location),
|
||||
child: Text(p!.location!),
|
||||
onClick: () {
|
||||
launchStringUrl(
|
||||
@ -154,16 +162,16 @@ class _User extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.email))
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.mail,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.mail),
|
||||
child: Text(p!.email),
|
||||
onClick: () {
|
||||
launchStringUrl('mailto:${p!.email}');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.websiteUrl))
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.link,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.link),
|
||||
child: Text(p!.websiteUrl!),
|
||||
onClick: () {
|
||||
var url = p!.websiteUrl!;
|
||||
@ -215,16 +223,18 @@ class _Org extends StatelessWidget {
|
||||
url: '/github/${p!.login}?tab=people',
|
||||
),
|
||||
]),
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.rss,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.rss),
|
||||
child: Text(AppLocalizations.of(context)!.events),
|
||||
url: '/github/${p!.login}?tab=events',
|
||||
onClick: () {
|
||||
context.push('/github/${p!.login}?tab=events');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.location))
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.location,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.location),
|
||||
child: Text(p!.location!),
|
||||
onClick: () {
|
||||
launchStringUrl(
|
||||
@ -232,16 +242,16 @@ class _Org extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.email))
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.mail,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.mail),
|
||||
child: Text(p!.email!),
|
||||
onClick: () {
|
||||
launchStringUrl('mailto:${p!.email!}');
|
||||
},
|
||||
),
|
||||
if (isNotNullOrEmpty(p!.websiteUrl))
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.link,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.link),
|
||||
child: Text(p!.websiteUrl!),
|
||||
onClick: () {
|
||||
var url = p!.websiteUrl!;
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@ -13,7 +14,7 @@ import 'package:git_touch/widgets/entry_item.dart';
|
||||
import 'package:git_touch/widgets/language_bar.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/repo_header.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
@ -155,10 +156,10 @@ class GlProjectScreen extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.code,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: FutureBuilder<Map<String, double>>(
|
||||
future: langFuture,
|
||||
builder: (context, snapshot) {
|
||||
@ -175,32 +176,43 @@ class GlProjectScreen extends StatelessWidget {
|
||||
extra: p.statistics == null
|
||||
? null
|
||||
: Text(filesize(p.statistics!.repositorySize)),
|
||||
url: '/gitlab/projects/$id/tree/${branch ?? p.defaultBranch}',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitlab/projects/$id/tree/${branch ?? p.defaultBranch}');
|
||||
},
|
||||
),
|
||||
if (p.issuesEnabled!)
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.issue_opened,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: Text(AppLocalizations.of(context)!.issues),
|
||||
extra: Text(numberFormat.format(p.openIssuesCount)),
|
||||
url: '/gitlab/projects/$id/issues?prefix=$prefix',
|
||||
onClick: () {
|
||||
context
|
||||
.push('/gitlab/projects/$id/issues?prefix=$prefix');
|
||||
},
|
||||
),
|
||||
if (p.mergeRequestsEnabled!)
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_pull_request,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: Text(AppLocalizations.of(context)!.mergeRequests),
|
||||
url: '/gitlab/projects/$id/merge_requests?prefix=$prefix',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitlab/projects/$id/merge_requests?prefix=$prefix');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.history,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: Text(AppLocalizations.of(context)!.commits),
|
||||
extra: p.statistics == null
|
||||
? null
|
||||
: Text(p.statistics!.commitCount.toString()),
|
||||
url:
|
||||
'/gitlab/projects/$id/commits?prefix=$prefix&branch=${branch ?? p.defaultBranch}', // EDIT
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gitlab/projects/$id/commits?prefix=$prefix&branch=${branch ?? p.defaultBranch}');
|
||||
}, // EDIT
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_branch,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${(branch ?? p.defaultBranch) ?? ''} • ${branches.length}'),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
@ -8,7 +9,6 @@ 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';
|
||||
import 'package:git_touch/widgets/object_tree.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class GoObjectScreen extends StatelessWidget {
|
||||
@ -45,7 +45,7 @@ class GoObjectScreen extends StatelessWidget {
|
||||
items.sort((a, b) {
|
||||
return sortByKey('dir', a.type, b.type);
|
||||
});
|
||||
return TableView(items: [
|
||||
return AntList(items: [
|
||||
for (var v in items)
|
||||
createObjectTreeItem(
|
||||
name: v.name,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
@ -11,7 +12,7 @@ import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/entry_item.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/repo_header.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
@ -90,30 +91,38 @@ class GoRepoScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.code,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
url: '/gogs/$owner/$name/blob?ref=${branch ?? 'master'}',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gogs/$owner/$name/blob?ref=${branch ?? 'master'}');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.issue_opened,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: const Text('Issues'),
|
||||
url: '/gogs/$owner/$name/issues',
|
||||
onClick: () {
|
||||
context.push('/gogs/$owner/$name/issues');
|
||||
},
|
||||
),
|
||||
const TableViewItem(
|
||||
prefixIconData: Octicons.git_pull_request,
|
||||
child: Text(
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: const Text(
|
||||
'Pull requests'), // TODO: when API endpoint is available
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.history,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: const Text('Commits'),
|
||||
url: '/gogs/$owner/$name/commits?ref=${branch ?? 'master'}',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gogs/$owner/$name/commits?ref=${branch ?? 'master'}');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_branch,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_branch),
|
||||
child: Text(AppLocalizations.of(context)!.branches),
|
||||
extra: Text(
|
||||
'${branch ?? 'master'} • ${branches.length.toString()}'),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gogs.dart';
|
||||
@ -6,8 +7,8 @@ import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/entry_item.dart';
|
||||
import 'package:git_touch/widgets/repository_item.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:git_touch/widgets/user_header.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
@ -70,13 +71,15 @@ class GoUserScreen extends StatelessWidget {
|
||||
),
|
||||
]),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.home,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.home),
|
||||
child: const Text('Organizations'),
|
||||
url:
|
||||
'/gogs/${user.username}?tab=organizations&isViewer=$isViewer',
|
||||
onClick: () {
|
||||
context.push(
|
||||
'/gogs/${user.username}?tab=organizations&isViewer=$isViewer');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
@ -8,7 +9,6 @@ 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';
|
||||
import 'package:git_touch/widgets/object_tree.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class GtObjectScreen extends StatelessWidget {
|
||||
@ -44,7 +44,7 @@ class GtObjectScreen extends StatelessWidget {
|
||||
items.sort((a, b) {
|
||||
return sortByKey('dir', a.type, b.type);
|
||||
});
|
||||
return TableView(items: [
|
||||
return AntList(items: [
|
||||
for (var v in items)
|
||||
createObjectTreeItem(
|
||||
name: v.name,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
@ -11,7 +12,7 @@ import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/widgets/entry_item.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/repo_header.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
@ -80,30 +81,38 @@ class GtRepoScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.code,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.code),
|
||||
child: const Text('Code'),
|
||||
extra: Text(filesize(p.size! * 1000)),
|
||||
url: '/gitea/$owner/$name/blob',
|
||||
onClick: () {
|
||||
context.push('/gitea/$owner/$name/blob');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.issue_opened,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.issue_opened),
|
||||
child: const Text('Issues'),
|
||||
extra: Text(numberFormat.format(p.openIssuesCount)),
|
||||
url: '/gitea/$owner/$name/issues',
|
||||
onClick: () {
|
||||
context.push('/gitea/$owner/$name/issues');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.git_pull_request,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.git_pull_request),
|
||||
child: const Text('Pull requests'),
|
||||
extra: Text(numberFormat.format(p.openPrCounter)),
|
||||
url: '/gitea/$owner/$name/pulls',
|
||||
onClick: () {
|
||||
context.push('/gitea/$owner/$name/pulls');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.history,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.history),
|
||||
child: const Text('Commits'),
|
||||
url: '/gitea/$owner/$name/commits',
|
||||
onClick: () {
|
||||
context.push('/gitea/$owner/$name/commits');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitea.dart';
|
||||
@ -7,8 +8,8 @@ import 'package:git_touch/widgets/action_entry.dart';
|
||||
import 'package:git_touch/widgets/contribution.dart';
|
||||
import 'package:git_touch/widgets/entry_item.dart';
|
||||
import 'package:git_touch/widgets/repository_item.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:git_touch/widgets/user_header.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
@ -129,12 +130,14 @@ class GtUserScreen extends StatelessWidget {
|
||||
]),
|
||||
ContributionWidget(weeks: p.userHeatmap),
|
||||
CommonStyle.border,
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.home,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.home),
|
||||
child: const Text('Organizations'),
|
||||
url: '/gitea/$login?tab=organizations',
|
||||
onClick: () {
|
||||
context.push('/gitea/$login?tab=organizations');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -8,12 +8,11 @@ import 'package:git_touch/scaffolds/single.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/text_field.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
import 'package:git_touch/widgets/link.dart';
|
||||
import 'package:git_touch/widgets/loading.dart';
|
||||
import 'package:git_touch/widgets/text_field.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
@override
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
@ -9,7 +10,7 @@ import 'package:git_touch/utils/locale.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/table_view.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:launch_review/launch_review.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -26,27 +27,35 @@ class SettingsScreen extends StatelessWidget {
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
CommonStyle.verticalGap,
|
||||
TableView(header: Text(AppLocalizations.of(context)!.system), items: [
|
||||
AntList(header: Text(AppLocalizations.of(context)!.system), items: [
|
||||
if (auth.activeAccount!.platform == PlatformType.github) ...[
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.githubStatus),
|
||||
url: 'https://www.githubstatus.com/',
|
||||
onClick: () {
|
||||
launchStringUrl('https://www.githubstatus.com/');
|
||||
},
|
||||
),
|
||||
const TableViewItem(
|
||||
child: Text('Meta'),
|
||||
url: '/settings/github-meta',
|
||||
AntListItem(
|
||||
child: const Text('Meta'),
|
||||
onClick: () {
|
||||
context.push('/settings/github-meta');
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.reviewPermissions),
|
||||
url:
|
||||
'https://github.com/settings/connections/applications/$clientId',
|
||||
onClick: () {
|
||||
launchStringUrl(
|
||||
'https://github.com/settings/connections/applications/$clientId');
|
||||
},
|
||||
extra: Text(auth.activeAccount!.login),
|
||||
),
|
||||
],
|
||||
if (auth.activeAccount!.platform == PlatformType.gitlab)
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.gitlabStatus),
|
||||
url: '${auth.activeAccount!.domain}/help',
|
||||
onClick: () {
|
||||
launchStringUrl('${auth.activeAccount!.domain}/help');
|
||||
},
|
||||
extra: FutureBuilder<String>(
|
||||
future:
|
||||
auth.fetchGitlab('/version').then((v) => v['version']),
|
||||
@ -56,10 +65,12 @@ class SettingsScreen extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
if (auth.activeAccount!.platform == PlatformType.gitea)
|
||||
TableViewItem(
|
||||
prefixIconData: Octicons.info,
|
||||
AntListItem(
|
||||
prefix: const Icon(Octicons.info),
|
||||
child: Text(AppLocalizations.of(context)!.giteaStatus),
|
||||
url: '/gitea/status',
|
||||
onClick: () {
|
||||
context.push('/gitea/status');
|
||||
},
|
||||
extra: FutureBuilder<String>(
|
||||
future: auth.fetchGitea('/version').then((v) => v['version']),
|
||||
builder: (context, snapshot) {
|
||||
@ -67,12 +78,14 @@ class SettingsScreen extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.switchAccounts),
|
||||
url: '/login',
|
||||
onClick: () {
|
||||
context.push('/login');
|
||||
},
|
||||
extra: Text(auth.activeAccount!.login),
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.appLanguage),
|
||||
extra: Text(theme.locale == null
|
||||
? AppLocalizations.of(context)!.followSystem
|
||||
@ -107,10 +120,10 @@ class SettingsScreen extends StatelessWidget {
|
||||
)
|
||||
]),
|
||||
CommonStyle.verticalGap,
|
||||
TableView(
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.theme),
|
||||
items: [
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.brightness),
|
||||
extra: Text(theme.brighnessValue == AppBrightnessType.light
|
||||
? AppLocalizations.of(context)!.light
|
||||
@ -138,12 +151,14 @@ class SettingsScreen extends StatelessWidget {
|
||||
]);
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.codeTheme),
|
||||
url: '/choose-code-theme',
|
||||
onClick: () {
|
||||
context.push('/choose-code-theme');
|
||||
},
|
||||
extra: Text('${code.fontFamily}, ${code.fontSize}pt'),
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.markdownRenderEngine),
|
||||
extra: Text(theme.markdown == AppMarkdownType.flutter
|
||||
? AppLocalizations.of(context)!.flutter
|
||||
@ -170,16 +185,22 @@ class SettingsScreen extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
TableView(
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.feedback),
|
||||
items: [
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.submitAnIssue),
|
||||
extra: const Text('git-touch/git-touch'),
|
||||
url:
|
||||
'${auth.activeAccount!.platform == PlatformType.github ? '/github' : 'https://github.com'}/git-touch/git-touch/issues/new',
|
||||
onClick: () {
|
||||
const suffix = 'git-touch/git-touch/issues/new';
|
||||
if (auth.activeAccount!.platform == PlatformType.github) {
|
||||
context.push('/github/$suffix');
|
||||
} else {
|
||||
launchStringUrl('https://github.com/$suffix');
|
||||
}
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.rateThisApp),
|
||||
onClick: () {
|
||||
LaunchReview.launch(
|
||||
@ -188,32 +209,41 @@ class SettingsScreen extends StatelessWidget {
|
||||
);
|
||||
},
|
||||
),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.email),
|
||||
extra: const Text('pd4d10@gmail.com'),
|
||||
hideRightChevron: true,
|
||||
url: 'mailto:pd4d10@gmail.com',
|
||||
arrow: null,
|
||||
onClick: () {
|
||||
launchStringUrl('mailto:pd4d10@gmail.com');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
CommonStyle.verticalGap,
|
||||
TableView(
|
||||
AntList(
|
||||
header: Text(AppLocalizations.of(context)!.about),
|
||||
items: [
|
||||
TableViewItem(
|
||||
child: Text(AppLocalizations.of(context)!.version),
|
||||
extra: FutureBuilder<String>(
|
||||
future:
|
||||
PackageInfo.fromPlatform().then((info) => info.version),
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data ?? '');
|
||||
},
|
||||
)),
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.version),
|
||||
extra: FutureBuilder<String>(
|
||||
future:
|
||||
PackageInfo.fromPlatform().then((info) => info.version),
|
||||
builder: (context, snapshot) {
|
||||
return Text(snapshot.data ?? '');
|
||||
},
|
||||
),
|
||||
),
|
||||
AntListItem(
|
||||
child: Text(AppLocalizations.of(context)!.sourceCode),
|
||||
extra: const Text('git-touch/git-touch'),
|
||||
url:
|
||||
'${auth.activeAccount!.platform == PlatformType.github ? '/github' : 'https://github.com'}/git-touch/git-touch',
|
||||
onClick: () {
|
||||
const suffix = 'git-touch/git-touch';
|
||||
if (auth.activeAccount!.platform == PlatformType.github) {
|
||||
context.push('/github/$suffix');
|
||||
} else {
|
||||
launchStringUrl('https://github.com/$suffix');
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -158,7 +158,7 @@ class PrimerBranchName extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
launchStringUrl(String? url) async {
|
||||
Future<void> launchStringUrl(String? url) async {
|
||||
if (url == null) return;
|
||||
|
||||
final uri = Uri.parse(url);
|
||||
|
@ -3,7 +3,6 @@ import 'package:file_icon/file_icon.dart';
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
|
||||
Widget _buildIcon(String type, String name) {
|
||||
switch (type) {
|
||||
@ -22,32 +21,35 @@ Widget _buildIcon(String type, String name) {
|
||||
}
|
||||
}
|
||||
|
||||
TableViewItem createObjectTreeItem({
|
||||
AntListItem createObjectTreeItem({
|
||||
required String name,
|
||||
required String type,
|
||||
required String url,
|
||||
String? downloadUrl,
|
||||
int? size,
|
||||
}) {
|
||||
return TableViewItem(
|
||||
return AntListItem(
|
||||
prefix: _buildIcon(type, name),
|
||||
child: Text(name),
|
||||
extra: size == null ? null : Text(filesize(size)),
|
||||
url: [
|
||||
// Let system browser handle these files
|
||||
//
|
||||
// TODO:
|
||||
// Unhandled Exception: PlatformException(Error, Error while launching
|
||||
// https://github.com/flutter/flutter/issues/49162
|
||||
onClick: () async {
|
||||
final finalUrl = [
|
||||
// Let system browser handle these files
|
||||
//
|
||||
// TODO:
|
||||
// Unhandled Exception: PlatformException(Error, Error while launching
|
||||
// https://github.com/flutter/flutter/issues/49162
|
||||
|
||||
// Docs
|
||||
'pdf', 'docx', 'doc', 'pptx', 'ppt', 'xlsx', 'xls',
|
||||
// Fonts
|
||||
'ttf', 'otf', 'eot', 'woff', 'woff2',
|
||||
'svg',
|
||||
].contains(name.ext)
|
||||
? downloadUrl
|
||||
: url,
|
||||
hideRightChevron: size != null,
|
||||
// Docs
|
||||
'pdf', 'docx', 'doc', 'pptx', 'ppt', 'xlsx', 'xls',
|
||||
// Fonts
|
||||
'ttf', 'otf', 'eot', 'woff', 'woff2',
|
||||
'svg',
|
||||
].contains(name.ext)
|
||||
? downloadUrl
|
||||
: url;
|
||||
await launchStringUrl(finalUrl);
|
||||
},
|
||||
arrow: size == null ? const Icon(AntIcons.rightOutline) : null,
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:antd_mobile/antd_mobile.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_gen/gen_l10n/S.dart';
|
||||
import 'package:git_touch/graphql/__generated__/github.data.gql.dart';
|
||||
@ -5,7 +6,6 @@ import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/avatar.dart';
|
||||
import 'package:git_touch/widgets/markdown_view.dart';
|
||||
import 'package:git_touch/widgets/table_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
@ -87,11 +87,11 @@ class ReleaseItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
children: <Widget>[
|
||||
TableView(
|
||||
AntList(
|
||||
items: [
|
||||
if (releaseAssets != null)
|
||||
for (var asset in releaseAssets!.nodes!)
|
||||
TableViewItem(
|
||||
AntListItem(
|
||||
child: Text(
|
||||
asset.name,
|
||||
style: TextStyle(
|
||||
@ -105,7 +105,7 @@ class ReleaseItem extends StatelessWidget {
|
||||
theme.push(context, asset.downloadUrl);
|
||||
},
|
||||
icon: const Icon(Ionicons.download_outline)),
|
||||
hideRightChevron: true,
|
||||
arrow: null,
|
||||
),
|
||||
],
|
||||
)
|
||||
|
@ -24,30 +24,10 @@ class TableViewHeader extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class TableViewItem {
|
||||
final Widget child;
|
||||
final IconData? prefixIconData;
|
||||
final Widget? prefix;
|
||||
final Widget? extra;
|
||||
final void Function()? onClick;
|
||||
final String? url;
|
||||
final bool hideRightChevron;
|
||||
|
||||
const TableViewItem({
|
||||
required this.child,
|
||||
this.prefixIconData,
|
||||
this.prefix,
|
||||
this.extra,
|
||||
this.onClick,
|
||||
this.url,
|
||||
this.hideRightChevron = false,
|
||||
}) : assert(prefixIconData == null || prefix == null);
|
||||
}
|
||||
|
||||
class TableViewItemWidget extends StatelessWidget {
|
||||
const TableViewItemWidget(this.item, {super.key});
|
||||
|
||||
final TableViewItem item;
|
||||
final AntListItem item;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -55,7 +35,6 @@ class TableViewItemWidget extends StatelessWidget {
|
||||
|
||||
return LinkWidget(
|
||||
onTap: item.onClick,
|
||||
url: item.url,
|
||||
child: DefaultTextStyle(
|
||||
style: TextStyle(fontSize: 17, color: theme.palette.text),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@ -64,16 +43,8 @@ class TableViewItemWidget extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: (item.prefix == null && item.prefixIconData == null)
|
||||
? 12
|
||||
: 44,
|
||||
child: Center(
|
||||
child: item.prefix ??
|
||||
Icon(
|
||||
item.prefixIconData,
|
||||
color: theme.palette.primary,
|
||||
size: 20,
|
||||
)),
|
||||
width: (item.prefix == null) ? 12 : 44,
|
||||
child: Center(child: item.prefix),
|
||||
),
|
||||
Expanded(child: item.child),
|
||||
if (item.extra != null) ...[
|
||||
@ -86,8 +57,7 @@ class TableViewItemWidget extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 6)
|
||||
],
|
||||
if ((item.onClick != null || item.url != null) &&
|
||||
!item.hideRightChevron)
|
||||
if (item.onClick != null)
|
||||
Icon(Ionicons.chevron_forward,
|
||||
size: 20, color: theme.palette.tertiaryText)
|
||||
else
|
||||
@ -100,41 +70,3 @@ class TableViewItemWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TableView extends StatelessWidget {
|
||||
final Widget? header;
|
||||
final Iterable<TableViewItem> items;
|
||||
|
||||
const TableView({
|
||||
super.key,
|
||||
this.header,
|
||||
required this.items,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
|
||||
return AntList(
|
||||
header: header,
|
||||
items: [
|
||||
for (final item in items)
|
||||
AntListItem(
|
||||
child: item.child,
|
||||
prefix: item.prefix ??
|
||||
(item.prefixIconData == null
|
||||
? null
|
||||
: Icon(item.prefixIconData)),
|
||||
extra: item.extra,
|
||||
onClick: item.onClick != null
|
||||
? item.onClick!
|
||||
: item.url != null
|
||||
? () {
|
||||
theme.push(context, item.url!);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user