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