style: fix lint warnings

This commit is contained in:
Rongjian Zhang 2022-10-04 01:05:29 +08:00
parent 775b2cef49
commit 36e505d511
30 changed files with 46 additions and 45 deletions

View File

@ -33,7 +33,7 @@ import 'package:universal_io/io.dart';
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {

View File

@ -200,7 +200,7 @@ class AuthModel with ChangeNotifier {
hasMore: next != null,
total: int.tryParse(
res.headers['X-Total'] ?? res.headers['x-total'] ?? '') ??
TOTAL_COUNT_FALLBACK,
kTotalCountFallback,
);
}
@ -285,7 +285,7 @@ class AuthModel with ChangeNotifier {
Future<DataWithPage> fetchGiteaWithPage(String path,
{int? page, int? limit}) async {
page = page ?? 1;
limit = limit ?? PAGE_SIZE;
limit = limit ?? kPageSize;
var uri = Uri.parse('${activeAccount!.domain}/api/v1$path');
uri = uri.replace(
@ -303,7 +303,7 @@ class AuthModel with ChangeNotifier {
cursor: page + 1,
hasMore: info is List && info.isNotEmpty,
total: int.tryParse(res.headers['x-total-count'] ?? '') ??
TOTAL_COUNT_FALLBACK,
kTotalCountFallback,
);
}
@ -389,7 +389,7 @@ class AuthModel with ChangeNotifier {
Future<DataWithPage> fetchGogsWithPage(String path,
{int? page, int? limit}) async {
page = page ?? 1;
limit = limit ?? PAGE_SIZE;
limit = limit ?? kPageSize;
var uri = Uri.parse('${activeAccount!.domain}/api/v1$path');
uri = uri.replace(
@ -407,7 +407,7 @@ class AuthModel with ChangeNotifier {
cursor: page + 1,
hasMore: info is List && info.isNotEmpty,
total: int.tryParse(res.headers['x-total-count'] ?? '') ??
TOTAL_COUNT_FALLBACK,
kTotalCountFallback,
);
}
@ -476,7 +476,7 @@ class AuthModel with ChangeNotifier {
Future<DataWithPage> fetchGiteeWithPage(String path,
{int? page, int? limit}) async {
page = page ?? 1;
limit = limit ?? PAGE_SIZE;
limit = limit ?? kPageSize;
var uri = Uri.parse('${activeAccount!.domain}/api/v5$path');
uri = uri.replace(
@ -491,7 +491,7 @@ class AuthModel with ChangeNotifier {
final totalPage = int.tryParse(res.headers['total_page'] ?? '');
final totalCount =
int.tryParse(res.headers['total_count'] ?? '') ?? TOTAL_COUNT_FALLBACK;
int.tryParse(res.headers['total_count'] ?? '') ?? kTotalCountFallback;
return DataWithPage(
data: info,
@ -542,7 +542,7 @@ class AuthModel with ChangeNotifier {
userInfo: '${activeAccount!.login}:${activeAccount!.appPassword}',
path: input.path,
queryParameters: {
'pagelen': PAGE_SIZE.toString(),
'pagelen': kPageSize.toString(),
...input.queryParameters
},
);

View File

@ -22,7 +22,7 @@ class ListStatefulScaffold<T, K> extends StatefulWidget {
final Future<ListPayload<T, K>> Function(K? cursor) fetch;
@override
_ListStatefulScaffoldState<T, K> createState() =>
State<ListStatefulScaffold<T, K>> createState() =>
_ListStatefulScaffoldState();
}

View File

@ -41,7 +41,7 @@ class LongListStatefulScaffold<T, K> extends StatefulWidget {
final Future<LongListPayload<T, K>> Function(String? cursor) onLoadMore;
@override
_LongListStatefulScaffoldState<T, K> createState() =>
State<LongListStatefulScaffold<T, K>> createState() =>
_LongListStatefulScaffoldState();
}

View File

@ -18,10 +18,10 @@ class RefreshStatefulScaffold<T> extends StatefulWidget {
final Widget? Function(T data, void Function(T newData) setData)?
actionBuilder;
final Widget? action;
final canRefresh;
final bool canRefresh;
@override
_RefreshStatefulScaffoldState<T> createState() =>
State<RefreshStatefulScaffold<T>> createState() =>
_RefreshStatefulScaffoldState();
}

View File

@ -18,7 +18,7 @@ class TabStatefulScaffold<T> extends StatefulWidget {
final Widget Function(T payload, void Function() refresh)? actionBuilder;
@override
_TabStatefulScaffoldState<T> createState() => _TabStatefulScaffoldState();
State<TabStatefulScaffold<T>> createState() => _TabStatefulScaffoldState();
}
class _TabStatefulScaffoldState<T> extends State<TabStatefulScaffold<T>> {

View File

@ -10,7 +10,7 @@
// /// Unused
// class AboutScreen extends StatefulWidget {
// @override
// _AboutScreenState createState() => _AboutScreenState();
// State<AboutScreen> createState() => _AboutScreenState();
// }
// class _AboutScreenState extends State<AboutScreen> {

View File

@ -13,7 +13,7 @@ class BbIssueCommentScreen extends StatefulWidget {
final String number;
@override
_BbIssueCommentScreenState createState() => _BbIssueCommentScreenState();
State<BbIssueCommentScreen> createState() => _BbIssueCommentScreenState();
}
class _BbIssueCommentScreenState extends State<BbIssueCommentScreen> {

View File

@ -13,7 +13,7 @@ class BbIssueFormScreen extends StatefulWidget {
final String name;
@override
_BbIssueFormScreenState createState() => _BbIssueFormScreenState();
State<BbIssueFormScreen> createState() => _BbIssueFormScreenState();
}
class _BbIssueFormScreenState extends State<BbIssueFormScreen> {

View File

@ -8,7 +8,7 @@ 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:path/path.dart';
import 'package:path/path.dart' as p;
import 'package:provider/provider.dart';
import 'package:universal_io/io.dart';
@ -54,7 +54,7 @@ class BbObjectScreen extends StatelessWidget {
return BlobView(path, text: pl);
} else if (pl is BbTree) {
return createObjectTreeItem(
name: basename(pl.path),
name: p.basename(pl.path),
type: pl.type,
// size: v.type == 'commit_file' ? v.size : null,
size: pl.size,

View File

@ -17,7 +17,7 @@ class GeIssueCommentScreen extends StatefulWidget {
final String id;
@override
_GeIssueCommentScreenState createState() => _GeIssueCommentScreenState();
State<GeIssueCommentScreen> createState() => _GeIssueCommentScreenState();
}
class _GeIssueCommentScreenState extends State<GeIssueCommentScreen> {

View File

@ -13,7 +13,7 @@ class GeIssueFormScreen extends StatefulWidget {
final String name;
@override
_GeIssueFormScreenState createState() => _GeIssueFormScreenState();
State<GeIssueFormScreen> createState() => _GeIssueFormScreenState();
}
class _GeIssueFormScreenState extends State<GeIssueFormScreen> {

View File

@ -15,7 +15,7 @@ import 'package:timeago/timeago.dart' as timeago;
class GeSearchScreen extends StatefulWidget {
@override
_GeSearchScreenState createState() => _GeSearchScreenState();
State<GeSearchScreen> createState() => _GeSearchScreenState();
}
class _GeSearchScreenState extends State<GeSearchScreen> {
@ -107,7 +107,7 @@ class _GeSearchScreenState extends State<GeSearchScreen> {
author: p.user.login,
avatarUrl: p.user.avatarUrl,
commentCount: p.comments,
subtitle: '#' + p.number,
subtitle: '#${p.number}',
title: p.title,
updatedAt: DateTime.parse(p.updatedAt),
url:

View File

@ -20,12 +20,12 @@ class GhEventsScreen extends StatelessWidget {
fetch: (page) async {
page = page ?? 1;
final events = await context.read<AuthModel>().ghClient.getJSON(
'/users/$login/events?page=$page&per_page=$PAGE_SIZE',
'/users/$login/events?page=$page&per_page=$kPageSize',
convert: (dynamic vs) =>
[for (var v in vs) GithubEvent.fromJson(v)]);
return ListPayload(
cursor: page + 1,
hasMore: events.length == PAGE_SIZE,
hasMore: events.length == kPageSize,
items: events,
);
},

View File

@ -13,7 +13,7 @@ class GhIssueFormScreen extends StatefulWidget {
final String name;
@override
_GhIssueFormScreenState createState() => _GhIssueFormScreenState();
State<GhIssueFormScreen> createState() => _GhIssueFormScreenState();
}
class _GhIssueFormScreenState extends State<GhIssueFormScreen> {

View File

@ -43,12 +43,12 @@ class GhNewsScreenState extends State<GhNewsScreen> {
final login = auth.activeAccount!.login;
final events = await auth.ghClient.getJSON(
'/users/$login/received_events?page=$page&per_page=$PAGE_SIZE',
'/users/$login/received_events?page=$page&per_page=$kPageSize',
convert: (dynamic vs) => [for (var v in vs) GithubEvent.fromJson(v)],
);
return ListPayload(
cursor: page + 1,
hasMore: events.length == PAGE_SIZE,
hasMore: events.length == kPageSize,
items: events,
);
},

View File

@ -14,7 +14,7 @@ import 'package:timeago/timeago.dart' as timeago;
class GhSearchScreen extends StatefulWidget {
@override
_GhSearchScreenState createState() => _GhSearchScreenState();
State<GhSearchScreen> createState() => _GhSearchScreenState();
}
class _GhSearchScreenState extends State<GhSearchScreen> {
@ -49,7 +49,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
final auth = context.read<AuthModel>();
final data = await auth.query('''
{
repository: search(first: $PAGE_SIZE, type: REPOSITORY, query: "$keyword") {
repository: search(first: $kPageSize, type: REPOSITORY, query: "$keyword") {
nodes {
... on Repository {
owner {
@ -75,7 +75,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
}
}
}
user: search(first: $PAGE_SIZE, type: USER, query: "$keyword") {
user: search(first: $kPageSize, type: USER, query: "$keyword") {
nodes {
... on Organization {
__typename
@ -89,7 +89,7 @@ class _GhSearchScreenState extends State<GhSearchScreen> {
}
}
}
issue: search(first: $PAGE_SIZE, type: ISSUE, query: "$keyword") {
issue: search(first: $kPageSize, type: ISSUE, query: "$keyword") {
nodes {
... on PullRequest {
__typename

View File

@ -12,7 +12,7 @@ class GlIssueFormScreen extends StatefulWidget {
final int id;
@override
_GlIssueFormScreenState createState() => _GlIssueFormScreenState();
State<GlIssueFormScreen> createState() => _GlIssueFormScreenState();
}
class _GlIssueFormScreenState extends State<GlIssueFormScreen> {

View File

@ -14,7 +14,7 @@ import 'package:timeago/timeago.dart' as timeago;
class GlSearchScreen extends StatefulWidget {
@override
_GlSearchScreenState createState() => _GlSearchScreenState();
State<GlSearchScreen> createState() => _GlSearchScreenState();
}
class _GlSearchScreenState extends State<GlSearchScreen> {

View File

@ -17,7 +17,7 @@ class GtIssueCommentScreen extends StatefulWidget {
final String id;
@override
_GtIssueCommentScreenState createState() => _GtIssueCommentScreenState();
State<GtIssueCommentScreen> createState() => _GtIssueCommentScreenState();
}
class _GtIssueCommentScreenState extends State<GtIssueCommentScreen> {

View File

@ -13,7 +13,7 @@ class GtIssueFormScreen extends StatefulWidget {
final String name;
@override
_GtIssueFormScreenState createState() => _GtIssueFormScreenState();
State<GtIssueFormScreen> createState() => _GtIssueFormScreenState();
}
class _GtIssueFormScreenState extends State<GtIssueFormScreen> {

View File

@ -17,7 +17,7 @@ import 'package:provider/provider.dart';
class LoginScreen extends StatefulWidget {
@override
_LoginScreenState createState() => _LoginScreenState();
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {

View File

@ -76,7 +76,7 @@ class GithubPalette {
}
// final pageSize = 5;
const PAGE_SIZE = 30;
const kPageSize = 30;
List<T> join<T>(T seperator, List<T> xs) {
final result = <T>[];
@ -131,7 +131,7 @@ int sortByKey<T>(T key, T a, T b) {
return 0;
}
const TOTAL_COUNT_FALLBACK = 999; // TODO:
const kTotalCountFallback = 999; // TODO:
class ListPayload<T, K> {
ListPayload({

View File

@ -85,7 +85,7 @@ class GhEmojiAction extends StatefulWidget {
final Iterable<EmojiPayload> items;
final EmojiUpdateCallaback onReaction;
@override
_GhEmojiActionState createState() => _GhEmojiActionState();
State<GhEmojiAction> createState() => _GhEmojiActionState();
}
class _GhEmojiActionState extends State<GhEmojiAction> {

View File

@ -482,7 +482,7 @@ class EventItem extends StatelessWidget {
);
case 'MarketplacePurchaseEvent':
final action = e.payload!.action;
var messageToDisplay;
String? messageToDisplay;
switch (action) {
case 'purchased':
messageToDisplay =

View File

@ -12,7 +12,7 @@ class HtmlView extends StatefulWidget {
final String html;
@override
_HtmlViewState createState() => _HtmlViewState();
State<HtmlView> createState() => _HtmlViewState();
}
class _HtmlViewState extends State<HtmlView> {

View File

@ -8,7 +8,7 @@ class CupertinoLink extends StatefulWidget {
final Function? onTap;
@override
_CupertinoLinkState createState() => _CupertinoLinkState();
State<CupertinoLink> createState() => _CupertinoLinkState();
}
class _CupertinoLinkState extends State<CupertinoLink> {

View File

@ -17,7 +17,7 @@ class NotificationItem extends StatefulWidget {
final Function markAsRead;
@override
_NotificationItemState createState() => _NotificationItemState();
State<NotificationItem> createState() => _NotificationItemState();
}
class _NotificationItemState extends State<NotificationItem> {

View File

@ -624,7 +624,7 @@ packages:
source: hosted
version: "2.1.0"
path:
dependency: transitive
dependency: "direct main"
description:
name: path
url: "https://pub.dartlang.org"

View File

@ -73,6 +73,7 @@ dependencies:
go_router:
from_css_color:
maps_launcher:
path:
antd_mobile:
path: ../ant-design-mobile-flutter