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), const Duration(milliseconds: 555),
onDoubleTap, onDoubleTap,
), ),
onLongPress: !isFileImg && Utils.isMobile onLongPress: !isFileImg ? () => onLongPress(item) : null,
? () => onLongPress(item)
: null,
onSecondaryTap: !isFileImg && !Utils.isMobile onSecondaryTap: !isFileImg && !Utils.isMobile
? () => onLongPress(item) ? () => onLongPress(item)
: null, : null,

View File

@@ -79,7 +79,7 @@ class VideoCardV extends StatelessWidget {
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
child: InkWell( child: InkWell(
onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.aid)), onTap: () => onPushDetail(Utils.makeHeroTag(videoItem.aid)),
onLongPress: Utils.isMobile ? onLongPress : null, onLongPress: onLongPress,
onSecondaryTap: Utils.isMobile ? null : onLongPress, onSecondaryTap: Utils.isMobile ? null : onLongPress,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

View File

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

View File

@@ -66,7 +66,7 @@ class DynamicPanel extends StatelessWidget {
}.contains(item.type) }.contains(item.type)
? null ? null
: () => PageUtils.pushDynDetail(item), : () => PageUtils.pushDynDetail(item),
onLongPress: Utils.isMobile ? showMore : null, onLongPress: showMore,
onSecondaryTap: Utils.isMobile ? null : showMore, onSecondaryTap: Utils.isMobile ? null : showMore,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

View File

@@ -99,7 +99,7 @@ Widget forwardPanel(
return InkWell( return InkWell(
onTap: () => PageUtils.pushDynDetail(orig), onTap: () => PageUtils.pushDynDetail(orig),
onLongPress: Utils.isMobile ? showMore : null, onLongPress: showMore,
onSecondaryTap: Utils.isMobile ? null : showMore, onSecondaryTap: Utils.isMobile ? null : showMore,
child: child, child: child,
); );

View File

@@ -48,7 +48,7 @@ class _UpPanelState extends State<UpPanel> {
onTap: () => setState(() { onTap: () => setState(() {
controller.showLiveUp = !controller.showLiveUp; controller.showLiveUp = !controller.showLiveUp;
}), }),
onLongPress: Utils.isMobile ? toFollowPage : null, onLongPress: toFollowPage,
onSecondaryTap: Utils.isMobile ? null : toFollowPage, onSecondaryTap: Utils.isMobile ? null : toFollowPage,
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
@@ -161,7 +161,7 @@ class _UpPanelState extends State<UpPanel> {
} }
}, },
// onDoubleTap: isLive ? () => _onSelect(data) : null, // onDoubleTap: isLive ? () => _onSelect(data) : null,
onLongPress: !isAll && Utils.isMobile ? toMemberPage : null, onLongPress: !isAll ? toMemberPage : null,
onSecondaryTap: !isAll && !Utils.isMobile ? toMemberPage : null, onSecondaryTap: !isAll && !Utils.isMobile ? toMemberPage : null,
child: AnimatedOpacity( child: AnimatedOpacity(
opacity: isCurrent ? 1 : 0.6, opacity: isCurrent ? 1 : 0.6,

View File

@@ -135,7 +135,7 @@ class _FansPageState extends State<FansPage> {
} }
Get.toNamed('/member?mid=${item.mid}'); Get.toNamed('/member?mid=${item.mid}');
}, },
onLongPress: flag && Utils.isMobile ? onRemove : null, onLongPress: flag ? onRemove : null,
onSecondaryTap: flag && !Utils.isMobile ? onRemove : null, onSecondaryTap: flag && !Utils.isMobile ? onRemove : null,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( 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, onSecondaryTap: Utils.isMobile ? null : onLongPress,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(

View File

@@ -47,7 +47,7 @@ class FavPgcItem extends StatelessWidget {
} }
PageUtils.viewPgc(seasonId: item.seasonId); PageUtils.viewPgc(seasonId: item.seasonId);
}, },
onLongPress: Utils.isMobile ? onLongPress : null, onLongPress: onLongPress,
onSecondaryTap: Utils.isMobile ? null : onLongPress, onSecondaryTap: Utils.isMobile ? null : onLongPress,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(

View File

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

View File

@@ -106,12 +106,10 @@ class _FollowPageState extends State<FollowPage> {
if (_isCustomTag(item.tagid)) { if (_isCustomTag(item.tagid)) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onLongPress: Utils.isMobile onLongPress: () {
? () { Feedback.forLongPress(context);
Feedback.forLongPress(context); _onHandleTag(index, item);
_onHandleTag(index, item); },
}
: null,
onSecondaryTap: Utils.isMobile onSecondaryTap: Utils.isMobile
? null ? null
: () => _onHandleTag(index, item), : () => _onHandleTag(index, item),

View File

@@ -288,12 +288,10 @@ class _LivePageState extends CommonPageState<LivePage, LiveController>
child: GestureDetector( child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () => PageUtils.toLiveRoom(item.roomid), onTap: () => PageUtils.toLiveRoom(item.roomid),
onLongPress: Utils.isMobile onLongPress: () {
? () { Feedback.forLongPress(context);
Feedback.forLongPress(context); Get.toNamed('/member?mid=${item.uid}');
Get.toNamed('/member?mid=${item.uid}'); },
}
: null,
onSecondaryTap: Utils.isMobile onSecondaryTap: Utils.isMobile
? null ? null
: () => Get.toNamed('/member?mid=${item.uid}'), : () => Get.toNamed('/member?mid=${item.uid}'),

View File

@@ -223,12 +223,10 @@ class _MediaPageState extends CommonPageState<MinePage, MineController>
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: controller.onLogin, onTap: controller.onLogin,
onLongPress: Utils.isMobile onLongPress: () {
? () { Feedback.forLongPress(context);
Feedback.forLongPress(context); controller.onLogin(true);
controller.onLogin(true); },
}
: null,
onSecondaryTap: Utils.isMobile onSecondaryTap: Utils.isMobile
? null ? null
: () => controller.onLogin(true), : () => controller.onLogin(true),

View File

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

View File

@@ -32,9 +32,7 @@ class SearchText extends StatelessWidget {
borderRadius: const BorderRadius.all(Radius.circular(6)), borderRadius: const BorderRadius.all(Radius.circular(6)),
child: InkWell( child: InkWell(
onTap: () => onTap?.call(text), onTap: () => onTap?.call(text),
onLongPress: hasLongPress && Utils.isMobile onLongPress: hasLongPress ? () => onLongPress!(text) : null,
? () => onLongPress!(text)
: null,
onSecondaryTap: hasLongPress && !Utils.isMobile onSecondaryTap: hasLongPress && !Utils.isMobile
? () => onLongPress!(text) ? () => onLongPress!(text)
: null, : null,

View File

@@ -104,12 +104,10 @@ class ReplyItemGrpc extends StatelessWidget {
feedBack(); feedBack();
replyReply?.call(replyItem, null); replyReply?.call(replyItem, null);
}, },
onLongPress: isMobile onLongPress: () {
? () { feedBack();
feedBack(); showMore();
showMore(); },
}
: null,
onSecondaryTap: isMobile ? null : showMore, onSecondaryTap: isMobile ? null : showMore,
child: _buildContent(context, theme), child: _buildContent(context, theme),
), ),
@@ -499,12 +497,10 @@ class ReplyItemGrpc extends StatelessWidget {
return InkWell( return InkWell(
onTap: () => onTap: () =>
replyReply?.call(replyItem, childReply.id.toInt()), replyReply?.call(replyItem, childReply.id.toInt()),
onLongPress: Utils.isMobile onLongPress: () {
? () { feedBack();
feedBack(); showMore();
showMore(); },
}
: null,
onSecondaryTap: Utils.isMobile ? null : showMore, onSecondaryTap: Utils.isMobile ? null : showMore,
child: Padding( child: Padding(
padding: padding, padding: padding,

View File

@@ -84,13 +84,11 @@ class ChatItem extends StatelessWidget {
textColor: textColor, textColor: textColor,
) )
: GestureDetector( : GestureDetector(
onLongPress: onLongPress != null && Utils.isMobile onLongPress: () {
? () { Feedback.forLongPress(context);
Feedback.forLongPress(context); onLongPress!();
onLongPress!(); },
} onSecondaryTap: Utils.isMobile ? null : onLongPress,
: null,
onSecondaryTap: !Utils.isMobile ? onLongPress : null,
child: Row( child: Row(
mainAxisAlignment: isOwner mainAxisAlignment: isOwner
? MainAxisAlignment.end ? MainAxisAlignment.end

View File

@@ -412,13 +412,11 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
), ),
), ),
onTap: widget.showViewPoints, onTap: widget.showViewPoints,
onLongPress: Utils.isMobile onLongPress: () {
? () { Feedback.forLongPress(context);
Feedback.forLongPress(context); videoDetailController.showVP.value =
videoDetailController.showVP.value = !videoDetailController.showVP.value;
!videoDetailController.showVP.value; },
}
: null,
onSecondaryTap: Utils.isMobile onSecondaryTap: Utils.isMobile
? null ? null
: () => videoDetailController.showVP.value = : () => videoDetailController.showVP.value =