diff --git a/lib/common/widgets/image/network_img_layer.dart b/lib/common/widgets/image/network_img_layer.dart index 27a74b021..428f9ce11 100644 --- a/lib/common/widgets/image/network_img_layer.dart +++ b/lib/common/widgets/image/network_img_layer.dart @@ -42,7 +42,7 @@ class NetworkImgLayer extends StatelessWidget { @override Widget build(BuildContext context) { - return src.isNullOrEmpty.not + return src?.isNotEmpty == true ? type == ImageType.avatar ? ClipOval(child: _buildImage(context)) : radius == 0 || type == ImageType.emote diff --git a/lib/http/reply.dart b/lib/http/reply.dart index a5d97854c..323dd71bf 100644 --- a/lib/http/reply.dart +++ b/lib/http/reply.dart @@ -6,7 +6,6 @@ import 'package:PiliPlus/models/video/reply/data.dart'; import 'package:PiliPlus/models/video/reply/emote.dart'; import 'package:PiliPlus/models/video/reply/item.dart'; import 'package:PiliPlus/utils/accounts/account.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:dio/dio.dart'; @@ -17,7 +16,6 @@ class ReplyHttp { static RegExp replyRegExp = RegExp(GStorage.banWordForReply, caseSensitive: false); - @Deprecated('Use replyListGrpc instead') static Future replyList({ required bool isLogin, required int oid, @@ -38,7 +36,7 @@ class ReplyHttp { '{"offset":"${nextOffset.replaceAll('"', '\\"')}"}', 'mode': sort + 2, //2:按时间排序;3:按热度排序 }, - options: isLogin.not ? _options : null, + options: !isLogin ? _options : null, ) : await Request().get( Api.replyList, @@ -49,7 +47,7 @@ class ReplyHttp { 'pn': page, 'ps': 20, }, - options: isLogin.not ? _options : null, + options: !isLogin ? _options : null, ); if (res.data['code'] == 0) { ReplyData replyData = ReplyData.fromJson(res.data['data']); @@ -59,7 +57,7 @@ class ReplyHttp { replyData.topReplies!.removeWhere((item) { bool hasMatch = replyRegExp.hasMatch(item.content?.message ?? ''); // remove subreplies - if (hasMatch.not) { + if (!hasMatch) { if (item.replies?.isNotEmpty == true) { item.replies!.removeWhere((item) => replyRegExp.hasMatch(item.content?.message ?? '')); @@ -74,7 +72,7 @@ class ReplyHttp { replyData.replies!.removeWhere((item) { bool hasMatch = replyRegExp.hasMatch(item.content?.message ?? ''); // remove subreplies - if (hasMatch.not) { + if (!hasMatch) { if (item.replies?.isNotEmpty == true) { item.replies!.removeWhere((item) => replyRegExp.hasMatch(item.content?.message ?? '')); @@ -92,7 +90,7 @@ class ReplyHttp { replyData.topReplies!.removeWhere((item) { bool hasMatch = needRemove(item); // remove subreplies - if (hasMatch.not) { + if (!hasMatch) { if (item.replies?.isNotEmpty == true) { item.replies!.removeWhere(needRemove); } @@ -106,7 +104,7 @@ class ReplyHttp { replyData.replies!.removeWhere((item) { bool hasMatch = needRemove(item); // remove subreplies - if (hasMatch.not) { + if (!hasMatch) { if (item.replies?.isNotEmpty == true) { item.replies!.removeWhere(needRemove); } @@ -137,7 +135,6 @@ class ReplyHttp { return false; } - @Deprecated('Use replyReplyListGrpc instead') static Future> replyReplyList({ required bool isLogin, required int oid, @@ -158,7 +155,7 @@ class ReplyHttp { 'sort': 1, if (isLogin) 'csrf': Accounts.main.csrf, }, - options: isLogin.not ? _options : null, + options: !isLogin ? _options : null, ); if (res.data['code'] == 0) { ReplyReplyData replyData = ReplyReplyData.fromJson(res.data['data']); diff --git a/lib/http/video.dart b/lib/http/video.dart index fa7a0048c..32b12afc9 100644 --- a/lib/http/video.dart +++ b/lib/http/video.dart @@ -230,7 +230,7 @@ class VideoHttp { 'data': data, }; } else { - if (epid != null && usePgcApi.not && forcePgcApi != true) { + if (epid != null && !usePgcApi && forcePgcApi != true) { return videoUrl( avid: avid, bvid: bvid, diff --git a/lib/pages/article/view.dart b/lib/pages/article/view.dart index 9a3f1efa2..b9ac4e524 100644 --- a/lib/pages/article/view.dart +++ b/lib/pages/article/view.dart @@ -616,7 +616,7 @@ class _ArticlePageState extends State upMid: _articleCtr.upMid, callback: _getImageCallback, onCheckReply: (item) => - _articleCtr.onCheckReply(context, item), + _articleCtr.onCheckReply(context, item, isManual: true), onToggleTop: (isUpTop, rpid) => _articleCtr.onToggleTop( index, _articleCtr.commentId, @@ -816,7 +816,7 @@ class _ArticlePageState extends State tooltip: '评论动态', child: const Icon(Icons.reply), ); - return _articleCtr.showDynActionBar.not + return !_articleCtr.showDynActionBar ? Align( alignment: Alignment.bottomRight, child: Padding( diff --git a/lib/pages/bangumi/controller.dart b/lib/pages/bangumi/controller.dart index c93352302..0ff13062d 100644 --- a/lib/pages/bangumi/controller.dart +++ b/lib/pages/bangumi/controller.dart @@ -68,7 +68,7 @@ class BangumiController extends CommonListController< // 我的订阅 Future queryBangumiFollow([bool isRefresh = true]) async { - if (isLogin.value.not || followLoading || (isRefresh.not && followEnd)) { + if (!isLogin.value || followLoading || (!isRefresh && followEnd)) { return; } followLoading = true; @@ -119,7 +119,7 @@ class BangumiController extends CommonListController< Future?>> customGetData() => BangumiHttp.bangumiList( page: page, - indexType: tabType == HomeTabType.cinema ? 102 : null, // TODO: sort + indexType: tabType == HomeTabType.cinema ? 102 : null, ); @override diff --git a/lib/pages/common/common_publish_page.dart b/lib/pages/common/common_publish_page.dart index e8bfb643b..b11f88956 100644 --- a/lib/pages/common/common_publish_page.dart +++ b/lib/pages/common/common_publish_page.dart @@ -54,7 +54,7 @@ abstract class CommonPublishPageState super.initState(); WidgetsBinding.instance.addObserver(this); - if (widget.initialValue.isNullOrEmpty.not) { + if (widget.initialValue?.trim().isNotEmpty == true) { enablePublish.value = true; } diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index ad0e41f22..465731c1f 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -189,13 +189,7 @@ abstract class ReplyController extends CommonListController { // check reply if (enableCommAntifraud && context.mounted) { - ReplyUtils.onCheckReply( - context: context, - replyInfo: replyInfo, - biliSendCommAntifraud: _biliSendCommAntifraud, - sourceId: sourceId, - isManual: false, - ); + onCheckReply(context, replyInfo, isManual: false); } } }, @@ -215,13 +209,14 @@ abstract class ReplyController extends CommonListController { loadingState.refresh(); } - void onCheckReply(BuildContext context, ReplyInfo replyInfo) { + void onCheckReply(BuildContext context, ReplyInfo replyInfo, + {required bool isManual}) { ReplyUtils.onCheckReply( context: context, replyInfo: replyInfo, biliSendCommAntifraud: _biliSendCommAntifraud, sourceId: sourceId, - isManual: true, + isManual: isManual, ); } diff --git a/lib/pages/danmaku/view.dart b/lib/pages/danmaku/view.dart index 0f364c591..cd3d51c28 100644 --- a/lib/pages/danmaku/view.dart +++ b/lib/pages/danmaku/view.dart @@ -6,7 +6,6 @@ import 'package:PiliPlus/pages/danmaku/controller.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart'; import 'package:PiliPlus/plugin/pl_player/models/play_status.dart'; import 'package:PiliPlus/utils/danmaku_utils.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:canvas_danmaku/canvas_danmaku.dart'; import 'package:flutter/material.dart'; @@ -90,7 +89,7 @@ class _PlDanmakuState extends State { return; } - if (playerController.showDanmaku.not && widget.isPipMode != true) { + if (!playerController.showDanmaku && widget.isPipMode != true) { return; } diff --git a/lib/pages/dynamics/widgets/action_panel.dart b/lib/pages/dynamics/widgets/action_panel.dart index 1b57e09bd..90127d0c3 100644 --- a/lib/pages/dynamics/widgets/action_panel.dart +++ b/lib/pages/dynamics/widgets/action_panel.dart @@ -1,7 +1,6 @@ import 'package:PiliPlus/http/dynamics.dart'; import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/pages/dynamics_repost/view.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/page_utils.dart'; import 'package:PiliPlus/utils/utils.dart'; @@ -23,7 +22,7 @@ class ActionPanel extends StatefulWidget { class _ActionPanelState extends State { bool isProcessing = false; Future handleState(Future Function() action) async { - if (isProcessing.not) { + if (!isProcessing) { isProcessing = true; await action(); isProcessing = false; diff --git a/lib/pages/dynamics/widgets/dynamic_panel.dart b/lib/pages/dynamics/widgets/dynamic_panel.dart index a7c65834b..979fb2e1a 100644 --- a/lib/pages/dynamics/widgets/dynamic_panel.dart +++ b/lib/pages/dynamics/widgets/dynamic_panel.dart @@ -6,7 +6,6 @@ import 'package:PiliPlus/pages/dynamics/widgets/author_panel.dart'; import 'package:PiliPlus/pages/dynamics/widgets/blocked_item.dart'; import 'package:PiliPlus/pages/dynamics/widgets/content_panel.dart'; import 'package:PiliPlus/pages/dynamics/widgets/module_panel.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/page_utils.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -47,7 +46,7 @@ class DynamicPanel extends StatelessWidget { color: Colors.transparent, child: InkWell( onTap: source == 'detail' && - const { + !const { 'DYNAMIC_TYPE_AV', 'DYNAMIC_TYPE_UGC_SEASON', 'DYNAMIC_TYPE_PGC_UNION', @@ -55,7 +54,7 @@ class DynamicPanel extends StatelessWidget { 'DYNAMIC_TYPE_LIVE', 'DYNAMIC_TYPE_LIVE_RCMD', 'DYNAMIC_TYPE_MEDIALIST', - }.contains(item.type).not + }.contains(item.type) ? null : () => PageUtils.pushDynDetail(item, 1), onLongPress: () => _imageSaveDialog(context, authorWidget.morePanel), diff --git a/lib/pages/dynamics_detail/view.dart b/lib/pages/dynamics_detail/view.dart index 9f3ebabd5..550231006 100644 --- a/lib/pages/dynamics_detail/view.dart +++ b/lib/pages/dynamics_detail/view.dart @@ -17,7 +17,6 @@ import 'package:PiliPlus/pages/dynamics_detail/controller.dart'; import 'package:PiliPlus/pages/dynamics_repost/view.dart'; import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart'; import 'package:PiliPlus/pages/video/reply_reply/view.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/grid.dart'; import 'package:PiliPlus/utils/page_utils.dart'; @@ -425,7 +424,7 @@ class _DynamicDetailPageState extends State tooltip: '评论动态', child: const Icon(Icons.reply), ); - return _controller.showDynActionBar.not + return !_controller.showDynActionBar ? Align( alignment: Alignment.bottomRight, child: Padding( @@ -733,7 +732,7 @@ class _DynamicDetailPageState extends State upMid: _controller.upMid, callback: _getImageCallback, onCheckReply: (item) => - _controller.onCheckReply(context, item), + _controller.onCheckReply(context, item, isManual: true), onToggleTop: (isUpTop, rpid) => _controller.onToggleTop( index, _controller.oid, diff --git a/lib/pages/dynamics_repost/view.dart b/lib/pages/dynamics_repost/view.dart index f0be09ff2..1a57e20ad 100644 --- a/lib/pages/dynamics_repost/view.dart +++ b/lib/pages/dynamics_repost/view.dart @@ -8,7 +8,6 @@ import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/pages/common/common_publish_page.dart'; import 'package:PiliPlus/pages/emote/controller.dart'; import 'package:PiliPlus/pages/emote/view.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/request_utils.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:flutter/material.dart' hide DraggableScrollableSheet; @@ -245,7 +244,7 @@ class _RepostPanelState extends CommonPublishPageState { ), ); - Widget _buildAppBar(ThemeData theme) => _isMax.not + Widget _buildAppBar(ThemeData theme) => !_isMax ? Row( children: [ const SizedBox(width: 16), diff --git a/lib/pages/fav_detail/view.dart b/lib/pages/fav_detail/view.dart index 7d10db811..4b51d26c0 100644 --- a/lib/pages/fav_detail/view.dart +++ b/lib/pages/fav_detail/view.dart @@ -11,7 +11,6 @@ import 'package:PiliPlus/models/user/fav_folder.dart'; import 'package:PiliPlus/pages/fav_detail/controller.dart'; import 'package:PiliPlus/pages/fav_detail/widget/fav_video_card.dart'; import 'package:PiliPlus/pages/fav_sort/view.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/grid.dart'; import 'package:PiliPlus/utils/page_utils.dart'; import 'package:PiliPlus/utils/request_utils.dart'; @@ -43,7 +42,7 @@ class _FavDetailPageState extends State { final theme = Theme.of(context); return Obx( () => PopScope( - canPop: _favDetailController.enableMultiSelect.value.not, + canPop: !_favDetailController.enableMultiSelect.value, onPopInvokedWithResult: (didPop, result) { if (_favDetailController.enableMultiSelect.value) { _favDetailController.handleSelect(); @@ -413,8 +412,8 @@ class _FavDetailPageState extends State { : null, onLongPress: _favDetailController.isOwner.value ? () { - if (_favDetailController - .enableMultiSelect.value.not) { + if (!_favDetailController + .enableMultiSelect.value) { _favDetailController .enableMultiSelect.value = true; _favDetailController.onSelect(index); diff --git a/lib/pages/fav_detail/widget/fav_video_card.dart b/lib/pages/fav_detail/widget/fav_video_card.dart index 200c0a8d9..0a83511db 100644 --- a/lib/pages/fav_detail/widget/fav_video_card.dart +++ b/lib/pages/fav_detail/widget/fav_video_card.dart @@ -8,7 +8,6 @@ import 'package:PiliPlus/http/search.dart'; import 'package:PiliPlus/http/video.dart'; import 'package:PiliPlus/models/common/badge_type.dart'; import 'package:PiliPlus/models/user/fav_detail.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/id_utils.dart'; import 'package:PiliPlus/utils/page_utils.dart'; import 'package:PiliPlus/utils/utils.dart'; @@ -63,7 +62,7 @@ class FavVideoCardH extends StatelessWidget { } } - if ([0, 16].contains(videoItem.attr).not) { + if (!const [0, 16].contains(videoItem.attr)) { Get.toNamed('/member?mid=${videoItem.owner.mid}'); return; } diff --git a/lib/pages/fav_folder_sort/view.dart b/lib/pages/fav_folder_sort/view.dart index b2a021656..4064cd533 100644 --- a/lib/pages/fav_folder_sort/view.dart +++ b/lib/pages/fav_folder_sort/view.dart @@ -3,7 +3,6 @@ import 'package:PiliPlus/http/user.dart'; import 'package:PiliPlus/models/user/fav_folder.dart'; import 'package:PiliPlus/pages/fav/video/controller.dart'; import 'package:PiliPlus/pages/fav/video/widgets/item.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -50,7 +49,7 @@ class _FavFolderSortPageState extends State { @override void initState() { super.initState(); - if (_favController.isEnd.not) { + if (!_favController.isEnd) { _scrollController.addListener(listener); } } diff --git a/lib/pages/fav_sort/view.dart b/lib/pages/fav_sort/view.dart index 0d0da0204..51c5051a0 100644 --- a/lib/pages/fav_sort/view.dart +++ b/lib/pages/fav_sort/view.dart @@ -51,7 +51,7 @@ class _FavSortPageState extends State { @override void initState() { super.initState(); - if (_favDetailController.isEnd.not) { + if (!_favDetailController.isEnd) { _scrollController.addListener(listener); } } diff --git a/lib/pages/history/controller.dart b/lib/pages/history/controller.dart index 6ce0b3455..ff3ab07fc 100644 --- a/lib/pages/history/controller.dart +++ b/lib/pages/history/controller.dart @@ -60,7 +60,7 @@ class HistoryController extends MultiSelectController loadingState.refresh(); } } - if (checked.not) { + if (!checked) { baseCtr.enableMultiSelect.value = false; } } diff --git a/lib/pages/history/view.dart b/lib/pages/history/view.dart index 1b90a6082..1cac96412 100644 --- a/lib/pages/history/view.dart +++ b/lib/pages/history/view.dart @@ -59,7 +59,7 @@ class _HistoryPageState extends State ? _buildPage : Obx( () => PopScope( - canPop: enableMultiSelect.not, + canPop: !enableMultiSelect, onPopInvokedWithResult: (didPop, result) { if (enableMultiSelect) { currCtr().handleSelect(); @@ -184,8 +184,8 @@ class _HistoryPageState extends State TabBar( controller: _historyController.tabController, onTap: (index) { - if (_historyController - .tabController!.indexIsChanging.not) { + if (!_historyController + .tabController!.indexIsChanging) { currCtr().scrollController.animToTop(); } else { if (enableMultiSelect) { diff --git a/lib/pages/home/view.dart b/lib/pages/home/view.dart index 885ddfe64..02437a7e4 100644 --- a/lib/pages/home/view.dart +++ b/lib/pages/home/view.dart @@ -6,7 +6,6 @@ import 'package:PiliPlus/models/common/image_type.dart'; import 'package:PiliPlus/pages/home/controller.dart'; import 'package:PiliPlus/pages/main/controller.dart'; import 'package:PiliPlus/pages/mine/controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -58,7 +57,7 @@ class _HomePageState extends State tabAlignment: TabAlignment.center, onTap: (value) { feedBack(); - if (_homeController.tabController.indexIsChanging.not) { + if (!_homeController.tabController.indexIsChanging) { _homeController.animateToTop(); } }, diff --git a/lib/pages/later/child_view.dart b/lib/pages/later/child_view.dart index 9a343dc0d..734a7ee9b 100644 --- a/lib/pages/later/child_view.dart +++ b/lib/pages/later/child_view.dart @@ -8,7 +8,6 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/models/common/later_view_type.dart'; import 'package:PiliPlus/models/model_hot_video_item.dart'; import 'package:PiliPlus/pages/later/controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/grid.dart'; import 'package:PiliPlus/utils/page_utils.dart'; import 'package:PiliPlus/utils/utils.dart'; @@ -101,13 +100,12 @@ class _LaterViewChildPageState extends State }, ); }, - onTap: - _laterController.baseCtr.enableMultiSelect.value.not - ? null - : () => _laterController.onSelect(index), + onTap: !_laterController.baseCtr.enableMultiSelect.value + ? null + : () => _laterController.onSelect(index), onLongPress: () { - if (_laterController - .baseCtr.enableMultiSelect.value.not) { + if (!_laterController + .baseCtr.enableMultiSelect.value) { _laterController.baseCtr.enableMultiSelect.value = true; _laterController.onSelect(index); diff --git a/lib/pages/later/controller.dart b/lib/pages/later/controller.dart index 7864ef5e0..c0682200c 100644 --- a/lib/pages/later/controller.dart +++ b/lib/pages/later/controller.dart @@ -53,7 +53,7 @@ class LaterController extends MultiSelectController { loadingState.refresh(); } } - if (checked.not) { + if (!checked) { baseCtr.enableMultiSelect.value = false; } } diff --git a/lib/pages/later/view.dart b/lib/pages/later/view.dart index 719da7aab..9f717a1ff 100644 --- a/lib/pages/later/view.dart +++ b/lib/pages/later/view.dart @@ -58,7 +58,7 @@ class _LaterPageState extends State Widget build(BuildContext context) { return Obx( () => PopScope( - canPop: _baseCtr.enableMultiSelect.value.not, + canPop: !_baseCtr.enableMultiSelect.value, onPopInvokedWithResult: (didPop, result) { if (_baseCtr.enableMultiSelect.value) { currCtr().handleSelect(); @@ -91,7 +91,7 @@ class _LaterPageState extends State text: '${item.title}${count != -1 ? '($count)' : ''}'); }).toList(), onTap: (_) { - if (_tabController.indexIsChanging.not) { + if (!_tabController.indexIsChanging) { currCtr().scrollController.animToTop(); } else { if (_baseCtr.enableMultiSelect.value) { diff --git a/lib/pages/main/controller.dart b/lib/pages/main/controller.dart index 74dfd76d7..55f077759 100644 --- a/lib/pages/main/controller.dart +++ b/lib/pages/main/controller.dart @@ -6,7 +6,6 @@ import 'package:PiliPlus/grpc/im.dart'; import 'package:PiliPlus/models/common/dynamic/dynamic_badge_mode.dart'; import 'package:PiliPlus/models/common/msg/msg_unread_type.dart'; import 'package:PiliPlus/models/common/nav_bar_config.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:PiliPlus/utils/utils.dart'; import 'package:get/get.dart'; @@ -75,7 +74,7 @@ class MainController extends GetxController { } Future queryUnreadMsg() async { - if (isLogin.value.not || homeIndex == -1 || msgUnReadTypes.isEmpty) { + if (!isLogin.value || homeIndex == -1 || msgUnReadTypes.isEmpty) { msgUnReadCount.value = ''; return; } diff --git a/lib/pages/member_dynamics/controller.dart b/lib/pages/member_dynamics/controller.dart index bd0e6ac89..be51cd0d0 100644 --- a/lib/pages/member_dynamics/controller.dart +++ b/lib/pages/member_dynamics/controller.dart @@ -4,7 +4,6 @@ import 'package:PiliPlus/http/member.dart'; import 'package:PiliPlus/http/msg.dart'; import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/pages/common/common_list_controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; class MemberDynamicsController @@ -27,7 +26,7 @@ class MemberDynamicsController @override Future queryData([bool isRefresh = true]) { - if (isRefresh.not && (isEnd || offset == '-1')) { + if (!isRefresh && (isEnd || offset == '-1')) { return Future.value(); } return super.queryData(isRefresh); diff --git a/lib/pages/member_video/controller.dart b/lib/pages/member_video/controller.dart index fe2844b9a..63f1abe2f 100644 --- a/lib/pages/member_video/controller.dart +++ b/lib/pages/member_video/controller.dart @@ -191,7 +191,7 @@ class MemberVideoCtr (type == ContributeType.video ? order.value == 'click' : sort.value == 'asc') - ? desc.not + ? !desc : desc; PageUtils.toVideoPage( 'bvid=${element.bvid}&cid=${element.cid}', diff --git a/lib/pages/msg_feed_top/sys_msg/controller.dart b/lib/pages/msg_feed_top/sys_msg/controller.dart index 224f1dcc7..0f7d4942f 100644 --- a/lib/pages/msg_feed_top/sys_msg/controller.dart +++ b/lib/pages/msg_feed_top/sys_msg/controller.dart @@ -2,7 +2,6 @@ import 'package:PiliPlus/http/loading_state.dart'; import 'package:PiliPlus/http/msg.dart'; import 'package:PiliPlus/models/msg/msgfeed_sys_msg.dart'; import 'package:PiliPlus/pages/common/common_list_controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; class SysMsgController @@ -22,7 +21,7 @@ class SysMsgController msgSysUpdateCursor(dataList.first.cursor); } cursor = dataList.last.cursor ?? -1; - if (isEnd.not && dataList.length + 1 < pageSize) { + if (!isEnd && dataList.length + 1 < pageSize) { isEnd = true; } } diff --git a/lib/pages/search_result/view.dart b/lib/pages/search_result/view.dart index f64af7f89..b1403cfc5 100644 --- a/lib/pages/search_result/view.dart +++ b/lib/pages/search_result/view.dart @@ -7,7 +7,6 @@ import 'package:PiliPlus/pages/search_panel/pgc/view.dart'; import 'package:PiliPlus/pages/search_panel/user/view.dart'; import 'package:PiliPlus/pages/search_panel/video/view.dart'; import 'package:PiliPlus/pages/search_result/controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -137,7 +136,7 @@ class _SearchResultPageState extends State unselectedLabelColor: theme.colorScheme.outline, tabAlignment: TabAlignment.start, onTap: (index) { - if (_tabController.indexIsChanging.not) { + if (!_tabController.indexIsChanging) { if (_searchResultController.toTopIndex.value == index) { _searchResultController.toTopIndex.refresh(); } else { diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index fb89c3792..59b65198c 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -45,7 +45,6 @@ import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart'; import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart'; import 'package:PiliPlus/utils/accounts/account_manager/account_mgr.dart'; import 'package:PiliPlus/utils/cache_manage.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/global_data.dart'; import 'package:PiliPlus/utils/recommend_filter.dart'; @@ -1394,7 +1393,7 @@ List get recommendSettings => [ try { RcmdController ctr = Get.find() ..savedRcmdTip = value; - if (value.not) { + if (!value) { ctr.lastRefreshAt = null; } } catch (e) { @@ -1467,7 +1466,7 @@ List get privacySettings => [ SettingsModel( settingsType: SettingsType.normal, onTap: (setState) { - if (Accounts.main.isLogin.not) { + if (!Accounts.main.isLogin) { SmartDialog.showToast('登录后查看'); return; } diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index 82b14bcae..e9e1c3fe3 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -38,7 +38,6 @@ import 'package:PiliPlus/pages/video/widgets/header_control.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart'; import 'package:PiliPlus/plugin/pl_player/models/data_source.dart'; import 'package:PiliPlus/plugin/pl_player/models/play_status.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/id_utils.dart'; import 'package:PiliPlus/utils/page_utils.dart'; import 'package:PiliPlus/utils/storage.dart'; @@ -152,7 +151,7 @@ class VideoDetailController extends GetxController ? 'horizontal' : 'vertical' : 'horizontal'; - if (scrollCtr.hasClients.not) { + if (!scrollCtr.hasClients) { videoHeight = direction == 'vertical' ? maxVideoHeight : minVideoHeight; this.direction.value = direction; return; @@ -296,7 +295,7 @@ class VideoDetailController extends GetxController bool isReverse = false, bool isLoadPrevious = false, }) async { - if (isReverse.not && + if (!isReverse && Get.arguments['count'] != null && mediaList.length >= Get.arguments['count']) { return; diff --git a/lib/pages/video/introduction/pgc/controller.dart b/lib/pages/video/introduction/pgc/controller.dart index 057961cec..abdaf8160 100644 --- a/lib/pages/video/introduction/pgc/controller.dart +++ b/lib/pages/video/introduction/pgc/controller.dart @@ -18,7 +18,6 @@ import 'package:PiliPlus/pages/video/introduction/ugc/controller.dart'; import 'package:PiliPlus/pages/video/pay_coins/view.dart'; import 'package:PiliPlus/pages/video/reply/controller.dart'; import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/global_data.dart'; import 'package:PiliPlus/utils/page_utils.dart'; @@ -121,7 +120,7 @@ class BangumiIntroController extends GetxController { if (res['status']) { SmartDialog.showToast('投币成功'); bangumiItem.stat!.coins = bangumiItem.stat!.coins! + coin; - if (selectLike && hasLike.value.not) { + if (selectLike && !hasLike.value) { hasLike.value = true; bangumiItem.stat!.likes = bangumiItem.stat!.likes! + 1; } @@ -192,7 +191,7 @@ class BangumiIntroController extends GetxController { for (var i in favFolderData.value.list!.toList()) { bool isFaved = favIds?.contains(i.id) == true; if (i.favState == 1) { - if (isFaved.not) { + if (!isFaved) { addMediaIdsNew.add(i.id); } } else { diff --git a/lib/pages/video/introduction/pgc/view.dart b/lib/pages/video/introduction/pgc/view.dart index 78c76855c..2256cc72b 100644 --- a/lib/pages/video/introduction/pgc/view.dart +++ b/lib/pages/video/introduction/pgc/view.dart @@ -47,7 +47,7 @@ class _BangumiIntroPanelState extends State bool isProcessing = false; Future handleState(FutureOr Function() action) async { - if (isProcessing.not) { + if (!isProcessing) { isProcessing = true; await action(); isProcessing = false; diff --git a/lib/pages/video/introduction/ugc/controller.dart b/lib/pages/video/introduction/ugc/controller.dart index be55aac7d..50e23c4ca 100644 --- a/lib/pages/video/introduction/ugc/controller.dart +++ b/lib/pages/video/introduction/ugc/controller.dart @@ -166,7 +166,7 @@ class VideoIntroController extends GetxController { if (videoDetailController.videoItem['pic'] == null || videoDetailController.videoItem['pic'] == '' || (videoDetailController.videoUrl.isNullOrEmpty && - videoDetailController.isQuerying.not)) { + !videoDetailController.isQuerying)) { videoDetailController.videoItem['pic'] = data.pic; } if (videoDetailController.showReply) { @@ -340,7 +340,7 @@ class VideoIntroController extends GetxController { _coinNum.value += coin; GlobalData().afterCoin(coin); videoDetail.value.stat!.coin = videoDetail.value.stat!.coin! + coin; - if (selectLike && hasLike.value.not) { + if (selectLike && !hasLike.value) { hasLike.value = true; videoDetail.value.stat!.like = videoDetail.value.stat!.like! + 1; } @@ -411,7 +411,7 @@ class VideoIntroController extends GetxController { for (var i in favFolderData.value.list!.toList()) { bool isFaved = favIds?.contains(i.id) == true; if (i.favState == 1) { - if (isFaved.not) { + if (!isFaved) { addMediaIdsNew.add(i.id); } } else { @@ -695,7 +695,7 @@ class VideoIntroController extends GetxController { // 查看同时在看人数 Future queryOnlineTotal() async { - if (isShowOnlineTotal.not) { + if (!isShowOnlineTotal) { return; } var result = await VideoHttp.onlineTotal( @@ -723,7 +723,7 @@ class VideoIntroController extends GetxController { final videoDetailCtr = Get.find(tag: heroTag); - if (skipPages.not && (videoDetail.value.pages?.length ?? 0) > 1) { + if (!skipPages && (videoDetail.value.pages?.length ?? 0) > 1) { isPages = true; final List pages = videoDetail.value.pages!; episodes.addAll(pages); @@ -775,7 +775,7 @@ class VideoIntroController extends GetxController { final videoDetailCtr = Get.find(tag: heroTag); // part -> playall -> season - if (skipPages.not && (videoDetail.value.pages?.length ?? 0) > 1) { + if (!skipPages && (videoDetail.value.pages?.length ?? 0) > 1) { isPages = true; final List pages = videoDetail.value.pages!; episodes.addAll(pages); @@ -811,7 +811,7 @@ class VideoIntroController extends GetxController { int nextIndex = currentIndex + 1; - if (isPages.not && + if (!isPages && videoDetailCtr.isPlayAll && currentIndex == episodes.length - 2) { videoDetailCtr.getMediaList(); diff --git a/lib/pages/video/introduction/ugc/view.dart b/lib/pages/video/introduction/ugc/view.dart index 5a56cb762..099917a1b 100644 --- a/lib/pages/video/introduction/ugc/view.dart +++ b/lib/pages/video/introduction/ugc/view.dart @@ -203,7 +203,7 @@ class _VideoInfoState extends State { ); Future handleState(FutureOr Function() action) async { - if (isProcessing.not) { + if (!isProcessing) { isProcessing = true; await action(); isProcessing = false; @@ -223,7 +223,7 @@ class _VideoInfoState extends State { initialExpanded: alwaysExapndIntroPanel, ); - if (alwaysExapndIntroPanel.not && GStorage.exapndIntroPanelH) { + if (!alwaysExapndIntroPanel && GStorage.exapndIntroPanelH) { WidgetsBinding.instance.addPostFrameCallback((_) { if (context.orientation == Orientation.landscape && videoIntroController.expandableCtr?.expanded == false) { @@ -684,7 +684,8 @@ class _VideoInfoState extends State { ), ), if (videoIntroController - .videoDetail.value.descV2.isNullOrEmpty.not) ...[ + .videoDetail.value.descV2?.isNotEmpty == + true) ...[ const SizedBox(height: 8), SelectableText.rich( style: const TextStyle( @@ -748,7 +749,7 @@ class _VideoInfoState extends State { .queryVideoIntroData["status"] = true; videoIntroController.queryVideoIntro(); if (videoDetailCtr.videoUrl.isNullOrEmpty && - videoDetailCtr.isQuerying.not) { + !videoDetailCtr.isQuerying) { videoDetailCtr.queryVideoUrl(); } }, @@ -766,8 +767,8 @@ class _VideoInfoState extends State { videoDetail.ugcSeason != null && (context.orientation != Orientation.landscape || (context.orientation == Orientation.landscape && - videoDetailCtr.plPlayerController - .horizontalSeasonPanel.not))) + !videoDetailCtr + .plPlayerController.horizontalSeasonPanel))) Obx( () => SeasonPanel( key: ValueKey(videoIntroController.videoDetail.value), @@ -782,8 +783,8 @@ class _VideoInfoState extends State { videoDetail.pages!.length > 1 && (context.orientation != Orientation.landscape || (context.orientation == Orientation.landscape && - videoDetailCtr.plPlayerController - .horizontalSeasonPanel.not))) ...[ + !videoDetailCtr.plPlayerController + .horizontalSeasonPanel))) ...[ Obx( () => PagesPanel( key: ValueKey(videoIntroController.videoDetail.value), diff --git a/lib/pages/video/introduction/ugc/widgets/action_item.dart b/lib/pages/video/introduction/ugc/widgets/action_item.dart index aac112623..7174c4597 100644 --- a/lib/pages/video/introduction/ugc/widgets/action_item.dart +++ b/lib/pages/video/introduction/ugc/widgets/action_item.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:math'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show HapticFeedback; @@ -68,7 +67,7 @@ class ActionItemState extends State void _cancelLongPress([bool isCancel = false]) { int duration = DateTime.now().millisecondsSinceEpoch - _lastTime; if (duration >= 200 && duration < 1500) { - if (widget.hasTriple.not) { + if (!widget.hasTriple) { controller?.reverse(); widget.callBack?.call(false); } diff --git a/lib/pages/video/introduction/ugc/widgets/season.dart b/lib/pages/video/introduction/ugc/widgets/season.dart index 57f101fb1..613303473 100644 --- a/lib/pages/video/introduction/ugc/widgets/season.dart +++ b/lib/pages/video/introduction/ugc/widgets/season.dart @@ -5,7 +5,6 @@ import 'package:PiliPlus/models/video_detail/episode.dart'; import 'package:PiliPlus/models/video_detail/section.dart'; import 'package:PiliPlus/pages/video/controller.dart'; import 'package:PiliPlus/pages/video/introduction/ugc/controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -69,7 +68,7 @@ class _SeasonPanelState extends State { if (_videoDetailController.seasonCid != cid) { bool isPart = videoDetail.pages?.indexWhere((item) => item.cid == cid) != -1; - if (isPart.not) { + if (!isPart) { _videoDetailController.seasonCid = cid; } } diff --git a/lib/pages/video/pay_coins/view.dart b/lib/pages/video/pay_coins/view.dart index 9664e236e..d52c917b3 100644 --- a/lib/pages/video/pay_coins/view.dart +++ b/lib/pages/video/pay_coins/view.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:math'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/global_data.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:flutter/material.dart'; @@ -392,7 +391,7 @@ class _PayCoinsPageState extends State children: [ GestureDetector( onTap: () { - _coinWithLike.value = _coinWithLike.value.not; + _coinWithLike.value = !_coinWithLike.value; GStorage.setting.put( SettingBoxKey.coinWithLike, _coinWithLike.value, diff --git a/lib/pages/video/post_panel/view.dart b/lib/pages/video/post_panel/view.dart index ddb5a01e7..5dc7063ee 100644 --- a/lib/pages/video/post_panel/view.dart +++ b/lib/pages/video/post_panel/view.dart @@ -13,7 +13,6 @@ import 'package:PiliPlus/models/sponsor_block/segment_item.dart'; import 'package:PiliPlus/pages/common/common_collapse_slide_page.dart'; import 'package:PiliPlus/pages/video/controller.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:PiliPlus/utils/utils.dart'; import 'package:dio/dio.dart'; @@ -167,10 +166,8 @@ class _PostPanelState extends CommonCollapseSlidePageState { list![index].category = item; List constraintList = item.toActionType; - if (constraintList - .contains( - list![index].actionType) - .not) { + if (!constraintList.contains( + list![index].actionType)) { list![index].actionType = constraintList.first; } @@ -335,12 +332,8 @@ class _PostPanelState extends CommonCollapseSlidePageState { .seek( Duration(milliseconds: start), ); - if (widget - .plPlayerController - .videoPlayerController! - .state - .playing - .not) { + if (!widget.plPlayerController + .videoPlayerController!.state.playing) { await widget.plPlayerController .videoPlayerController! .play(); diff --git a/lib/pages/video/reply/view.dart b/lib/pages/video/reply/view.dart index 49beb3f1d..94f886a44 100644 --- a/lib/pages/video/reply/view.dart +++ b/lib/pages/video/reply/view.dart @@ -230,8 +230,8 @@ class _VideoReplyPanelState extends State onViewImage: widget.onViewImage, onDismissed: widget.onDismissed, callback: widget.callback, - onCheckReply: (item) => - _videoReplyController.onCheckReply(context, item), + onCheckReply: (item) => _videoReplyController + .onCheckReply(context, item, isManual: true), onToggleTop: (isUpTop, rpid) => _videoReplyController.onToggleTop( index, diff --git a/lib/pages/video/reply/widgets/reply_item_grpc.dart b/lib/pages/video/reply/widgets/reply_item_grpc.dart index 3ea4017f9..83b20450c 100644 --- a/lib/pages/video/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/reply/widgets/reply_item_grpc.dart @@ -849,7 +849,7 @@ class ReplyItemGrpc extends StatelessWidget { for (int i = 0; i < unmatchedItems.length; i++) { String patternStr = unmatchedItems[i]; if (content.urls[patternStr]?.extra.isWordSearch == true && - enableWordRe.not) { + !enableWordRe) { continue; } spanChildren.addAll( @@ -1131,7 +1131,7 @@ class ReplyItemGrpc extends StatelessWidget { leading: Icon(Icons.error_outline, color: errorColor, size: 19), title: Text('举报', style: style!.copyWith(color: errorColor)), ), - if (replyLevel == '1' && isSubReply.not && ownerMid == upMid) + if (replyLevel == '1' && !isSubReply && ownerMid == upMid) ListTile( onTap: () => menuActionHandler('top'), minLeadingWidth: 0, diff --git a/lib/pages/video/reply/widgets/zan_grpc.dart b/lib/pages/video/reply/widgets/zan_grpc.dart index 4eaa094de..173163651 100644 --- a/lib/pages/video/reply/widgets/zan_grpc.dart +++ b/lib/pages/video/reply/widgets/zan_grpc.dart @@ -1,7 +1,6 @@ import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart' show ReplyInfo; import 'package:PiliPlus/http/reply.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/utils.dart'; import 'package:fixnum/fixnum.dart' as $fixnum; @@ -87,7 +86,7 @@ class _ZanButtonGrpcState extends State { bool isProcessing = false; Future handleState(Future Function() action) async { - if (isProcessing.not) { + if (!isProcessing) { isProcessing = true; await action(); isProcessing = false; diff --git a/lib/pages/video/reply_reply/view.dart b/lib/pages/video/reply_reply/view.dart index 670ba4816..1ecfc26b4 100644 --- a/lib/pages/video/reply_reply/view.dart +++ b/lib/pages/video/reply_reply/view.dart @@ -186,7 +186,7 @@ class _VideoReplyReplyPanelState onDismissed: widget.onDismissed, callback: _getImageCallback, onCheckReply: (item) => _videoReplyReplyController - .onCheckReply(context, item), + .onCheckReply(context, item, isManual: true), onToggleTop: (isUpTop, rpid) => _videoReplyReplyController.onToggleTop( index, @@ -359,7 +359,8 @@ class _VideoReplyReplyPanelState ..loadingState.value.dataOrNull?.insert(index + 1, replyInfo) ..loadingState.refresh(); if (_videoReplyReplyController.enableCommAntifraud && mounted) { - _videoReplyReplyController.onCheckReply(context, replyInfo); + _videoReplyReplyController.onCheckReply(context, replyInfo, + isManual: false); } } }); @@ -445,8 +446,8 @@ class _VideoReplyReplyPanelState onViewImage: widget.onViewImage, onDismissed: widget.onDismissed, callback: _getImageCallback, - onCheckReply: (item) => - _videoReplyReplyController.onCheckReply(context, item), + onCheckReply: (item) => _videoReplyReplyController + .onCheckReply(context, item, isManual: true), onToggleTop: (isUpTop, rpid) => _videoReplyReplyController.onToggleTop( index, _videoReplyReplyController.oid, diff --git a/lib/pages/video/send_danmaku/view.dart b/lib/pages/video/send_danmaku/view.dart index 6603034ca..8f667310f 100644 --- a/lib/pages/video/send_danmaku/view.dart +++ b/lib/pages/video/send_danmaku/view.dart @@ -6,7 +6,6 @@ import 'package:PiliPlus/main.dart'; import 'package:PiliPlus/models/common/publish_panel_type.dart'; import 'package:PiliPlus/pages/common/common_publish_page.dart'; import 'package:PiliPlus/pages/setting/slide_color_picker.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:canvas_danmaku/models/danmaku_content_item.dart'; import 'package:flutter/material.dart'; @@ -93,7 +92,7 @@ class _SendDanmakuPanelState extends CommonPublishPageState { key: ValueKey(_color.value), builder: (context, constraints) { final int crossAxisCount = (constraints.maxWidth / 40).toInt(); - final bool isCustomColor = _colorList.contains(_color.value).not; + final bool isCustomColor = !_colorList.contains(_color.value); final int length = _colorList.length + (isCustomColor ? 1 : 0) + 1; return GridView.builder( diff --git a/lib/pages/video/view.dart b/lib/pages/video/view.dart index e67b2ee2f..725385645 100644 --- a/lib/pages/video/view.dart +++ b/lib/pages/video/view.dart @@ -203,9 +203,9 @@ class _VideoDetailPageVState extends State if (videoDetailController.scrollCtr.hasClients) { bool isPlaying = status == PlayerStatus.playing; if (isPlaying) { - if (videoDetailController.isExpanding.not && + if (!videoDetailController.isExpanding && videoDetailController.scrollCtr.offset != 0 && - videoDetailController.animationController.isAnimating.not) { + !videoDetailController.animationController.isAnimating) { videoDetailController.isExpanding = true; videoDetailController.animationController.forward( from: 1 - @@ -413,12 +413,12 @@ class _VideoDetailPageVState extends State super.didPopNext(); videoDetailController.autoPlay.value = !videoDetailController.isShowCover.value; - if (videoDetailController.isShowCover.value.not) { + if (!videoDetailController.isShowCover.value) { await videoDetailController.playerInit( autoplay: videoDetailController.playerStatus == PlayerStatus.playing, ); } else if (videoDetailController.plPlayerController.preInitPlayer && - videoDetailController.isQuerying.not && + !videoDetailController.isQuerying && videoDetailController.videoState.value is! Error) { await videoDetailController.playerInit(); } @@ -621,8 +621,8 @@ class _VideoDetailPageVState extends State !isFullScreen && isShowing && mounted) { - if (videoDetailController.imageStatus.not && - removeSafeArea.not) { + if (!videoDetailController.imageStatus && + !removeSafeArea) { showStatusBar(); } } @@ -1460,12 +1460,11 @@ class _VideoDetailPageVState extends State } Widget tabbar() => TabBar( - labelColor: needIndicator.not || tabs.length == 1 + labelColor: !needIndicator || tabs.length == 1 ? themeData.colorScheme.onSurface : null, - indicator: needIndicator.not || tabs.length == 1 - ? const BoxDecoration() - : null, + indicator: + !needIndicator || tabs.length == 1 ? const BoxDecoration() : null, padding: EdgeInsets.zero, controller: videoDetailController.tabCtr, labelStyle: @@ -1488,9 +1487,9 @@ class _VideoDetailPageVState extends State } } - if (needIndicator.not || tabs.length == 1) { + if (!needIndicator || tabs.length == 1) { animToTop(); - } else if (videoDetailController.tabCtr.indexIsChanging.not) { + } else if (!videoDetailController.tabCtr.indexIsChanging) { animToTop(); } }, @@ -1759,10 +1758,9 @@ class _VideoDetailPageVState extends State body: CustomScrollView( key: const PageStorageKey('简介'), controller: needCtr ? _introController : null, - physics: needCtr.not + physics: !needCtr ? const AlwaysScrollableScrollPhysics( - parent: ClampingScrollPhysics(), - ) + parent: ClampingScrollPhysics()) : null, slivers: [ if (videoDetailController.videoType == SearchType.video) ...[ @@ -2155,7 +2153,7 @@ class _VideoDetailPageVState extends State ..isReversed = !item.isReversed ..episodes = item.episodes!.reversed.toList(); - if (videoDetailController.plPlayerController.reverseFromFirst.not) { + if (!videoDetailController.plPlayerController.reverseFromFirst) { // keep current episode videoDetailController ..seasonIndex.refresh() @@ -2179,7 +2177,7 @@ class _VideoDetailPageVState extends State item ..isPageReversed = !item.isPageReversed ..pages = item.pages!.reversed.toList(); - if (videoDetailController.plPlayerController.reverseFromFirst.not) { + if (!videoDetailController.plPlayerController.reverseFromFirst) { // keep current episode videoDetailController.cid.refresh(); } else { diff --git a/lib/pages/webdav/webdav.dart b/lib/pages/webdav/webdav.dart index b4e074ae5..60533a4df 100644 --- a/lib/pages/webdav/webdav.dart +++ b/lib/pages/webdav/webdav.dart @@ -1,7 +1,6 @@ import 'dart:convert'; import 'package:PiliPlus/common/widgets/pair.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; @@ -22,7 +21,7 @@ class WebDav { final webDavUsername = GStorage.webdavUsername; final webDavPassword = GStorage.webdavPassword; _webdavDirectory = GStorage.webdavDirectory; - if (_webdavDirectory.endsWith('/').not) { + if (!_webdavDirectory.endsWith('/')) { _webdavDirectory += '/'; } _webdavDirectory += 'PiliPlus'; diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index 40874bfc8..78830f21d 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -994,7 +994,7 @@ class PlPlayerController { } else if (event.startsWith('Could not open codec')) { SmartDialog.showToast('无法加载解码器, $event,可能会切换至软解'); } else { - if (onlyPlayAudio.value.not) { + if (!onlyPlayAudio.value) { if (event.startsWith("Failed to open .") || event.startsWith("Cannot open") || event.startsWith("Can not open")) { @@ -1464,7 +1464,7 @@ class PlPlayerController { if (!enableHeart || MineController.anonymity.value || progress == 0) { return; } else if (playerStatus.status.value == PlayerStatus.paused) { - if (isManual.not) { + if (!isManual) { return; } } diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index a067fb779..e9bdfce0e 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -195,7 +195,7 @@ class _PLVideoPlayerState extends State FlutterVolumeController.addListener((double value) { if (mounted && !_volumeInterceptEventStream.value) { _volumeValue.value = value; - if (Platform.isIOS && FlutterVolumeController.showSystemUI.not) { + if (Platform.isIOS && !FlutterVolumeController.showSystemUI) { _volumeIndicator.value = true; _volumeTimer?.cancel(); _volumeTimer = Timer(const Duration(milliseconds: 800), () { @@ -479,8 +479,7 @@ class _PLVideoPlayerState extends State color: Colors.white, ), onTap: () { - if (anySeason.not || - widget.videoDetailController?.isPlayAll == true) { + if (!anySeason || widget.videoDetailController?.isPlayAll == true) { widget.showEpisodes?.call(); return; } @@ -776,8 +775,8 @@ class _PLVideoPlayerState extends State _gestureType = 'horizontal'; } else if (cumulativeDelta.dy.abs() > 3 * cumulativeDelta.dx.abs()) { - if (plPlayerController.enableSlideVolumeBrightness.not && - plPlayerController.enableSlideFS.not) { + if (!plPlayerController.enableSlideVolumeBrightness && + !plPlayerController.enableSlideFS) { return; } @@ -787,19 +786,19 @@ class _PLVideoPlayerState extends State final double tapPosition = details.localFocalPoint.dx; final double sectionWidth = totalWidth / 3; if (tapPosition < sectionWidth) { - if (plPlayerController.enableSlideVolumeBrightness.not) { + if (!plPlayerController.enableSlideVolumeBrightness) { return; } // 左边区域 _gestureType = 'left'; } else if (tapPosition < sectionWidth * 2) { - if (plPlayerController.enableSlideFS.not) { + if (!plPlayerController.enableSlideFS) { return; } // 全屏 _gestureType = 'center'; } else { - if (plPlayerController.enableSlideVolumeBrightness.not) { + if (!plPlayerController.enableSlideVolumeBrightness) { return; } // 右边区域 @@ -873,7 +872,7 @@ class _PLVideoPlayerState extends State plPlayerController .durationSeconds.value.inMilliseconds * renderBox.size.width; - if (plPlayerController.showPreview.value.not) { + if (!plPlayerController.showPreview.value) { plPlayerController.showPreview.value = true; } } catch (_) {} @@ -954,8 +953,8 @@ class _PLVideoPlayerState extends State }, onVerticalDragUpdate: (details) { if (plPlayerController.controlsLock.value) return; - if (plPlayerController.enableSlideVolumeBrightness.not && - plPlayerController.enableSlideFS.not) { + if (!plPlayerController.enableSlideVolumeBrightness && + !plPlayerController.enableSlideFS) { return; } RenderBox renderBox = @@ -965,19 +964,19 @@ class _PLVideoPlayerState extends State final double sectionWidth = totalWidth / 3; late String gestureType; if (tapPosition < sectionWidth) { - if (plPlayerController.enableSlideVolumeBrightness.not) { + if (!plPlayerController.enableSlideVolumeBrightness) { return; } // 左边区域 gestureType = 'left'; } else if (tapPosition < sectionWidth * 2) { - if (plPlayerController.enableSlideFS.not) { + if (!plPlayerController.enableSlideFS) { return; } // 全屏 gestureType = 'center'; } else { - if (plPlayerController.enableSlideVolumeBrightness.not) { + if (!plPlayerController.enableSlideVolumeBrightness) { return; } // 右边区域 diff --git a/lib/plugin/pl_player/widgets/bottom_control.dart b/lib/plugin/pl_player/widgets/bottom_control.dart index 36622edba..72f7b0627 100644 --- a/lib/plugin/pl_player/widgets/bottom_control.dart +++ b/lib/plugin/pl_player/widgets/bottom_control.dart @@ -4,7 +4,6 @@ import 'package:PiliPlus/common/widgets/progress_bar/audio_video_progress_bar.da import 'package:PiliPlus/common/widgets/progress_bar/segment_progress_bar.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart'; import 'package:PiliPlus/plugin/pl_player/view.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -75,7 +74,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget { double newProgress = duration.timeStamp.inSeconds / max; if (controller.showSeekPreview) { - if (controller.showPreview.value.not) { + if (!controller.showPreview.value) { controller.showPreview.value = true; } controller.previewDx.value = diff --git a/lib/services/audio_handler.dart b/lib/services/audio_handler.dart index af6e3db22..e47d32512 100644 --- a/lib/services/audio_handler.dart +++ b/lib/services/audio_handler.dart @@ -3,7 +3,6 @@ import 'package:PiliPlus/models/pgc/pgc_info_model/result.dart'; import 'package:PiliPlus/models/video_detail/data.dart'; import 'package:PiliPlus/plugin/pl_player/controller.dart'; import 'package:PiliPlus/plugin/pl_player/models/play_status.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:audio_service/audio_service.dart'; import 'package:get/get_utils/get_utils.dart'; @@ -72,7 +71,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler { PlayerStatus status, bool isBuffering, bool isLive) async { if (!enableBackgroundPlay || _item.isEmpty || - PlPlayerController.instanceExists().not) { + !PlPlayerController.instanceExists()) { return; } @@ -90,11 +89,11 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler { processingState: isBuffering ? AudioProcessingState.buffering : processingState, controls: [ - if (isLive.not) + if (!isLive) MediaControl.rewind .copyWith(androidIcon: 'drawable/ic_baseline_replay_10_24'), if (playing) MediaControl.pause else MediaControl.play, - if (isLive.not) + if (!isLive) MediaControl.fastForward .copyWith(androidIcon: 'drawable/ic_baseline_forward_10_24'), ], @@ -209,7 +208,7 @@ class VideoPlayerServiceHandler extends BaseAudioHandler with SeekHandler { void onPositionChange(Duration position) { if (!enableBackgroundPlay || _item.isEmpty || - PlPlayerController.instanceExists().not) { + !PlPlayerController.instanceExists()) { return; } diff --git a/lib/utils/app_scheme.dart b/lib/utils/app_scheme.dart index b6375d97a..1289758e1 100644 --- a/lib/utils/app_scheme.dart +++ b/lib/utils/app_scheme.dart @@ -39,7 +39,7 @@ class PiliScheme { try { if (url.startsWith('//')) { url = 'https:$url'; - } else if (RegExp(r'^\S+://').hasMatch(url).not) { + } else if (!RegExp(r'^\S+://').hasMatch(url)) { url = 'https://$url'; } return routePush( @@ -457,7 +457,7 @@ class PiliScheme { } return false; default: - if (selfHandle.not) { + if (!selfHandle) { debugPrint('$uri'); SmartDialog.showToast('未知路径:$uri,请截图反馈给开发者'); } @@ -485,7 +485,7 @@ class PiliScheme { ); return true; } - if (selfHandle.not) { + if (!selfHandle) { debugPrint('$uri'); SmartDialog.showToast('未知路径:$uri,请截图反馈给开发者'); } @@ -505,13 +505,13 @@ class PiliScheme { String host = uri.host; if (selfHandle && - host.contains('bilibili.com').not && - host.contains('b23.tv').not) { + !host.contains('bilibili.com') && + !host.contains('b23.tv')) { return false; } void launchURL() { - if (selfHandle.not) { + if (selfHandle) { _toWebview(uri.toString(), off, parameters); } } @@ -531,7 +531,7 @@ class PiliScheme { uri = Uri.parse(redirectUrl); host = uri.host; } - if (host.contains('bilibili.com').not) { + if (!host.contains('bilibili.com')) { launchURL(); return false; } @@ -541,7 +541,7 @@ class PiliScheme { if (host.contains('t.bilibili.com')) { bool hasMatch = await _onPushDynDetail(path, off); - if (hasMatch.not) { + if (!hasMatch) { launchURL(); } return hasMatch; @@ -609,7 +609,7 @@ class PiliScheme { return false; case 'dynamic' || 'opus': bool hasMatch = await _onPushDynDetail(path, off); - if (hasMatch.not) { + if (!hasMatch) { launchURL(); } return hasMatch; diff --git a/lib/utils/extension.dart b/lib/utils/extension.dart index 22190ff46..e576e58b7 100644 --- a/lib/utils/extension.dart +++ b/lib/utils/extension.dart @@ -68,10 +68,6 @@ extension StringExt on String? { bool get isNullOrEmpty => this == null || this!.isEmpty; } -extension BoolExt on bool { - bool get not => !this; -} - extension BuildContextExt on BuildContext { Color get vipColor { return Theme.of(this).brightness == Brightness.light diff --git a/lib/utils/page_utils.dart b/lib/utils/page_utils.dart index 5219ca8bb..9eeedc27d 100644 --- a/lib/utils/page_utils.dart +++ b/lib/utils/page_utils.dart @@ -160,10 +160,8 @@ class PageUtils { ...[ ...[ ...scheduleTimeChoices, - if (scheduleTimeChoices - .contains( - shutdownTimerService.scheduledExitInMinutes) - .not) + if (!scheduleTimeChoices.contains( + shutdownTimerService.scheduledExitInMinutes)) shutdownTimerService.scheduledExitInMinutes, ]..sort(), -1, @@ -193,7 +191,7 @@ class PageUtils { child: Divider(height: 1), ), ), - if (isLive.not) ...[ + if (!isLive) ...[ const SizedBox(height: 10), ListTile( dense: true, @@ -586,8 +584,8 @@ class PageUtils { bool inApp = false, Map? parameters, }) async { - if (inApp.not && GStorage.openInBrowser) { - if ((await PiliScheme.routePushFromUrl(url, selfHandle: true)).not) { + if (!inApp && GStorage.openInBrowser) { + if (!await PiliScheme.routePushFromUrl(url, selfHandle: true)) { launchURL(url); } } else { diff --git a/lib/utils/reply_utils.dart b/lib/utils/reply_utils.dart index 907118c6b..0c23efea7 100644 --- a/lib/utils/reply_utils.dart +++ b/lib/utils/reply_utils.dart @@ -97,22 +97,24 @@ class ReplyUtils { } // CommAntifraud - if (isManual.not) { - await Future.delayed(const Duration(seconds: 5)); + if (!isManual) { + await Future.delayed(const Duration(seconds: 8)); } void showReplyCheckResult(String message) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: const Text('评论检查结果'), - content: SelectableText(message), - ), - ); + if (context.mounted) { + showDialog( + context: context, + builder: (context) => AlertDialog( + title: const Text('评论检查结果'), + content: SelectableText(message), + ), + ); + } } - if (context.mounted.not) return; + if (!context.mounted) return; // root reply - if (rpid == null) { + if (rpid == null || rpid == 0) { // no cookie check var res = await ReplyHttp.replyList( isLogin: false, @@ -124,7 +126,7 @@ class ReplyUtils { enableFilter: false, antiGoodsReply: false, ); - if (context.mounted.not) return; + if (!context.mounted) return; if (res is Error) { SmartDialog.showToast('获取评论主列表时发生错误:${res.errMsg}'); return; @@ -134,14 +136,10 @@ class ReplyUtils { replies.replies?.indexWhere((item) => item.rpid == replyId) ?? -1; if (index != -1) { // found - if (context.mounted) { - showReplyCheckResult( - '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message', - ); - } + showReplyCheckResult('无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message'); } else { // not found - if (context.mounted.not) return; + if (!context.mounted) return; // cookie check final res1 = await ReplyHttp.replyReplyList( isLogin: true, @@ -152,17 +150,13 @@ class ReplyUtils { filterBanWord: false, antiGoodsReply: false, ); - if (context.mounted.not) return; + if (!context.mounted) return; if (res1 is Error) { // not found - if (context.mounted) { - showReplyCheckResult( - '无法找到你的评论。\n\n你的评论:$message', - ); - } + showReplyCheckResult('无法找到你的评论。\n\n你的评论:$message'); } else { // found - if (context.mounted.not) return; + if (!context.mounted) return; // no cookie check final res2 = await ReplyHttp.replyReplyList( isLogin: false, @@ -174,35 +168,31 @@ class ReplyUtils { isCheck: true, antiGoodsReply: false, ); - if (context.mounted.not) return; + if (!context.mounted) return; if (res2 is Error) { // not found - if (context.mounted) { - showReplyCheckResult( - res2.errMsg?.startsWith('12022') == true - ? '你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message' - : '评论不可见(${res2.errMsg}): $message', - ); - } + showReplyCheckResult( + res2.errMsg?.startsWith('12022') == true + ? '你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message' + : '评论不可见(${res2.errMsg}): $message', + ); } else { // found - if (context.mounted) { - showReplyCheckResult(isManual - ? '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message' - : ''' + showReplyCheckResult(isManual + ? '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message' + : ''' 你评论状态有点可疑,虽然无账号翻找评论区获取不到你的评论,但是无账号可通过 https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? replyId}&type=$replyType 获取你的评论,疑似评论区被戒严或者这是你的视频。 你的评论:$message'''); - } } } } } } else { for (int i = 1;; i++) { - if (context.mounted.not) return; + if (!context.mounted) return; final res3 = await ReplyHttp.replyReplyList( isLogin: false, oid: oid, @@ -226,18 +216,14 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep // not found } else { // found - if (context.mounted) { - showReplyCheckResult( - '无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message', - ); - } + showReplyCheckResult('无账号状态下找到了你的评论,评论正常!\n\n你的评论:$message'); return; } } } for (int i = 1;; i++) { - if (context.mounted.not) return; + if (!context.mounted) return; final res4 = await ReplyHttp.replyReplyList( isLogin: true, oid: oid, @@ -261,21 +247,13 @@ https://api.bilibili.com/x/v2/reply/reply?oid=$oid&pn=1&ps=20&root=${rpid ?? rep // not found } else { // found - if (context.mounted) { - showReplyCheckResult( - '你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message', - ); - } + showReplyCheckResult('你的评论被shadow ban(仅自己可见)!\n\n你的评论: $message'); return; } } } - if (context.mounted) { - showReplyCheckResult( - '评论不可见: $message', - ); - } + showReplyCheckResult('评论不可见: $message'); } } } diff --git a/lib/utils/request_utils.dart b/lib/utils/request_utils.dart index 5d372ae17..e254905ff 100644 --- a/lib/utils/request_utils.dart +++ b/lib/utils/request_utils.dart @@ -22,7 +22,6 @@ import 'package:PiliPlus/pages/common/multi_select_controller.dart'; import 'package:PiliPlus/pages/dynamics_tab/controller.dart'; import 'package:PiliPlus/pages/group_panel/view.dart'; import 'package:PiliPlus/pages/later/controller.dart'; -import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/storage.dart'; import 'package:flutter/material.dart'; @@ -402,7 +401,7 @@ class RequestUtils { ).then((res) { if (res['status']) { ctr.handleSelect(false); - if (isCopy.not) { + if (!isCopy) { List dataList = ctr.loadingState.value.data!; List remainList = dataList .toSet() diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index e126178cf..42d8d30af 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -48,7 +48,7 @@ class Utils { return str; }, ); - if (hasMatch.not) { + if (!hasMatch) { src += '@${quality ?? GlobalData().imgQuality}q.webp'; } } @@ -58,7 +58,7 @@ class Utils { static bool? _isIpad; static Future isIpad() async { - if (Platform.isIOS.not) { + if (!Platform.isIOS) { return false; } if (_isIpad != null) { @@ -502,7 +502,7 @@ class Utils { try { final res = await Request().get(Api.latestApp, uaType: 'mob'); if (res.data is Map || res.data.isEmpty) { - if (isAuto.not) { + if (!isAuto) { SmartDialog.showToast('检查更新失败,GitHub接口未返回数据,请检查网络'); } return; @@ -511,7 +511,7 @@ class Utils { DateTime current = DateTime.parse('${BuildConfig.buildTime}Z'); current = current.copyWith(hour: current.hour - 8); if (current.compareTo(latest) >= 0) { - if (isAuto.not) { + if (!isAuto) { SmartDialog.showToast('已是最新版本'); } } else { diff --git a/lib/utils/video_utils.dart b/lib/utils/video_utils.dart index 3f0774f18..d93fa3854 100644 --- a/lib/utils/video_utils.dart +++ b/lib/utils/video_utils.dart @@ -3,7 +3,6 @@ import 'package:PiliPlus/models/live/live_room/room_info.dart'; import 'package:PiliPlus/models/video/play/url.dart'; import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/storage.dart'; -import 'package:flutter/material.dart'; class VideoUtils { static String getCdnUrl(dynamic item, [String? defaultCDNService]) { @@ -13,13 +12,13 @@ class VideoUtils { if (item is AudioItem) { if (GStorage.setting .get(SettingBoxKey.disableAudioCDN, defaultValue: true)) { - return item.backupUrl.isNullOrEmpty.not + return item.backupUrl?.isNotEmpty == true ? item.backupUrl! : item.baseUrl ?? ""; } } if (defaultCDNService == CDNService.baseUrl.code) { - return (item.baseUrl as String?).isNullOrEmpty.not + return (item.baseUrl as String?)?.isNotEmpty == true ? item.baseUrl : item.backupUrl ?? ""; } @@ -31,17 +30,17 @@ class VideoUtils { backupUrl = item.backupUrl; } if (defaultCDNService == CDNService.backupUrl.code) { - return backupUrl.isNullOrEmpty.not ? backupUrl : item.baseUrl ?? ""; + return backupUrl?.isNotEmpty == true ? backupUrl : item.baseUrl ?? ""; } - videoUrl = backupUrl.isNullOrEmpty ? item.baseUrl : backupUrl; + videoUrl = backupUrl?.isNotEmpty == true ? backupUrl : item.baseUrl; if (videoUrl.isNullOrEmpty) { return ""; } - debugPrint("videoUrl:$videoUrl"); + // debugPrint("videoUrl:$videoUrl"); String defaultCDNHost = CDNService.fromCode(defaultCDNService).host; - debugPrint("defaultCDNHost:$defaultCDNHost"); + // debugPrint("defaultCDNHost:$defaultCDNHost"); if (videoUrl!.contains("szbdyd.com")) { final uri = Uri.parse(videoUrl); String hostname = uri.queryParameters['xy_usource'] ?? defaultCDNHost; @@ -54,7 +53,7 @@ class VideoUtils { // videoUrl = // 'https://proxy-tf-all-ws.bilivideo.com/?url=${Uri.encodeComponent(videoUrl)}'; } - debugPrint("videoUrl:$videoUrl"); + // debugPrint("videoUrl:$videoUrl"); // /// 先获取backupUrl 一般是upgcxcode地址 播放更稳定 // if (item is VideoItem) {