mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
opt: more linter (#1765)
* opt: more linter * fix [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
3787f99d35
commit
773bdafec3
@@ -64,5 +64,13 @@ linter:
|
||||
- use_null_aware_elements
|
||||
- unnecessary_lambdas
|
||||
- use_is_even_rather_than_modulo
|
||||
- unnecessary_async
|
||||
- unnecessary_await_in_return
|
||||
- unnecessary_getters_setters
|
||||
- prefer_const_literals_to_create_immutables
|
||||
- no_literal_bool_comparisons
|
||||
- use_truncating_division
|
||||
- use_string_buffers
|
||||
- unnecessary_statements
|
||||
# Additional information about this file can be found at
|
||||
# https://dart.dev/guides/language/analysis-options
|
||||
|
||||
@@ -704,7 +704,7 @@ class RichTextEditingController extends TextEditingController {
|
||||
}
|
||||
}
|
||||
|
||||
if (addIndex != null && toAdd != null && toAdd.isNotEmpty == true) {
|
||||
if (addIndex != null && toAdd != null && toAdd.isNotEmpty) {
|
||||
items.insertAll(addIndex, toAdd);
|
||||
}
|
||||
if (toDel != null && toDel.isNotEmpty) {
|
||||
|
||||
@@ -36,7 +36,7 @@ class DynGrpc {
|
||||
static Future<LoadingState<OpusDetailResp>> opusDetail({
|
||||
OpusType? opusType,
|
||||
required int oid,
|
||||
}) async {
|
||||
}) {
|
||||
return GrpcReq.request(
|
||||
GrpcUrl.opusDetail,
|
||||
OpusDetailReq(
|
||||
|
||||
@@ -164,8 +164,9 @@ class GrpcReq {
|
||||
int? code;
|
||||
String msg = response.headers.value('Grpc-Status-Details-Bin') ?? '';
|
||||
if (msg.isNotEmpty) {
|
||||
while (msg.length % 4 != 0) {
|
||||
msg += '=';
|
||||
final padding = -msg.length & 3;
|
||||
if (padding != 0) {
|
||||
msg += '=' * padding;
|
||||
}
|
||||
final msgBytes = base64Decode(msg);
|
||||
try {
|
||||
|
||||
@@ -62,9 +62,9 @@ class _FavNotePageState extends State<FavNotePage>
|
||||
const TextStyle(fontSize: 14),
|
||||
labelColor: theme.colorScheme.onSecondaryContainer,
|
||||
unselectedLabelColor: theme.colorScheme.outline,
|
||||
tabs: [
|
||||
const Tab(text: '未发布笔记'),
|
||||
const Tab(text: '公开笔记'),
|
||||
tabs: const [
|
||||
Tab(text: '未发布笔记'),
|
||||
Tab(text: '公开笔记'),
|
||||
],
|
||||
onTap: (index) {
|
||||
try {
|
||||
@@ -105,9 +105,9 @@ class _FavNotePageState extends State<FavNotePage>
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
children: [
|
||||
const FavNoteChildPage(isPublish: false),
|
||||
const FavNoteChildPage(isPublish: true),
|
||||
children: const [
|
||||
FavNoteChildPage(isPublish: false),
|
||||
FavNoteChildPage(isPublish: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -216,7 +216,7 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
|
||||
itemCount: newTags.length,
|
||||
),
|
||||
),
|
||||
response != null && response.isNotEmpty == true
|
||||
response != null && response.isNotEmpty
|
||||
? SliverGrid.builder(
|
||||
gridDelegate: gridDelegate,
|
||||
itemBuilder: (context, index) {
|
||||
|
||||
@@ -290,9 +290,7 @@ class _MemberHomeState extends State<MemberHome>
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Icon(
|
||||
visible == true
|
||||
? Icons.visibility
|
||||
: Icons.visibility_off,
|
||||
visible ? Icons.visibility : Icons.visibility_off,
|
||||
size: 17,
|
||||
color: color,
|
||||
),
|
||||
|
||||
@@ -47,7 +47,7 @@ class VideoCardHMemberVideo extends StatelessWidget {
|
||||
onSecondaryTap: Utils.isMobile ? null : onLongPress,
|
||||
onTap:
|
||||
onTap ??
|
||||
() async {
|
||||
() {
|
||||
final isPgc = videoItem.isPgc == true;
|
||||
final isPugv = videoItem.isPugv == true;
|
||||
if ((isPgc || isPugv) && videoItem.uri?.isNotEmpty == true) {
|
||||
|
||||
@@ -59,7 +59,7 @@ class _PopularSeriesPageState extends State<PopularSeriesPage> with GridMixin {
|
||||
return gridSkeleton;
|
||||
case Success<List<HotVideoItemModel>?>(:var response):
|
||||
Widget sliver;
|
||||
if (response != null && response.isNotEmpty == true) {
|
||||
if (response != null && response.isNotEmpty) {
|
||||
sliver = SliverGrid.builder(
|
||||
gridDelegate: gridDelegate,
|
||||
itemCount: response.length,
|
||||
|
||||
@@ -115,7 +115,7 @@ SettingsModel getBanwordModel({
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('保存'),
|
||||
onPressed: () async {
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
setState();
|
||||
onChanged(RegExp(banWord, caseSensitive: false));
|
||||
|
||||
@@ -21,9 +21,7 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
final theme = Theme.of(context);
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
appBar: widget.showAppBar == false
|
||||
? null
|
||||
: AppBar(title: const Text('推荐流设置')),
|
||||
appBar: widget.showAppBar ? AppBar(title: const Text('推荐流设置')) : null,
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(
|
||||
left: showAppBar ? padding.left : 0,
|
||||
|
||||
@@ -1719,7 +1719,7 @@ class VideoDetailController extends GetxController
|
||||
}
|
||||
|
||||
// interactive video
|
||||
if (isStein != true) {
|
||||
if (!isStein) {
|
||||
graphVersion = null;
|
||||
}
|
||||
steinEdgeInfo = null;
|
||||
|
||||
@@ -581,7 +581,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
(e) =>
|
||||
e.cid ==
|
||||
(skipPart
|
||||
? videoDetail.isPageReversed == true
|
||||
? videoDetail.isPageReversed
|
||||
? videoDetail.pages!.last.cid
|
||||
: videoDetail.pages!.first.cid
|
||||
: this.cid.value),
|
||||
@@ -663,7 +663,7 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
(e) =>
|
||||
e.cid ==
|
||||
(skipPart
|
||||
? videoDetail.isPageReversed == true
|
||||
? videoDetail.isPageReversed
|
||||
? videoDetail.pages!.last.cid
|
||||
: videoDetail.pages!.first.cid
|
||||
: this.cid.value),
|
||||
|
||||
@@ -714,7 +714,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
||||
spanChildren.add(
|
||||
WidgetSpan(
|
||||
child: NetworkImgLayer(
|
||||
src: emote.hasGifUrl() == true ? emote.gifUrl : emote.url,
|
||||
src: emote.hasGifUrl() ? emote.gifUrl : emote.url,
|
||||
type: ImageType.emote,
|
||||
width: size,
|
||||
height: size,
|
||||
|
||||
@@ -15,7 +15,7 @@ class ReplySearchChildController
|
||||
|
||||
@override
|
||||
List<SearchItem>? getDataList(SearchItemReply response) {
|
||||
if (response.cursor.hasNext == false) {
|
||||
if (!response.cursor.hasNext) {
|
||||
isEnd = true;
|
||||
}
|
||||
return response.items;
|
||||
|
||||
@@ -63,9 +63,9 @@ class _ReplySearchPageState extends State<ReplySearchPage> {
|
||||
children: [
|
||||
TabBar(
|
||||
controller: _controller.tabController,
|
||||
tabs: [
|
||||
const Tab(text: '视频'),
|
||||
const Tab(text: '专栏'),
|
||||
tabs: const [
|
||||
Tab(text: '视频'),
|
||||
Tab(text: '专栏'),
|
||||
],
|
||||
onTap: (index) {
|
||||
if (!_controller.tabController.indexIsChanging) {
|
||||
|
||||
@@ -64,7 +64,7 @@ class WebDav {
|
||||
Future<void> backup() async {
|
||||
if (_client == null) {
|
||||
final res = await init();
|
||||
if (res.first == false) {
|
||||
if (!res.first) {
|
||||
SmartDialog.showToast('备份失败,请检查配置: ${res.second}');
|
||||
return;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class WebDav {
|
||||
Future<void> restore() async {
|
||||
if (_client == null) {
|
||||
final res = await init();
|
||||
if (res.first == false) {
|
||||
if (!res.first) {
|
||||
SmartDialog.showToast('恢复失败,请检查配置: ${res.second}');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class WhisperSecController
|
||||
|
||||
@override
|
||||
List<Session>? getDataList(SessionSecondaryReply response) {
|
||||
if (response.paginationParams.hasMore == false) {
|
||||
if (!response.paginationParams.hasMore) {
|
||||
isEnd = true;
|
||||
}
|
||||
offset = response.paginationParams.offsets;
|
||||
|
||||
@@ -229,9 +229,9 @@ class PlPlayerController {
|
||||
|
||||
Offset initialFocalPoint = Offset.zero;
|
||||
|
||||
Future<void> exitDesktopPip() async {
|
||||
Future<void> exitDesktopPip() {
|
||||
isDesktopPip = false;
|
||||
await Future.wait([
|
||||
return Future.wait([
|
||||
windowManager.setTitleBarStyle(TitleBarStyle.normal),
|
||||
windowManager.setMinimumSize(const Size(400, 700)),
|
||||
windowManager.setBounds(_lastWindowBounds),
|
||||
@@ -1009,8 +1009,9 @@ class PlPlayerController {
|
||||
|
||||
/// 播放事件监听
|
||||
void startListeners() {
|
||||
final controllerStream = videoPlayerController!.stream;
|
||||
subscriptions = {
|
||||
videoPlayerController!.stream.playing.listen((event) {
|
||||
controllerStream.playing.listen((event) {
|
||||
WakelockPlus.toggle(enable: event);
|
||||
if (event) {
|
||||
if (_shouldSetPip) {
|
||||
@@ -1039,7 +1040,7 @@ class PlPlayerController {
|
||||
makeHeartBeat(positionSeconds.value, type: HeartBeatType.status);
|
||||
}
|
||||
}),
|
||||
videoPlayerController!.stream.completed.listen((event) {
|
||||
controllerStream.completed.listen((event) {
|
||||
if (event) {
|
||||
playerStatus.value = PlayerStatus.completed;
|
||||
|
||||
@@ -1052,7 +1053,7 @@ class PlPlayerController {
|
||||
}
|
||||
makeHeartBeat(positionSeconds.value, type: HeartBeatType.completed);
|
||||
}),
|
||||
videoPlayerController!.stream.position.listen((event) {
|
||||
controllerStream.position.listen((event) {
|
||||
position.value = event;
|
||||
updatePositionSecond();
|
||||
if (!isSliderMoving.value) {
|
||||
@@ -1066,14 +1067,14 @@ class PlPlayerController {
|
||||
}
|
||||
makeHeartBeat(event.inSeconds);
|
||||
}),
|
||||
videoPlayerController!.stream.duration.listen((Duration event) {
|
||||
controllerStream.duration.listen((Duration event) {
|
||||
duration.value = event;
|
||||
}),
|
||||
videoPlayerController!.stream.buffer.listen((Duration event) {
|
||||
controllerStream.buffer.listen((Duration event) {
|
||||
buffered.value = event;
|
||||
updateBufferedSecond();
|
||||
}),
|
||||
videoPlayerController!.stream.buffering.listen((bool event) {
|
||||
controllerStream.buffering.listen((bool event) {
|
||||
isBuffering.value = event;
|
||||
videoPlayerServiceHandler?.onStatusChange(
|
||||
playerStatus.value,
|
||||
@@ -1082,14 +1083,14 @@ class PlPlayerController {
|
||||
);
|
||||
}),
|
||||
if (kDebugMode)
|
||||
videoPlayerController!.stream.log.listen(((PlayerLog log) {
|
||||
controllerStream.log.listen(((PlayerLog log) {
|
||||
if (log.level == 'error' || log.level == 'fatal') {
|
||||
Utils.reportError('${log.prefix}: ${log.text}', null);
|
||||
} else {
|
||||
debugPrint(log.toString());
|
||||
}
|
||||
})),
|
||||
videoPlayerController!.stream.error.listen((String event) {
|
||||
controllerStream.error.listen((String event) {
|
||||
if (isFileSource && event.startsWith("Failed to open file")) {
|
||||
return;
|
||||
}
|
||||
@@ -1107,7 +1108,7 @@ class PlPlayerController {
|
||||
//tcp: ffurl_read returned 0xffffff99
|
||||
event.startsWith('tcp: ffurl_read returned ')) {
|
||||
EasyThrottle.throttle(
|
||||
'videoPlayerController!.stream.error.listen',
|
||||
'controllerStream.error.listen',
|
||||
const Duration(milliseconds: 10000),
|
||||
() {
|
||||
Future.delayed(const Duration(milliseconds: 3000), () async {
|
||||
@@ -1141,7 +1142,7 @@ class PlPlayerController {
|
||||
SmartDialog.showToast('视频加载错误, $event');
|
||||
}
|
||||
}),
|
||||
// videoPlayerController!.stream.volume.listen((event) {
|
||||
// controllerStream.volume.listen((event) {
|
||||
// if (!mute.value && _volumeBeforeMute != event) {
|
||||
// _volumeBeforeMute = event / 100;
|
||||
// }
|
||||
@@ -1167,8 +1168,8 @@ class PlPlayerController {
|
||||
}
|
||||
|
||||
/// 移除事件监听
|
||||
Future<void> removeListeners() async {
|
||||
await Future.wait(subscriptions.map((e) => e.cancel()));
|
||||
Future<void> removeListeners() {
|
||||
return Future.wait(subscriptions.map((e) => e.cancel()));
|
||||
}
|
||||
|
||||
/// 跳转至指定位置
|
||||
@@ -1405,7 +1406,7 @@ class PlPlayerController {
|
||||
}
|
||||
|
||||
/// 设置后台播放
|
||||
Future<void> setBackgroundPlay(bool val) async {
|
||||
void setBackgroundPlay(bool val) {
|
||||
videoPlayerServiceHandler?.enableBackgroundPlay = val;
|
||||
if (!tempPlayerConf) {
|
||||
setting.put(SettingBoxKey.enableBackgroundPlay, val);
|
||||
|
||||
@@ -655,7 +655,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
||||
|
||||
/// 字幕
|
||||
BottomControlType.subtitle => Obx(
|
||||
() => videoDetailController.subtitles.isEmpty == true
|
||||
() => videoDetailController.subtitles.isEmpty
|
||||
? const SizedBox.shrink()
|
||||
: PopupMenuButton<int>(
|
||||
tooltip: '字幕',
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:get/get_utils/get_utils.dart';
|
||||
|
||||
Future<VideoPlayerServiceHandler> initAudioService() async {
|
||||
Future<VideoPlayerServiceHandler> initAudioService() {
|
||||
return AudioService.init(
|
||||
builder: VideoPlayerServiceHandler.new,
|
||||
config: const AudioServiceConfig(
|
||||
|
||||
@@ -568,7 +568,7 @@ abstract class RequestUtils {
|
||||
onClose: (Map<String, dynamic> message) {
|
||||
SmartDialog.showToast('关闭验证');
|
||||
},
|
||||
onResult: (Map<String, dynamic> message) async {
|
||||
onResult: (Map<String, dynamic> message) {
|
||||
if (kDebugMode) debugPrint("Captcha result: $message");
|
||||
String code = message["code"];
|
||||
if (code == "1") {
|
||||
|
||||
Reference in New Issue
Block a user