mod: 推荐视频长按
This commit is contained in:
@ -25,10 +25,14 @@ class VideoCardH extends StatelessWidget {
|
||||
String heroTag = Utils.makeHeroTag(aid);
|
||||
return GestureDetector(
|
||||
onLongPress: () {
|
||||
if (longPress != null) {
|
||||
longPress!();
|
||||
}
|
||||
},
|
||||
onLongPressEnd: (details) {
|
||||
if (longPressEnd != null) {
|
||||
longPressEnd!();
|
||||
}
|
||||
},
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
|
@ -32,10 +32,14 @@ class VideoCardV extends StatelessWidget {
|
||||
margin: EdgeInsets.zero,
|
||||
child: GestureDetector(
|
||||
onLongPress: () {
|
||||
if (longPress != null) {
|
||||
longPress!();
|
||||
}
|
||||
},
|
||||
onLongPressEnd: (details) {
|
||||
if (longPressEnd != null) {
|
||||
longPressEnd!();
|
||||
}
|
||||
},
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/http/video.dart';
|
||||
|
||||
@ -7,5 +8,7 @@ class ReleatedController extends GetxController {
|
||||
// 推荐视频列表
|
||||
List relatedVideoList = [];
|
||||
|
||||
OverlayEntry? popupDialog;
|
||||
|
||||
Future<dynamic> queryRelatedVideo() => VideoHttp.relatedVideoList(aid: aid);
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pilipala/common/skeleton/video_card_h.dart';
|
||||
import 'package:pilipala/common/widgets/animated_dialog.dart';
|
||||
import 'package:pilipala/common/widgets/overlay_pop.dart';
|
||||
import 'package:pilipala/common/widgets/video_card_h.dart';
|
||||
import 'package:pilipala/common/widgets/video_card_v.dart';
|
||||
import './controller.dart';
|
||||
|
||||
class RelatedVideoPanel extends StatefulWidget {
|
||||
@ -31,6 +32,15 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel> {
|
||||
} else {
|
||||
return VideoCardH(
|
||||
videoItem: snapshot.data['data'][index],
|
||||
longPress: () {
|
||||
_releatedController.popupDialog =
|
||||
_createPopupDialog(snapshot.data['data'][index]);
|
||||
Overlay.of(context)
|
||||
.insert(_releatedController.popupDialog!);
|
||||
},
|
||||
longPressEnd: () {
|
||||
_releatedController.popupDialog?.remove();
|
||||
},
|
||||
);
|
||||
}
|
||||
}, childCount: snapshot.data['data'].length + 1));
|
||||
@ -51,4 +61,12 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
child: OverlayPop(videoItem: videoItem),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user