mirror of
https://github.com/git-touch/git-touch
synced 2025-03-11 16:50:12 +01:00
refactor: fix dart lint
This commit is contained in:
parent
fc96c5ad45
commit
30eb0ef5b3
3
analysis_options.yaml
Normal file
3
analysis_options.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
analyzer:
|
||||
exclude:
|
||||
- lib/**/*.g.dart
|
@ -29,7 +29,7 @@ class RefreshStatefulScaffold<T> extends StatefulWidget {
|
||||
|
||||
class _RefreshStatefulScaffoldState<T>
|
||||
extends State<RefreshStatefulScaffold<T>> {
|
||||
bool _loading;
|
||||
// bool _loading;
|
||||
T _data;
|
||||
String _error = '';
|
||||
|
||||
@ -44,7 +44,7 @@ class _RefreshStatefulScaffoldState<T>
|
||||
try {
|
||||
setState(() {
|
||||
_error = '';
|
||||
_loading = true;
|
||||
// _loading = true;
|
||||
});
|
||||
_data = await widget.fetch();
|
||||
} catch (err) {
|
||||
@ -53,7 +53,7 @@ class _RefreshStatefulScaffoldState<T>
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_loading = false;
|
||||
// _loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {
|
||||
CupertinoButton.filled(
|
||||
child: Text('Comment'),
|
||||
onPressed: () async {
|
||||
final res = await auth.fetchBb(
|
||||
await auth.fetchBb(
|
||||
'/repositories/${widget.owner}/${widget.name}/issues/${widget.number}/comments',
|
||||
isPost: true,
|
||||
body: {
|
||||
|
@ -56,7 +56,7 @@ class _BbIssueFormScreenState extends State<BbIssueFormScreen> {
|
||||
CupertinoButton.filled(
|
||||
child: Text('Submit'),
|
||||
onPressed: () async {
|
||||
final res = await auth.fetchBbJson(
|
||||
await auth.fetchBbJson(
|
||||
'/repositories/${widget.owner}/${widget.name}/issues',
|
||||
isPost: true,
|
||||
body: {'body': _body, 'title': _title},
|
||||
|
@ -16,7 +16,6 @@ class BbIssuesScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final auth = Provider.of<AuthModel>(context);
|
||||
return ListStatefulScaffold<BbIssues, String>(
|
||||
title: AppBarTitle(S.of(context).issues),
|
||||
actionBuilder: () {
|
||||
|
@ -54,13 +54,13 @@ class _GeIssueCommentScreenState extends State<GeIssueCommentScreen> {
|
||||
child: Text('Comment'),
|
||||
onPressed: () async {
|
||||
if (!isEdit) {
|
||||
final res = await auth.fetchGitee(
|
||||
await auth.fetchGitee(
|
||||
'/repos/${widget.owner}/${widget.name}/${widget.isPr ? 'pulls' : 'issues'}/${widget.number}/comments',
|
||||
requestType: 'POST',
|
||||
body: {'body': _controller.text, 'repo': widget.name},
|
||||
);
|
||||
} else {
|
||||
final res = await auth.fetchGitee(
|
||||
await auth.fetchGitee(
|
||||
'/repos/${widget.owner}/${widget.name}/${widget.isPr ? 'pulls' : 'issues'}/comments/${int.parse(widget.id)}',
|
||||
requestType: 'PATCH',
|
||||
body: {'body': _controller.text, 'repo': widget.name},
|
||||
|
@ -8,7 +8,6 @@ import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
import 'package:git_touch/models/auth.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:provider/provider.dart';
|
||||
import 'package:git_touch/widgets/action_button.dart';
|
||||
|
@ -52,6 +52,8 @@ class GhObjectScreen extends StatelessWidget {
|
||||
iconData: Icons.settings,
|
||||
url: '/choose-code-theme',
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
bodyBuilder: (data, _) {
|
||||
|
@ -136,7 +136,7 @@ class GhRepoScreen extends StatelessWidget {
|
||||
switch (v) {
|
||||
case GSubscriptionState.SUBSCRIBED:
|
||||
case GSubscriptionState.IGNORED:
|
||||
final res = await context
|
||||
await context
|
||||
.read<AuthModel>()
|
||||
.ghClient
|
||||
.activity
|
||||
|
@ -154,15 +154,15 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
|
||||
|
||||
static const tabs = ['Repositories', 'Users', 'Issues'];
|
||||
|
||||
static IconData _buildIconData(p) {
|
||||
if (p['isPrivate']) {
|
||||
return Octicons.lock;
|
||||
}
|
||||
if (p['isFork']) {
|
||||
return Octicons.repo_forked;
|
||||
}
|
||||
return Octicons.repo;
|
||||
}
|
||||
// static IconData _buildIconData(p) {
|
||||
// if (p['isPrivate']) {
|
||||
// return Octicons.lock;
|
||||
// }
|
||||
// if (p['isFork']) {
|
||||
// return Octicons.repo_forked;
|
||||
// }
|
||||
// return Octicons.repo;
|
||||
// }
|
||||
|
||||
Widget _buildItem(p) {
|
||||
switch (_activeTab) {
|
||||
|
@ -17,7 +17,7 @@ class GlCommitScreen extends StatelessWidget {
|
||||
final String sha;
|
||||
GlCommitScreen(this.id, {this.sha});
|
||||
|
||||
Future<List<GitlabDiff>> _query(BuildContext context, [int page = 1]) async {
|
||||
Future<List<GitlabDiff>> _query(BuildContext context) async {
|
||||
final auth = context.read<AuthModel>();
|
||||
final res = await auth
|
||||
.fetchGitlabWithPage('/projects/$id/repository/commits/$sha/diff');
|
||||
|
@ -38,7 +38,7 @@ class GlIssueScreen extends StatelessWidget {
|
||||
bodyBuilder: (data, _) {
|
||||
final issue = data.item1;
|
||||
final notes = data.item2;
|
||||
final emoji = data.item3;
|
||||
// final emoji = data.item3;
|
||||
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
|
@ -104,23 +104,22 @@ class _GlSearchScreenState extends State<GlSearchScreen> {
|
||||
static const tabs = ['Projects', 'Users'];
|
||||
|
||||
Widget _buildItem(_p) {
|
||||
switch (_activeTab) {
|
||||
case 0:
|
||||
final p = _p as GitlabProject;
|
||||
final updatedAt = timeago.format(p.lastActivityAt);
|
||||
return RepositoryItem.gl(
|
||||
payload: p,
|
||||
note: 'Updated $updatedAt',
|
||||
);
|
||||
case 1:
|
||||
final p = _p as GitlabUser;
|
||||
return UserItem.gitlab(
|
||||
login: p.username,
|
||||
name: p.name,
|
||||
id: p.id,
|
||||
avatarUrl: p.avatarUrl,
|
||||
bio: Text(p.bio ?? ''),
|
||||
);
|
||||
if (_activeTab == 0) {
|
||||
final p = _p as GitlabProject;
|
||||
final updatedAt = timeago.format(p.lastActivityAt);
|
||||
return RepositoryItem.gl(
|
||||
payload: p,
|
||||
note: 'Updated $updatedAt',
|
||||
);
|
||||
} else {
|
||||
final p = _p as GitlabUser;
|
||||
return UserItem.gitlab(
|
||||
login: p.username,
|
||||
name: p.name,
|
||||
id: p.id,
|
||||
avatarUrl: p.avatarUrl,
|
||||
bio: Text(p.bio ?? ''),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,6 @@ class GtIssueScreen extends StatelessWidget {
|
||||
final issue = data.item1;
|
||||
final comments = data.item2;
|
||||
final theme = context.read<ThemeModel>();
|
||||
final auth = context.read<AuthModel>();
|
||||
return Column(children: <Widget>[
|
||||
Container(
|
||||
padding: CommonStyle.padding,
|
||||
|
@ -54,13 +54,13 @@ class _GtIssueCommentScreenState extends State<GtIssueCommentScreen> {
|
||||
child: Text('Comment'),
|
||||
onPressed: () async {
|
||||
if (!isEdit) {
|
||||
final res = await auth.fetchGitea(
|
||||
await auth.fetchGitea(
|
||||
'/repos/${widget.owner}/${widget.name}/${widget.isPr ? 'pulls' : 'issues'}/${widget.number}/comments',
|
||||
requestType: 'POST',
|
||||
body: {'body': _controller.text, 'repo': widget.name},
|
||||
);
|
||||
} else {
|
||||
final res = await auth.fetchGitea(
|
||||
await auth.fetchGitea(
|
||||
'/repos/${widget.owner}/${widget.name}/${widget.isPr ? 'pulls' : 'issues'}/comments/${int.parse(widget.id)}',
|
||||
requestType: 'PATCH',
|
||||
body: {'body': _controller.text, 'repo': widget.name},
|
||||
|
@ -56,7 +56,7 @@ class _GtIssueFormScreenState extends State<GtIssueFormScreen> {
|
||||
CupertinoButton.filled(
|
||||
child: Text('Submit'),
|
||||
onPressed: () async {
|
||||
final res = await auth.fetchGitea(
|
||||
await auth.fetchGitea(
|
||||
'/repos/${widget.owner}/${widget.name}/issues',
|
||||
requestType: 'POST',
|
||||
body: {'body': _body, 'title': _title},
|
||||
|
@ -4,7 +4,6 @@ import 'package:filesize/filesize.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:git_touch/models/auth.dart';
|
||||
import 'package:git_touch/models/gitea.dart';
|
||||
import 'package:git_touch/models/theme.dart';
|
||||
import 'package:git_touch/scaffolds/refresh_stateful.dart';
|
||||
import 'package:git_touch/utils/utils.dart';
|
||||
import 'package:git_touch/widgets/app_bar_title.dart';
|
||||
@ -49,7 +48,6 @@ class GtRepoScreen extends StatelessWidget {
|
||||
return Tuple2(repo, readmeData);
|
||||
},
|
||||
bodyBuilder: (t, setState) {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
final p = t.item1;
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
@ -15,11 +15,11 @@ import 'package:tuple/tuple.dart';
|
||||
import '../generated/l10n.dart';
|
||||
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
Widget _buildRightWidget(BuildContext context, bool checked) {
|
||||
final theme = Provider.of<ThemeModel>(context);
|
||||
if (!checked) return null;
|
||||
return Icon(Icons.check, color: theme.palette.primary, size: 24);
|
||||
}
|
||||
// Widget _buildRightWidget(BuildContext context, bool checked) {
|
||||
// final theme = Provider.of<ThemeModel>(context);
|
||||
// if (!checked) return null;
|
||||
// return Icon(Icons.check, color: theme.palette.primary, size: 24);
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user