diff --git a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart index 63f0236e2..567003002 100644 --- a/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart +++ b/lib/common/widgets/interactiveviewer_gallery/interactiveviewer_gallery.dart @@ -286,9 +286,7 @@ class _InteractiveviewerGalleryState extends State const Duration(milliseconds: 555), onDoubleTap, ), - onLongPress: !isFileImg && Utils.isMobile - ? () => onLongPress(item) - : null, + onLongPress: !isFileImg ? () => onLongPress(item) : null, onSecondaryTap: !isFileImg && !Utils.isMobile ? () => onLongPress(item) : null, diff --git a/lib/common/widgets/video_card/video_card_v.dart b/lib/common/widgets/video_card/video_card_v.dart index bc965bceb..c54b2f2d4 100644 --- a/lib/common/widgets/video_card/video_card_v.dart +++ b/lib/common/widgets/video_card/video_card_v.dart @@ -79,7 +79,7 @@ class VideoCardV extends StatelessWidget { clipBehavior: Clip.hardEdge, child: InkWell( onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.aid)), - onLongPress: Utils.isMobile ? onLongPress : null, + onLongPress: onLongPress, onSecondaryTap: Utils.isMobile ? null : onLongPress, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/common/publish/common_rich_text_pub_page.dart b/lib/pages/common/publish/common_rich_text_pub_page.dart index 9b89dc19e..7a4a10127 100644 --- a/lib/pages/common/publish/common_rich_text_pub_page.dart +++ b/lib/pages/common/publish/common_rich_text_pub_page.dart @@ -107,7 +107,7 @@ abstract class CommonRichTextPubPageState ); controller.restoreChatPanel(); }, - onLongPress: Utils.isMobile ? onClear : null, + onLongPress: onClear, onSecondaryTap: Utils.isMobile ? null : onClear, child: ClipRRect( borderRadius: const BorderRadius.all(Radius.circular(4)), diff --git a/lib/pages/dynamics/widgets/dynamic_panel.dart b/lib/pages/dynamics/widgets/dynamic_panel.dart index d7b4b4215..f44a13767 100644 --- a/lib/pages/dynamics/widgets/dynamic_panel.dart +++ b/lib/pages/dynamics/widgets/dynamic_panel.dart @@ -66,7 +66,7 @@ class DynamicPanel extends StatelessWidget { }.contains(item.type) ? null : () => PageUtils.pushDynDetail(item), - onLongPress: Utils.isMobile ? showMore : null, + onLongPress: showMore, onSecondaryTap: Utils.isMobile ? null : showMore, child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/pages/dynamics/widgets/forward_panel.dart b/lib/pages/dynamics/widgets/forward_panel.dart index 003dcebc3..0ccca63a9 100644 --- a/lib/pages/dynamics/widgets/forward_panel.dart +++ b/lib/pages/dynamics/widgets/forward_panel.dart @@ -99,7 +99,7 @@ Widget forwardPanel( return InkWell( onTap: () => PageUtils.pushDynDetail(orig), - onLongPress: Utils.isMobile ? showMore : null, + onLongPress: showMore, onSecondaryTap: Utils.isMobile ? null : showMore, child: child, ); diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index e178dfae3..d8a07b398 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -48,7 +48,7 @@ class _UpPanelState extends State { onTap: () => setState(() { controller.showLiveUp = !controller.showLiveUp; }), - onLongPress: Utils.isMobile ? toFollowPage : null, + onLongPress: toFollowPage, onSecondaryTap: Utils.isMobile ? null : toFollowPage, child: Container( alignment: Alignment.center, @@ -161,7 +161,7 @@ class _UpPanelState extends State { } }, // onDoubleTap: isLive ? () => _onSelect(data) : null, - onLongPress: !isAll && Utils.isMobile ? toMemberPage : null, + onLongPress: !isAll ? toMemberPage : null, onSecondaryTap: !isAll && !Utils.isMobile ? toMemberPage : null, child: AnimatedOpacity( opacity: isCurrent ? 1 : 0.6, diff --git a/lib/pages/fan/view.dart b/lib/pages/fan/view.dart index 644e5247e..eb3879572 100644 --- a/lib/pages/fan/view.dart +++ b/lib/pages/fan/view.dart @@ -135,7 +135,7 @@ class _FansPageState extends State { } Get.toNamed('/member?mid=${item.mid}'); }, - onLongPress: flag && Utils.isMobile ? onRemove : null, + onLongPress: flag ? onRemove : null, onSecondaryTap: flag && !Utils.isMobile ? onRemove : null, child: Padding( padding: const EdgeInsets.symmetric( diff --git a/lib/pages/fav/note/widget/item.dart b/lib/pages/fav/note/widget/item.dart index 9bfbed363..c563bc0f4 100644 --- a/lib/pages/fav/note/widget/item.dart +++ b/lib/pages/fav/note/widget/item.dart @@ -44,7 +44,7 @@ class FavNoteItem extends StatelessWidget { ); } }, - onLongPress: Utils.isMobile ? onLongPress : null, + onLongPress: onLongPress, onSecondaryTap: Utils.isMobile ? null : onLongPress, child: Padding( padding: const EdgeInsets.symmetric( diff --git a/lib/pages/fav/pgc/widget/item.dart b/lib/pages/fav/pgc/widget/item.dart index 96567c235..1a41b5665 100644 --- a/lib/pages/fav/pgc/widget/item.dart +++ b/lib/pages/fav/pgc/widget/item.dart @@ -47,7 +47,7 @@ class FavPgcItem extends StatelessWidget { } PageUtils.viewPgc(seasonId: item.seasonId); }, - onLongPress: Utils.isMobile ? onLongPress : null, + onLongPress: onLongPress, onSecondaryTap: Utils.isMobile ? null : onLongPress, child: Padding( padding: const EdgeInsets.symmetric( diff --git a/lib/pages/fav/topic/view.dart b/lib/pages/fav/topic/view.dart index a56109513..7d317de58 100644 --- a/lib/pages/fav/topic/view.dart +++ b/lib/pages/fav/topic/view.dart @@ -97,7 +97,7 @@ class _FavTopicPageState extends State 'name': item.name!, }, ), - onLongPress: Utils.isMobile ? onLongPress : null, + onLongPress: onLongPress, onSecondaryTap: Utils.isMobile ? null : onLongPress, borderRadius: const BorderRadius.all( Radius.circular(6), diff --git a/lib/pages/follow/view.dart b/lib/pages/follow/view.dart index 172241294..b1a2271e9 100644 --- a/lib/pages/follow/view.dart +++ b/lib/pages/follow/view.dart @@ -106,12 +106,10 @@ class _FollowPageState extends State { if (_isCustomTag(item.tagid)) { return GestureDetector( behavior: HitTestBehavior.translucent, - onLongPress: Utils.isMobile - ? () { - Feedback.forLongPress(context); - _onHandleTag(index, item); - } - : null, + onLongPress: () { + Feedback.forLongPress(context); + _onHandleTag(index, item); + }, onSecondaryTap: Utils.isMobile ? null : () => _onHandleTag(index, item), diff --git a/lib/pages/live/view.dart b/lib/pages/live/view.dart index 625f83c26..b8aeaaec1 100644 --- a/lib/pages/live/view.dart +++ b/lib/pages/live/view.dart @@ -288,12 +288,10 @@ class _LivePageState extends CommonPageState child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => PageUtils.toLiveRoom(item.roomid), - onLongPress: Utils.isMobile - ? () { - Feedback.forLongPress(context); - Get.toNamed('/member?mid=${item.uid}'); - } - : null, + onLongPress: () { + Feedback.forLongPress(context); + Get.toNamed('/member?mid=${item.uid}'); + }, onSecondaryTap: Utils.isMobile ? null : () => Get.toNamed('/member?mid=${item.uid}'), diff --git a/lib/pages/mine/view.dart b/lib/pages/mine/view.dart index 2eac85527..2eafa3f54 100644 --- a/lib/pages/mine/view.dart +++ b/lib/pages/mine/view.dart @@ -223,12 +223,10 @@ class _MediaPageState extends CommonPageState GestureDetector( behavior: HitTestBehavior.opaque, onTap: controller.onLogin, - onLongPress: Utils.isMobile - ? () { - Feedback.forLongPress(context); - controller.onLogin(true); - } - : null, + onLongPress: () { + Feedback.forLongPress(context); + controller.onLogin(true); + }, onSecondaryTap: Utils.isMobile ? null : () => controller.onLogin(true), diff --git a/lib/pages/pgc_review/child/view.dart b/lib/pages/pgc_review/child/view.dart index 571d9fd17..dbc4e4ee3 100644 --- a/lib/pages/pgc_review/child/view.dart +++ b/lib/pages/pgc_review/child/view.dart @@ -191,7 +191,7 @@ class _PgcReviewChildPageState extends State }, ) : null, - onLongPress: !isLongReview && Utils.isMobile ? showMore : null, + onLongPress: !isLongReview ? showMore : null, onSecondaryTap: !isLongReview && !Utils.isMobile ? showMore : null, child: Padding( padding: const EdgeInsets.all(12), diff --git a/lib/pages/search/widgets/search_text.dart b/lib/pages/search/widgets/search_text.dart index 3abef6dd2..4556e3660 100644 --- a/lib/pages/search/widgets/search_text.dart +++ b/lib/pages/search/widgets/search_text.dart @@ -32,9 +32,7 @@ class SearchText extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(6)), child: InkWell( onTap: () => onTap?.call(text), - onLongPress: hasLongPress && Utils.isMobile - ? () => onLongPress!(text) - : null, + onLongPress: hasLongPress ? () => onLongPress!(text) : null, onSecondaryTap: hasLongPress && !Utils.isMobile ? () => onLongPress!(text) : null, diff --git a/lib/pages/video/reply/widgets/reply_item_grpc.dart b/lib/pages/video/reply/widgets/reply_item_grpc.dart index 48e714d1b..897656992 100644 --- a/lib/pages/video/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/reply/widgets/reply_item_grpc.dart @@ -104,12 +104,10 @@ class ReplyItemGrpc extends StatelessWidget { feedBack(); replyReply?.call(replyItem, null); }, - onLongPress: isMobile - ? () { - feedBack(); - showMore(); - } - : null, + onLongPress: () { + feedBack(); + showMore(); + }, onSecondaryTap: isMobile ? null : showMore, child: _buildContent(context, theme), ), @@ -499,12 +497,10 @@ class ReplyItemGrpc extends StatelessWidget { return InkWell( onTap: () => replyReply?.call(replyItem, childReply.id.toInt()), - onLongPress: Utils.isMobile - ? () { - feedBack(); - showMore(); - } - : null, + onLongPress: () { + feedBack(); + showMore(); + }, onSecondaryTap: Utils.isMobile ? null : showMore, child: Padding( padding: padding, diff --git a/lib/pages/whisper_detail/widget/chat_item.dart b/lib/pages/whisper_detail/widget/chat_item.dart index 2e6cd90ae..bfd70ddfa 100644 --- a/lib/pages/whisper_detail/widget/chat_item.dart +++ b/lib/pages/whisper_detail/widget/chat_item.dart @@ -84,13 +84,11 @@ class ChatItem extends StatelessWidget { textColor: textColor, ) : GestureDetector( - onLongPress: onLongPress != null && Utils.isMobile - ? () { - Feedback.forLongPress(context); - onLongPress!(); - } - : null, - onSecondaryTap: !Utils.isMobile ? onLongPress : null, + onLongPress: () { + Feedback.forLongPress(context); + onLongPress!(); + }, + onSecondaryTap: Utils.isMobile ? null : onLongPress, child: Row( mainAxisAlignment: isOwner ? MainAxisAlignment.end diff --git a/lib/plugin/pl_player/view.dart b/lib/plugin/pl_player/view.dart index 6a3fee600..c303f306d 100644 --- a/lib/plugin/pl_player/view.dart +++ b/lib/plugin/pl_player/view.dart @@ -412,13 +412,11 @@ class _PLVideoPlayerState extends State ), ), onTap: widget.showViewPoints, - onLongPress: Utils.isMobile - ? () { - Feedback.forLongPress(context); - videoDetailController.showVP.value = - !videoDetailController.showVP.value; - } - : null, + onLongPress: () { + Feedback.forLongPress(context); + videoDetailController.showVP.value = + !videoDetailController.showVP.value; + }, onSecondaryTap: Utils.isMobile ? null : () => videoDetailController.showVP.value =