mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: failed to remove when showing multi popup dialogs
This commit is contained in:
@@ -10,7 +10,7 @@ class RelatedController extends GetxController {
|
||||
// 推荐视频列表
|
||||
RxList relatedVideoList = <HotVideoItemModel>[].obs;
|
||||
|
||||
OverlayEntry? popupDialog;
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
|
||||
Future<dynamic> queryRelatedVideo() async {
|
||||
return VideoHttp.relatedVideoList(bvid: bvid).then((value) {
|
||||
|
||||
@@ -65,18 +65,16 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
try {
|
||||
_relatedController.popupDialog =
|
||||
_relatedController.popupDialog.add(
|
||||
_createPopupDialog(_relatedController
|
||||
.relatedVideoList[index]);
|
||||
Overlay.of(context)
|
||||
.insert(_relatedController.popupDialog!);
|
||||
.relatedVideoList[index]));
|
||||
Overlay.of(context).insert(
|
||||
_relatedController.popupDialog.last!);
|
||||
} catch (err) {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
longPressEnd: () {
|
||||
_relatedController.popupDialog?.remove();
|
||||
},
|
||||
longPressEnd: _removePopupDialog,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -110,13 +108,19 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
|
||||
));
|
||||
}
|
||||
|
||||
void _removePopupDialog() {
|
||||
_relatedController.popupDialog.last?.remove();
|
||||
_relatedController.popupDialog.removeLast();
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (BuildContext context) => AnimatedDialog(
|
||||
closeFn: _relatedController.popupDialog?.remove,
|
||||
closeFn: _removePopupDialog,
|
||||
child: OverlayPop(
|
||||
videoItem: videoItem,
|
||||
closeFn: _relatedController.popupDialog?.remove),
|
||||
videoItem: videoItem,
|
||||
closeFn: _removePopupDialog,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user