mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-21 11:22:16 +08:00
opt mouse control
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:PiliPlus/pages/dynamics/widgets/action_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/author_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/dyn_content.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart' hide InkWell;
|
||||
|
||||
class DynamicPanel extends StatelessWidget {
|
||||
@@ -45,6 +46,9 @@ class DynamicPanel extends StatelessWidget {
|
||||
onSetTop: onSetTop,
|
||||
onBlock: onBlock,
|
||||
);
|
||||
|
||||
void showMore() => _imageSaveDialog(context, authorWidget.morePanel);
|
||||
|
||||
final child = Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
@@ -62,7 +66,8 @@ class DynamicPanel extends StatelessWidget {
|
||||
}.contains(item.type)
|
||||
? null
|
||||
: () => PageUtils.pushDynDetail(item),
|
||||
onLongPress: () => _imageSaveDialog(context, authorWidget.morePanel),
|
||||
onLongPress: Utils.isMobile ? showMore : null,
|
||||
onSecondaryTap: Utils.isMobile ? null : showMore,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:PiliPlus/pages/dynamics/widgets/dyn_content.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/module_panel.dart';
|
||||
import 'package:PiliPlus/utils/date_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart' hide InkWell;
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -59,44 +60,47 @@ Widget forwardPanel(
|
||||
return child;
|
||||
}
|
||||
|
||||
void showMore() {
|
||||
String? title, cover, bvid;
|
||||
switch (orig.type) {
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
title = major?.archive?.title;
|
||||
cover = major?.archive?.cover;
|
||||
bvid = major?.archive?.bvid;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
title = major?.ugcSeason?.title;
|
||||
cover = major?.ugcSeason?.cover;
|
||||
bvid = major?.ugcSeason?.bvid;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_PGC' || 'DYNAMIC_TYPE_PGC_UNION':
|
||||
title = major?.pgc?.title;
|
||||
cover = major?.pgc?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
title = major?.liveRcmd?.title;
|
||||
cover = major?.liveRcmd?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE':
|
||||
title = major?.live?.title;
|
||||
cover = major?.live?.cover;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (cover != null) {
|
||||
imageSaveDialog(
|
||||
title: title,
|
||||
cover: cover,
|
||||
bvid: bvid,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return InkWell(
|
||||
onTap: () => PageUtils.pushDynDetail(orig),
|
||||
onLongPress: () {
|
||||
String? title, cover, bvid;
|
||||
switch (orig.type) {
|
||||
case 'DYNAMIC_TYPE_AV':
|
||||
title = major?.archive?.title;
|
||||
cover = major?.archive?.cover;
|
||||
bvid = major?.archive?.bvid;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_UGC_SEASON':
|
||||
title = major?.ugcSeason?.title;
|
||||
cover = major?.ugcSeason?.cover;
|
||||
bvid = major?.ugcSeason?.bvid;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_PGC' || 'DYNAMIC_TYPE_PGC_UNION':
|
||||
title = major?.pgc?.title;
|
||||
cover = major?.pgc?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE_RCMD':
|
||||
title = major?.liveRcmd?.title;
|
||||
cover = major?.liveRcmd?.cover;
|
||||
break;
|
||||
case 'DYNAMIC_TYPE_LIVE':
|
||||
title = major?.live?.title;
|
||||
cover = major?.live?.cover;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
if (cover != null) {
|
||||
imageSaveDialog(
|
||||
title: title,
|
||||
cover: cover,
|
||||
bvid: bvid,
|
||||
);
|
||||
}
|
||||
},
|
||||
onLongPress: Utils.isMobile ? showMore : null,
|
||||
onSecondaryTap: Utils.isMobile ? null : showMore,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:PiliPlus/pages/dynamics/controller.dart';
|
||||
import 'package:PiliPlus/pages/live_follow/view.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart' hide InkWell;
|
||||
import 'package:get/get.dart';
|
||||
|
||||
@@ -25,6 +26,8 @@ class _UpPanelState extends State<UpPanel> {
|
||||
late final controller = widget.dynamicsController;
|
||||
late final isTop = controller.upPanelPosition == UpPanelPosition.top;
|
||||
|
||||
void toFollowPage() => Get.to(const LiveFollowPage());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final accountService = controller.accountService;
|
||||
@@ -45,7 +48,8 @@ class _UpPanelState extends State<UpPanel> {
|
||||
onTap: () => setState(() {
|
||||
controller.showLiveUp = !controller.showLiveUp;
|
||||
}),
|
||||
onLongPress: () => Get.to(const LiveFollowPage()),
|
||||
onLongPress: Utils.isMobile ? toFollowPage : null,
|
||||
onSecondaryTap: Utils.isMobile ? null : toFollowPage,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: isTop ? 76 : 60,
|
||||
@@ -138,6 +142,10 @@ class _UpPanelState extends State<UpPanel> {
|
||||
final currentMid = controller.currentMid;
|
||||
final isLive = data is LiveUserItem;
|
||||
bool isCurrent = isLive || currentMid == data.mid || currentMid == -1;
|
||||
|
||||
final isAll = data.mid == -1;
|
||||
void toMemberPage() => Get.toNamed('/member?mid=${data.mid}');
|
||||
|
||||
return SizedBox(
|
||||
height: 76,
|
||||
width: isTop ? 70 : null,
|
||||
@@ -153,9 +161,8 @@ class _UpPanelState extends State<UpPanel> {
|
||||
}
|
||||
},
|
||||
// onDoubleTap: isLive ? () => _onSelect(data) : null,
|
||||
onLongPress: data.mid == -1
|
||||
? null
|
||||
: () => Get.toNamed('/member?mid=${data.mid}'),
|
||||
onLongPress: !isAll && Utils.isMobile ? toMemberPage : null,
|
||||
onSecondaryTap: !isAll && !Utils.isMobile ? toMemberPage : null,
|
||||
child: AnimatedOpacity(
|
||||
opacity: isCurrent ? 1 : 0.6,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
|
||||
Reference in New Issue
Block a user