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:
@@ -9,7 +9,7 @@ class ZoneController extends GetxController {
|
||||
RxList<HotVideoItemModel> videoList = <HotVideoItemModel>[].obs;
|
||||
bool isLoadingMore = false;
|
||||
bool flag = false;
|
||||
OverlayEntry? popupDialog;
|
||||
List<OverlayEntry?> popupDialog = <OverlayEntry?>[];
|
||||
int zoneID = 0;
|
||||
|
||||
// 获取推荐
|
||||
|
||||
@@ -104,14 +104,13 @@ class _ZonePageState extends State<ZonePage>
|
||||
videoItem: _zoneController.videoList[index],
|
||||
showPubdate: true,
|
||||
longPress: () {
|
||||
_zoneController.popupDialog = _createPopupDialog(
|
||||
_zoneController.videoList[index]);
|
||||
_zoneController.popupDialog.add(
|
||||
_createPopupDialog(
|
||||
_zoneController.videoList[index]));
|
||||
Overlay.of(context)
|
||||
.insert(_zoneController.popupDialog!);
|
||||
},
|
||||
longPressEnd: () {
|
||||
_zoneController.popupDialog?.remove();
|
||||
.insert(_zoneController.popupDialog.last!);
|
||||
},
|
||||
longPressEnd: _removePopupDialog,
|
||||
);
|
||||
}, childCount: _zoneController.videoList.length),
|
||||
),
|
||||
@@ -154,12 +153,19 @@ class _ZonePageState extends State<ZonePage>
|
||||
);
|
||||
}
|
||||
|
||||
void _removePopupDialog() {
|
||||
_zoneController.popupDialog.last?.remove();
|
||||
_zoneController.popupDialog.removeLast();
|
||||
}
|
||||
|
||||
OverlayEntry _createPopupDialog(videoItem) {
|
||||
return OverlayEntry(
|
||||
builder: (context) => AnimatedDialog(
|
||||
closeFn: _zoneController.popupDialog?.remove,
|
||||
closeFn: _removePopupDialog,
|
||||
child: OverlayPop(
|
||||
videoItem: videoItem, closeFn: _zoneController.popupDialog?.remove),
|
||||
videoItem: videoItem,
|
||||
closeFn: _removePopupDialog,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user