Skip to content

Commit 4dfc8f5

Browse files
committed
📈 Fixed analysis hints.
1 parent d04005e commit 4dfc8f5

File tree

82 files changed

+1257
-1253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1257
-1253
lines changed

lib/internal/consts.dart

+39-37
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,83 @@
11
class MikanFunc {
22
const MikanFunc._();
33

4-
static const String SEASON = "SEASON";
5-
static const String DAY = "DAY";
6-
static const String SEARCH = "SEARCH";
7-
static const String LIST = "LIST";
8-
static const String USER = "USER";
9-
static const String INDEX = "INDEX";
10-
static const String SUBGROUP = "SUBGROUP";
11-
static const String BANGUMI = "BANGUMI";
12-
static const String BANGUMI_MORE = "BANGUMI_MORE";
13-
static const String DETAILS = "DETAILS";
14-
static const String SUBSCRIBE_BANGUMI = "SUBSCRIBE_BANGUMI";
15-
static const String UNSUBSCRIBE_BANGUMI = "UNSUBSCRIBE_BANGUMI";
16-
static const String SUBSCRIBED_SEASON = "SUBSCRIBED_SEASON";
17-
static const String REFRESH_LOGIN_TOKEN = "REFRESH_LOGIN_TOKEN";
18-
static const String REFRESH_REGISTER_TOKEN = "REFRESH_REGISTER_TOKEN";
19-
static const String REFRESH_FORGOTPASSWORD_TOKEN =
4+
static const String season = "SEASON";
5+
static const String day = "DAY";
6+
static const String search = "SEARCH";
7+
static const String list = "LIST";
8+
static const String user = "USER";
9+
static const String index = "INDEX";
10+
static const String subgroup = "SUBGROUP";
11+
static const String bangumi = "BANGUMI";
12+
static const String bangumiMore = "BANGUMI_MORE";
13+
static const String details = "DETAILS";
14+
static const String subscribeBangumi = "SUBSCRIBE_BANGUMI";
15+
static const String unsubscribeBangumi = "UNSUBSCRIBE_BANGUMI";
16+
static const String subscribedSeason = "SUBSCRIBED_SEASON";
17+
static const String refreshLoginToken = "REFRESH_LOGIN_TOKEN";
18+
static const String refreshRegisterToken = "REFRESH_REGISTER_TOKEN";
19+
static const String refreshForgotPasswordToken =
2020
"REFRESH_FORGOTPASSWORD_TOKEN";
2121
}
2222

2323
class MikanUrl {
2424
const MikanUrl._();
2525

26-
static const String BASE_URL = "https://mikanani.me";
26+
static const String baseUrl = "https://mikanani.me";
2727

2828
/// [最近更新](https://mikanani.me/Home/EpisodeUpdateRows?predate=0&enddate=1&maximumitems=6)
29-
static const String DAY_UPDATE = "/Home/EpisodeUpdateRows";
29+
static const String dayUpdate = "/Home/EpisodeUpdateRows";
3030

3131
/// [季度信息](https://mikanani.me/Home/BangumiCoverFlowByDayOfWeek?year=2020&seasonStr=%E5%86%AC)
32-
static const String SEASON_UPDATE = "/Home/BangumiCoverFlowByDayOfWeek";
32+
static const String seasonUpdate = "/Home/BangumiCoverFlowByDayOfWeek";
3333

3434
/// [搜索](https://mikanani.me/Home/Search?searchstr=%E5%88%80%E5%89%91%E7%A5%9E%E5%9F%9F&subgroupid=19&page=1)
35-
static const String SEARCH = "/Home/Search";
35+
static const String search = "/Home/Search";
3636

3737
/// [更新列表](https://mikanani.me/Home/Classic/1)
38-
static const String LIST = "/Home/Classic";
38+
static const String list = "/Home/Classic";
3939

4040
/// [字幕组信息](https://mikanani.me/Home/PublishGroup/33)
41-
static const String SUBGROUP = "/Home/PublishGroup";
41+
static const String subgroup = "/Home/PublishGroup";
4242

4343
/// [番组信息](https://mikanani.me/Home/Bangumi/2229)
44-
static const String BANGUMI = "/Home/Bangumi";
44+
static const String bangumi = "/Home/Bangumi";
4545

4646
/// [番组BT列表](https://mikanani.me/Home/ExpandEpisodeTable?bangumiId=227&subtitleGroupId=161&take=65)
47-
static const String BANGUMI_MORE = "/Home/ExpandEpisodeTable";
47+
static const String bangumiMore = "/Home/ExpandEpisodeTable";
4848

4949
/// [登录](https://mikanani.me/Account/Login?ReturnUrl=%2F)
50-
static const String LOGIN = "/Account/Login";
50+
static const String login = "/Account/Login";
5151

5252
/// [注册](https://mikanani.me/Account/Register)
53-
static const String REGISTER = "/Account/Register";
53+
static const String register = "/Account/Register";
5454

5555
///[忘记密码](https://mikanani.me/Account/ForgotPassword)
56-
static const String FORGOT_PASSWORD = "/Account/ForgotPassword";
56+
static const String forgotPassword = "/Account/ForgotPassword";
5757

5858
/// [订阅](https://mikanani.me/Home/SubscribeBangumi)
59-
static const String SUBSCRIBE_BANGUMI = "/Home/SubscribeBangumi";
59+
static const String subscribeBangumi = "/Home/SubscribeBangumi";
6060

6161
/// [取消订阅](https://mikanani.me/Home/UnsubscribeBangumi)
62-
static const String UNSUBSCRIBE_BANGUMI = "/Home/UnsubscribeBangumi";
62+
static const String unsubscribeBangumi = "/Home/UnsubscribeBangumi";
6363

6464
/// [季度订阅](https://mikanani.me/Home/BangumiCoverFlow?year=2020&seasonStr=%E7%A7%8B)
65-
static const String SUBSCRIBED_SEASON = "/Home/BangumiCoverFlow";
65+
static const String subscribedSeason = "/Home/BangumiCoverFlow";
6666

6767
/// [我的订阅页 用于刷新token](https://mikanani.me/Home/MyBangumi)
68-
static const String MY_SUBSCRIBED = "/Home/MyBangumi";
68+
static const String mySubscribed = "/Home/MyBangumi";
6969
}
7070

71-
class Extra {
72-
static const String FONTS_BASE_URL =
71+
class ExtraUrl {
72+
const ExtraUrl();
73+
74+
static const String fontsBaseUrl =
7375
"https://cdn.jsdelivr.net/gh/iota9star/fonts@master";
74-
static const String FONTS_MANIFEST = "$FONTS_BASE_URL/manifest.json";
75-
static const String RELEASE_VERSION =
76+
static const String fontsManifest = "$fontsBaseUrl/manifest.json";
77+
static const String releaseVersion =
7678
"https://data.jsdelivr.com/v1/package/gh/iota9star/mikan_flutter";
77-
static const String MIKAN_REPO_URL =
79+
static const String mikanRepoUrl =
7880
"https://cdn.jsdelivr.net/gh/iota9star/mikan_flutter@master";
79-
static const String MIKAN_RELEASES_META =
81+
static const String mikanReleaseMeta =
8082
"https://cdn.jsdelivr.net/gh/iota9star/mikan_flutter@master/releases/meta.json";
8183
}

lib/internal/enums.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ class WeekSection {
44

55
const WeekSection._(this.name, this.shortName);
66

7-
static final WeekSection mon = const WeekSection._("星期一", "月");
8-
static final WeekSection tue = const WeekSection._("星期二", "火");
9-
static final WeekSection wed = const WeekSection._("星期三", "水");
10-
static final WeekSection thu = const WeekSection._("星期四", "木");
11-
static final WeekSection fri = const WeekSection._("星期五", "金");
12-
static final WeekSection sat = const WeekSection._("星期六", "土");
13-
static final WeekSection sun = const WeekSection._("星期日", "日");
14-
static final WeekSection mv = const WeekSection._("剧场版", "剧");
15-
static final WeekSection ova = const WeekSection._("OVA", "O");
16-
static final List<WeekSection> values = [
7+
static const WeekSection mon = WeekSection._("星期一", "月");
8+
static const WeekSection tue = WeekSection._("星期二", "火");
9+
static const WeekSection wed = WeekSection._("星期三", "水");
10+
static const WeekSection thu = WeekSection._("星期四", "木");
11+
static const WeekSection fri = WeekSection._("星期五", "金");
12+
static const WeekSection sat = WeekSection._("星期六", "土");
13+
static const WeekSection sun = WeekSection._("星期日", "日");
14+
static const WeekSection mv = WeekSection._("剧场版", "剧");
15+
static const WeekSection ova = WeekSection._("OVA", "O");
16+
static const List<WeekSection> values = [
1717
mon,
1818
tue,
1919
wed,

lib/internal/extension.dart

+38-33
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ import 'package:url_launcher/url_launcher.dart';
1919
extension IterableExt<T> on Iterable<T>? {
2020
bool get isNullOrEmpty => this == null || this!.isEmpty;
2121

22-
bool get isSafeNotEmpty => !this.isNullOrEmpty;
22+
bool get isSafeNotEmpty => !isNullOrEmpty;
2323

2424
T? getOrNull(final int index) {
25-
if (this.isNullOrEmpty) return null;
25+
if (isNullOrEmpty) return null;
2626
return this!.elementAt(index);
2727
}
2828

@@ -35,7 +35,7 @@ extension IterableExt<T> on Iterable<T>? {
3535
return true;
3636
}
3737

38-
bool ne(Iterable<T> other) => !this.eq(other);
38+
bool ne(Iterable<T> other) => !eq(other);
3939
}
4040

4141
extension BoolExt on bool {
@@ -45,10 +45,10 @@ extension BoolExt on bool {
4545
extension ListExt<T> on List<T>? {
4646
bool get isNullOrEmpty => this == null || this!.isEmpty;
4747

48-
bool get isSafeNotEmpty => !this.isNullOrEmpty;
48+
bool get isSafeNotEmpty => !isNullOrEmpty;
4949

5050
T? getOrNull(final int index) {
51-
if (this.isNullOrEmpty) return null;
51+
if (isNullOrEmpty) return null;
5252
return this![index];
5353
}
5454

@@ -61,13 +61,13 @@ extension ListExt<T> on List<T>? {
6161
return true;
6262
}
6363

64-
bool ne(List<T>? other) => !this.eq(other);
64+
bool ne(List<T>? other) => !eq(other);
6565
}
6666

6767
extension MapExt<K, V> on Map<K, V>? {
6868
bool get isNullOrEmpty => this == null || this!.isEmpty;
6969

70-
bool get isSafeNotEmpty => !this.isNullOrEmpty;
70+
bool get isSafeNotEmpty => !isNullOrEmpty;
7171

7272
bool eq(Map<K, V>? other) {
7373
if (this == null) return other == null;
@@ -80,7 +80,7 @@ extension MapExt<K, V> on Map<K, V>? {
8080
return true;
8181
}
8282

83-
bool ne(Map<K, V>? other) => !this.eq(other);
83+
bool ne(Map<K, V>? other) => !eq(other);
8484
}
8585

8686
extension NullableStringExt on String? {
@@ -91,7 +91,7 @@ extension NullableStringExt on String? {
9191
bool get isNotBlank => this != null && !this!.isBlank;
9292

9393
toast() async {
94-
if (this.isNullOrBlank) {
94+
if (isNullOrBlank) {
9595
return;
9696
}
9797
showToastWidget(
@@ -114,7 +114,7 @@ extension NullableStringExt on String? {
114114
boxShadow: [
115115
BoxShadow(
116116
color: Colors.black.withOpacity(0.024),
117-
offset: Offset(0, 1),
117+
offset: const Offset(0, 1),
118118
blurRadius: 3.0,
119119
spreadRadius: 3.0,
120120
),
@@ -136,7 +136,7 @@ extension NullableStringExt on String? {
136136
}
137137

138138
launchAppAndCopy() async {
139-
if (this.isNullOrBlank) return "内容为空,取消操作".toast();
139+
if (isNullOrBlank) return "内容为空,取消操作".toast();
140140
Future _doOtherAction() async {
141141
if (await canLaunch(this!)) {
142142
await launch(this!);
@@ -163,24 +163,24 @@ extension NullableStringExt on String? {
163163
}
164164

165165
copy() {
166-
if (this.isNullOrBlank) return "内容为空,取消操作".toast();
166+
if (isNullOrBlank) return "内容为空,取消操作".toast();
167167
FlutterClipboard.copy(this!).then((_) => "成功复制到剪切板".toast());
168168
}
169169

170170
share() {
171-
if (this.isNullOrBlank) return "内容为空,取消操作".toast();
171+
if (isNullOrBlank) return "内容为空,取消操作".toast();
172172
Share.share(this!);
173173
FlutterClipboard.copy(this!).then((_) => "尝试分享,并复制到剪切板".toast());
174174
}
175175
}
176176

177177
extension StringExt on String {
178178
bool get isBlank {
179-
if (this.length == 0) {
179+
if (length == 0) {
180180
return true;
181181
}
182-
for (var value in this.runes) {
183-
if (!this._isWhitespace(value)) {
182+
for (int value in runes) {
183+
if (!_isWhitespace(value)) {
184184
return false;
185185
}
186186
}
@@ -203,8 +203,8 @@ extension StringExt on String {
203203
rune == 0xFEFF;
204204

205205
String fillChar(String value, String char) {
206-
var offset = value.length - this.length;
207-
var newVal = this;
206+
int offset = value.length - length;
207+
String newVal = this;
208208
if (offset > 0) {
209209
for (int i = 0; i < offset; i++) {
210210
newVal = char + newVal;
@@ -351,12 +351,16 @@ Iterable<String> _debugWordWrap(String message, int width,
351351
switch (mode) {
352352
case _WordWrapParseMode
353353
.inSpace: // at start of break point (or start of line); can't break until next break
354-
while ((index < message.length) && (message[index] == ' ')) index += 1;
354+
while ((index < message.length) && (message[index] == ' ')) {
355+
index += 1;
356+
}
355357
lastWordStart = index;
356358
mode = _WordWrapParseMode.inWord;
357359
break;
358360
case _WordWrapParseMode.inWord: // looking for a good break point
359-
while ((index < message.length) && (message[index] != ' ')) index += 1;
361+
while ((index < message.length) && (message[index] != ' ')) {
362+
index += 1;
363+
}
360364
mode = _WordWrapParseMode.atBreak;
361365
break;
362366
case _WordWrapParseMode.atBreak: // at start of break point
@@ -380,8 +384,9 @@ Iterable<String> _debugWordWrap(String message, int width,
380384
if (lastWordEnd == index) {
381385
// we broke at current position
382386
// eat all the spaces, then set our start point
383-
while ((index < message.length) && (message[index] == ' '))
387+
while ((index < message.length) && (message[index] == ' ')) {
384388
index += 1;
389+
}
385390
start = index;
386391
mode = _WordWrapParseMode.inWord;
387392
} else {
@@ -406,22 +411,22 @@ Iterable<String> _debugWordWrap(String message, int width,
406411

407412
extension RefreshControllerExt on RefreshController {
408413
completed({bool noMore = false}) {
409-
if (this.isRefresh) {
410-
this.refreshCompleted();
411-
} else if (this.isLoading) {
414+
if (isRefresh) {
415+
refreshCompleted();
416+
} else if (isLoading) {
412417
if (noMore) {
413-
this.loadNoData();
418+
loadNoData();
414419
} else {
415-
this.loadComplete();
420+
loadComplete();
416421
}
417422
}
418423
}
419424

420425
failed() {
421-
if (this.isRefresh) {
422-
this.refreshFailed();
423-
} else if (this.isLoading) {
424-
this.loadFailed();
426+
if (isRefresh) {
427+
refreshFailed();
428+
} else if (isLoading) {
429+
loadFailed();
425430
}
426431
}
427432
}
@@ -498,14 +503,14 @@ extension BrightnessColor on Color {
498503

499504
extension ColorExt on Color {
500505
bool get isDark {
501-
return this.computeLuminance() < 0.5;
506+
return computeLuminance() < 0.5;
502507
}
503508
}
504509

505510
extension ThemeDataExt on ThemeData {
506-
Color get primary => this.colorScheme.primary;
511+
Color get primary => colorScheme.primary;
507512

508-
Color get secondary => this.colorScheme.secondary;
513+
Color get secondary => colorScheme.secondary;
509514
}
510515

511516
eee() {}

0 commit comments

Comments
 (0)