opt gesture

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-09-29 16:14:34 +08:00
parent 19f7720fb2
commit be03909fdc
18 changed files with 43 additions and 61 deletions

View File

@@ -286,9 +286,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
const Duration(milliseconds: 555),
onDoubleTap,
),
onLongPress: !isFileImg && Utils.isMobile
? () => onLongPress(item)
: null,
onLongPress: !isFileImg ? () => onLongPress(item) : null,
onSecondaryTap: !isFileImg && !Utils.isMobile
? () => onLongPress(item)
: null,

View File

@@ -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,

View File

@@ -107,7 +107,7 @@ abstract class CommonRichTextPubPageState<T extends CommonRichTextPubPage>
);
controller.restoreChatPanel();
},
onLongPress: Utils.isMobile ? onClear : null,
onLongPress: onClear,
onSecondaryTap: Utils.isMobile ? null : onClear,
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(4)),

View File

@@ -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,

View File

@@ -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,
);

View File

@@ -48,7 +48,7 @@ class _UpPanelState extends State<UpPanel> {
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<UpPanel> {
}
},
// 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,

View File

@@ -135,7 +135,7 @@ class _FansPageState extends State<FansPage> {
}
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(

View File

@@ -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(

View File

@@ -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(

View File

@@ -97,7 +97,7 @@ class _FavTopicPageState extends State<FavTopicPage>
'name': item.name!,
},
),
onLongPress: Utils.isMobile ? onLongPress : null,
onLongPress: onLongPress,
onSecondaryTap: Utils.isMobile ? null : onLongPress,
borderRadius: const BorderRadius.all(
Radius.circular(6),

View File

@@ -106,12 +106,10 @@ class _FollowPageState extends State<FollowPage> {
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),

View File

@@ -288,12 +288,10 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
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}'),

View File

@@ -223,12 +223,10 @@ class _MediaPageState extends CommonPageState<MinePage, MineController>
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),

View File

@@ -191,7 +191,7 @@ class _PgcReviewChildPageState extends State<PgcReviewChildPage>
},
)
: null,
onLongPress: !isLongReview && Utils.isMobile ? showMore : null,
onLongPress: !isLongReview ? showMore : null,
onSecondaryTap: !isLongReview && !Utils.isMobile ? showMore : null,
child: Padding(
padding: const EdgeInsets.all(12),

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -412,13 +412,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
),
),
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 =